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, Debug)]
71pub enum TaskRunKind {
72 ExecutionUnit {
74 execution_unit: Box<str>,
76 members: Box<[MemberRunSummary]>,
78 },
79 Program {
81 executable: PathBuf,
83 python_script: Option<PathBuf>,
85 },
86 Npy {
88 launcher: PathBuf,
90 },
91}
92
93#[derive(Clone, Debug)]
95pub struct MemberRunSummary {
96 pub(crate) identity: Box<str>,
97 pub(crate) final_iteration: u64,
98 pub(crate) output_directory: PathBuf,
99}
100
101impl MemberRunSummary {
102 pub fn identity(&self) -> &str {
104 &self.identity
105 }
106
107 pub const fn final_iteration(&self) -> u64 {
109 self.final_iteration
110 }
111
112 pub fn output_directory(&self) -> &Path {
114 &self.output_directory
115 }
116}
117
118#[derive(Clone, Debug)]
120pub struct TaskRunSummary {
121 pub(crate) identity: Box<str>,
122 pub(crate) kind: TaskRunKind,
123 pub(crate) output_directory: PathBuf,
124 pub(crate) configuration: usize,
125}
126
127impl TaskRunSummary {
128 pub fn identity(&self) -> &str {
130 &self.identity
131 }
132
133 pub const fn kind(&self) -> &TaskRunKind {
135 &self.kind
136 }
137
138 pub fn output_directory(&self) -> &Path {
143 &self.output_directory
144 }
145
146 pub(crate) fn final_iteration(&self) -> Option<u64> {
147 match &self.kind {
148 TaskRunKind::ExecutionUnit { members, .. } => {
149 members.iter().map(MemberRunSummary::final_iteration).max()
150 }
151 TaskRunKind::Program { .. } | TaskRunKind::Npy { .. } => None,
152 }
153 }
154
155 pub(crate) const fn configuration(&self) -> usize {
156 self.configuration
157 }
158}