Skip to content

Commit 0a65d64

Browse files
authored
write the commit and timestamp into task_info.yaml (#18)
1 parent 04c5e1d commit 0a65d64

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,8 @@
2626

2727
* Updated `README.md` (PR #5).
2828

29+
* `run_benchmark`: write the commit the workflow ran from and the launch time into
30+
`task_info.yaml`, instead of publishing `_viash.yaml` verbatim (PR #18).
31+
2932
## BUGFIXES
3033

src/workflows/run_benchmark/main.nf

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,23 @@ workflow run_wf {
164164
metric_configs_file.write(metric_configs_yaml_blob)
165165

166166
// store the task info in a file
167-
def viash_file = meta.resources_dir.resolve("_viash.yaml")
167+
def task_info = readYaml(meta.resources_dir.resolve("_viash.yaml"))
168+
// commitId is null when nextflow runs from a local checkout instead of a revision
169+
if (workflow.commitId) {
170+
task_info.commit = workflow.commitId
171+
}
172+
// the launch time -- workflow.complete is only known once the run is over
173+
task_info.timestamp = workflow.start.toInstant()
174+
.truncatedTo(java.time.temporal.ChronoUnit.SECONDS).toString()
175+
def task_info_file = tempFile("task_info.yaml")
176+
task_info_file.write(toYamlBlob(task_info))
168177

169178
// create output state
170179
def new_state = [
171180
output_dataset_info: dataset_uns_file,
172181
output_method_configs: method_configs_file,
173182
output_metric_configs: metric_configs_file,
174-
output_task_info: viash_file,
183+
output_task_info: task_info_file,
175184
_meta: states[0]._meta
176185
]
177186

0 commit comments

Comments
 (0)