Skip to main content

windmill_api/models/
runnable_stats.rs

1/*
2 * Windmill API
3 *
4 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
5 *
6 * The version of the OpenAPI document: 1.834.0
7 * Contact: contact@windmill.dev
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// RunnableStats : Resource usage of the jobs of one runnable on one worker group. Memory and CPU are only known for jobs run as a subprocess; memory is the peak of the job's main process. 
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct RunnableStats {
17    #[serde(rename = "workspace_id")]
18    pub workspace_id: String,
19    /// path of the script or flow step; `<adhoc>` gathers previews and other runs without a stable path
20    #[serde(rename = "runnable_path")]
21    pub runnable_path: String,
22    #[serde(rename = "worker_group")]
23    pub worker_group: String,
24    #[serde(rename = "job_count")]
25    pub job_count: i32,
26    #[serde(rename = "total_duration_ms")]
27    pub total_duration_ms: i32,
28    /// highest peak memory of a job, in kB
29    #[serde(rename = "max_memory_peak")]
30    pub max_memory_peak: i32,
31    /// sum of the peak memory of the jobs that have one, in kB
32    #[serde(rename = "sum_memory_peak")]
33    pub sum_memory_peak: i32,
34    /// number of jobs that have a peak memory reading
35    #[serde(rename = "memory_sample_count")]
36    pub memory_sample_count: i32,
37    #[serde(rename = "total_cpu_ms")]
38    pub total_cpu_ms: i32,
39}
40
41impl RunnableStats {
42    /// Resource usage of the jobs of one runnable on one worker group. Memory and CPU are only known for jobs run as a subprocess; memory is the peak of the job's main process. 
43    pub fn new(workspace_id: String, runnable_path: String, worker_group: String, job_count: i32, total_duration_ms: i32, max_memory_peak: i32, sum_memory_peak: i32, memory_sample_count: i32, total_cpu_ms: i32) -> RunnableStats {
44        RunnableStats {
45            workspace_id,
46            runnable_path,
47            worker_group,
48            job_count,
49            total_duration_ms,
50            max_memory_peak,
51            sum_memory_peak,
52            memory_sample_count,
53            total_cpu_ms,
54        }
55    }
56}
57