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) reused: bool,
53 pub(crate) name: Box<str>,
54 pub(crate) tasks: Box<[TaskRunSummary]>,
55}
56
57impl PhaseRunSummary {
58 pub const fn was_reused(&self) -> bool {
60 self.reused
61 }
62
63 pub fn name(&self) -> &str {
65 &self.name
66 }
67
68 pub fn tasks(&self) -> &[TaskRunSummary] {
70 &self.tasks
71 }
72}
73
74#[non_exhaustive]
76#[derive(Clone, Debug)]
77pub enum TaskRunKind {
78 ExecutionUnit {
80 execution_unit: Box<str>,
82 members: Box<[MemberRunSummary]>,
84 },
85 Program {
87 executable: PathBuf,
89 python_script: Option<PathBuf>,
91 },
92 Npy {
94 launcher: PathBuf,
96 processed_directory: PathBuf,
98 },
99}
100
101#[derive(Clone, Debug)]
103pub struct MemberRunSummary {
104 pub(crate) identity: Box<str>,
105 pub(crate) final_iteration: u64,
106 pub(crate) output_directory: PathBuf,
107}
108
109impl MemberRunSummary {
110 pub fn identity(&self) -> &str {
112 &self.identity
113 }
114
115 pub const fn final_iteration(&self) -> u64 {
117 self.final_iteration
118 }
119
120 pub fn output_directory(&self) -> &Path {
122 &self.output_directory
123 }
124}
125
126#[derive(Clone, Debug)]
128pub struct TaskRunSummary {
129 pub(crate) identity: Box<str>,
130 pub(crate) kind: TaskRunKind,
131 pub(crate) output_directory: PathBuf,
132 pub(crate) configuration: usize,
133}
134
135impl TaskRunSummary {
136 pub fn identity(&self) -> &str {
138 &self.identity
139 }
140
141 pub const fn kind(&self) -> &TaskRunKind {
143 &self.kind
144 }
145
146 pub fn output_directory(&self) -> &Path {
151 &self.output_directory
152 }
153
154 pub(crate) fn final_iteration(&self) -> Option<u64> {
155 match &self.kind {
156 TaskRunKind::ExecutionUnit { members, .. } => {
157 members.iter().map(MemberRunSummary::final_iteration).max()
158 }
159 TaskRunKind::Program { .. } | TaskRunKind::Npy { .. } => None,
160 }
161 }
162
163 pub(crate) const fn configuration(&self) -> usize {
164 self.configuration
165 }
166}