src/api2/types.rs: define and use struct TaskListItem

This commit is contained in:
Dietmar Maurer
2020-01-28 11:22:06 +01:00
parent 2c4b303c62
commit 99384f7933
2 changed files with 48 additions and 22 deletions

View File

@ -342,6 +342,37 @@ pub struct StorageStatus {
pub avail: u64,
}
#[api(
properties: {
"upid": { schema: UPID_SCHEMA },
},
)]
#[derive(Serialize, Deserialize)]
/// Task properties.
pub struct TaskListItem {
pub upid: String,
/// The node name where the task is running on.
pub node: String,
/// The Unix PID
pub pid: i64,
/// The task start time (Epoch)
pub pstart: u64,
/// The task start time (Epoch)
pub starttime: i64,
/// Worker type (arbitrary ASCII string)
pub worker_type: String,
/// Worker ID (arbitrary ASCII string)
pub worker_id: Option<String>,
/// The user who started the task
pub user: String,
/// The task end time (Epoch)
#[serde(skip_serializing_if="Option::is_none")]
pub endtime: Option<i64>,
/// Task end status
#[serde(skip_serializing_if="Option::is_none")]
pub status: Option<String>,
}
// Regression tests
#[test]