From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 01D0E1FF179 for ; Wed, 12 Nov 2025 21:22:50 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 89D22C777; Wed, 12 Nov 2025 21:23:43 +0100 (CET) Message-ID: <1b53c0d5-333e-42ff-835b-104bf02e78e4@proxmox.com> Date: Wed, 12 Nov 2025 21:23:40 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta To: Proxmox Datacenter Manager development discussion , Lukas Wagner References: <20251112094203.112452-1-l.wagner@proxmox.com> <20251112094203.112452-3-l.wagner@proxmox.com> Content-Language: en-US From: Thomas Lamprecht In-Reply-To: <20251112094203.112452-3-l.wagner@proxmox.com> X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1762978994856 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.024 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: Re: [pdm-devel] [PATCH datacenter-manager 2/7] pbs-client: add bindings for task list, task status, task log X-BeenThere: pdm-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Datacenter Manager development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Proxmox Datacenter Manager development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pdm-devel-bounces@lists.proxmox.com Sender: "pdm-devel" Am 12.11.25 um 10:42 schrieb Lukas Wagner: > diff --git a/server/src/pbs_client.rs b/server/src/pbs_client.rs > index 49087360..4285f402 100644 > --- a/server/src/pbs_client.rs > +++ b/server/src/pbs_client.rs > @@ -125,6 +125,75 @@ pub struct AptUpdateParams { > pub quiet: Option, > } > > +// TODO: This is incomplete, it only contains the parameters needed for remote task fetching. > +// Ideally, the task list API in PBS would use a parameter struct defined in pbs-api-types, which > +// is then also used here. As we have tasks in all projects it certainly can be something very common, and some thought that crossed my mind more than once was splitting out upid from the proxmox-schema crate, while I can relate to why it got placed there initially, it just feels like the wrong place. In a dedicated proxmox-task or proxmox-upid or the like crate these types here might also fit well in. > +#[derive(Debug, Default, Deserialize, Serialize)] > +pub struct ListTasks { > + /// Only list this number of tasks. > + #[serde(default, skip_serializing_if = "Option::is_none")] > + pub limit: Option, > + > + /// Only list tasks since this UNIX epoch. > + #[serde(default, skip_serializing_if = "Option::is_none")] > + pub since: Option, > +} > + > +// TODO: The task-status APIs in PBS as well as PDM don't have a > +// proper type defined anywhere. This should be moved to a shared crate > +// and then the API handlers adapted. > +#[derive(Debug, Deserialize, Serialize)] > +pub struct TaskStatus { > + pub exitstatus: Option, > + > + pub id: Option, > + > + pub node: String, > + > + pub pid: i64, > + > + pub pstart: i64, > + > + pub starttime: i64, > + > + pub status: IsRunning, > + > + #[serde(rename = "type")] > + pub ty: String, > + > + pub upid: String, > + > + pub user: String, > +} > + > +#[derive(Debug, Deserialize, Serialize, PartialEq)] > +#[serde(rename_all = "kebab-case")] > +pub enum IsRunning { > + Running, > + Stopped, > +} > + > +impl TaskStatus { > + /// Checks if the task is currently running. > + pub fn is_running(&self) -> bool { > + self.status == IsRunning::Running > + } > +} > + _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel