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 475131FF17A for ; Tue, 11 Nov 2025 11:50:57 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id D9B6165AC; Tue, 11 Nov 2025 11:51:42 +0100 (CET) From: Lukas Wagner To: pdm-devel@lists.proxmox.com Date: Tue, 11 Nov 2025 11:50:59 +0100 Message-ID: <20251111105059.148997-9-l.wagner@proxmox.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20251111105059.148997-1-l.wagner@proxmox.com> References: <20251111105059.148997-1-l.wagner@proxmox.com> MIME-Version: 1.0 X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1762858244103 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.029 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 SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pdm-devel] [RFC datacenter-manager 8/8] remote task cache: handle PBS tasks correctly 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" The remote task cache assumed in some cases that all UPIDs were PVE UPIDs; mostly for simplicity, since PBS remotes were not implemented yet at the time of implementation of the task cache. The new remote_type and native_upid functions for the RemoteUpid struct makes it pretty simple to add support for PBS. Signed-off-by: Lukas Wagner --- server/src/remote_tasks/mod.rs | 21 ++++++++++++++++----- server/src/remote_tasks/task_cache.rs | 19 ++++++++++++------- 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/server/src/remote_tasks/mod.rs b/server/src/remote_tasks/mod.rs index 37e689e0..f39d0b77 100644 --- a/server/src/remote_tasks/mod.rs +++ b/server/src/remote_tasks/mod.rs @@ -2,7 +2,7 @@ use std::path::Path; use anyhow::Error; -use pdm_api_types::{RemoteUpid, TaskFilters, TaskListItem, TaskStateType}; +use pdm_api_types::{NativeUpid, RemoteUpid, TaskFilters, TaskListItem, TaskStateType}; use pve_api_types::PveUpid; pub mod task_cache; @@ -52,10 +52,9 @@ pub async fn get_tasks( return None; } } - // TODO: Handle PBS tasks - let pve_upid: Result = task.upid.upid().parse(); - match pve_upid { - Ok(pve_upid) => Some(TaskListItem { + + match task.upid.native_upid() { + Ok(NativeUpid::PveUpid(pve_upid)) => Some(TaskListItem { upid: task.upid.to_string(), node: pve_upid.node, pid: pve_upid.pid as i64, @@ -67,6 +66,18 @@ pub async fn get_tasks( endtime: task.endtime, status: task.status, }), + Ok(NativeUpid::PbsUpid(pbs_upid)) => Some(TaskListItem { + upid: task.upid.to_string(), + node: pbs_upid.node, + pid: pbs_upid.pid as i64, + pstart: pbs_upid.pstart, + starttime: pbs_upid.starttime, + worker_type: pbs_upid.worker_type, + worker_id: pbs_upid.worker_id, + user: pbs_upid.auth_id, + endtime: task.endtime, + status: task.status, + }), Err(err) => { log::error!("could not parse UPID: {err:#}"); None diff --git a/server/src/remote_tasks/task_cache.rs b/server/src/remote_tasks/task_cache.rs index cb3b6687..1eee46a6 100644 --- a/server/src/remote_tasks/task_cache.rs +++ b/server/src/remote_tasks/task_cache.rs @@ -15,8 +15,7 @@ use serde::{Deserialize, Serialize}; use proxmox_sys::fs::CreateOptions; -use pdm_api_types::RemoteUpid; -use pve_api_types::PveUpid; +use pdm_api_types::{NativeUpid, RemoteUpid}; /// Filename for the file containing running tasks. const ACTIVE_FILENAME: &str = "active"; @@ -405,15 +404,21 @@ impl WritableTaskCache { // Remove this finished task from our set of active tasks. active_tasks.remove(&task.upid); - // TODO:: Handle PBS tasks correctly. - // TODO: This is awkward, maybe overhaul RemoteUpid type to make this easier - match task.upid.upid().parse::() { - Ok(upid) => { + match task.upid.native_upid() { + Ok(NativeUpid::PveUpid(upid)) => { let node = &upid.node; let remote = task.upid.remote(); if node_success_map.node_successful(remote, node) { - state.update_cutoff_timestamp(task.upid.remote(), node, task.starttime); + state.update_cutoff_timestamp(remote, node, task.starttime); + } + } + Ok(NativeUpid::PbsUpid(upid)) => { + let node = &upid.node; + let remote = task.upid.remote(); + + if node_success_map.node_successful(remote, node) { + state.update_cutoff_timestamp(remote, node, task.starttime); } } Err(error) => { -- 2.47.3 _______________________________________________ pdm-devel mailing list pdm-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pdm-devel