scientific_workflow/runtime/
summary.rs1use std::path::{Path, PathBuf};
4
5#[derive(Clone, Debug)]
7pub struct RunSummary {
8 pub(crate) output_directory: PathBuf,
9 pub(crate) replicates: Box<[ReplicateRunSummary]>,
10}
11
12impl RunSummary {
13 pub fn output_directory(&self) -> &Path {
15 &self.output_directory
16 }
17
18 pub fn replicates(&self) -> &[ReplicateRunSummary] {
20 &self.replicates
21 }
22}
23
24#[derive(Clone, Debug)]
26pub struct ReplicateRunSummary {
27 pub(crate) index: u64,
28 pub(crate) output_directory: PathBuf,
29 pub(crate) phases: Box<[PhaseRunSummary]>,
30}
31
32impl ReplicateRunSummary {
33 pub const fn index(&self) -> u64 {
35 self.index
36 }
37
38 pub fn output_directory(&self) -> &Path {
40 &self.output_directory
41 }
42
43 pub fn phases(&self) -> &[PhaseRunSummary] {
45 &self.phases
46 }
47}
48
49#[derive(Clone, Debug)]
51pub struct PhaseRunSummary {
52 pub(crate) name: Box<str>,
53 pub(crate) tasks: Box<[TaskRunSummary]>,
54}
55
56impl PhaseRunSummary {
57 pub fn name(&self) -> &str {
59 &self.name
60 }
61
62 pub fn tasks(&self) -> &[TaskRunSummary] {
64 &self.tasks
65 }
66}
67
68#[non_exhaustive]
70#[derive(Clone, Copy, Debug, Eq, PartialEq)]
71pub enum TaskRunKind {
72 Model,
74 Program,
76}
77
78#[derive(Clone, Debug)]
80pub struct TaskRunSummary {
81 pub(crate) identity: Box<str>,
82 pub(crate) kind: TaskRunKind,
83 pub(crate) model: Option<Box<str>>,
84 pub(crate) program: Option<PathBuf>,
85 pub(crate) program_kind: Option<Box<str>>,
86 pub(crate) python_script: Option<PathBuf>,
87 pub(crate) final_iteration: Option<u64>,
88 pub(crate) output_directory: PathBuf,
89}
90
91impl TaskRunSummary {
92 pub fn identity(&self) -> &str {
94 &self.identity
95 }
96
97 pub const fn kind(&self) -> TaskRunKind {
99 self.kind
100 }
101
102 pub fn model(&self) -> Option<&str> {
104 self.model.as_deref()
105 }
106
107 pub fn program(&self) -> Option<&Path> {
112 self.program.as_deref()
113 }
114
115 pub fn program_kind(&self) -> Option<&str> {
117 self.program_kind.as_deref()
118 }
119
120 pub fn python_script(&self) -> Option<&Path> {
122 self.python_script.as_deref()
123 }
124
125 pub const fn final_iteration(&self) -> Option<u64> {
127 self.final_iteration
128 }
129
130 pub fn output_directory(&self) -> &Path {
132 &self.output_directory
133 }
134}