diff --git a/CHANGELOG.md b/CHANGELOG.md index 5962f06..483ad29 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,5 +26,8 @@ * Updated `README.md` (PR #5). +* `run_benchmark`: write the commit the workflow ran from and the launch time into + `task_info.yaml`, instead of publishing `_viash.yaml` verbatim (PR #18). + ## BUGFIXES diff --git a/src/workflows/run_benchmark/main.nf b/src/workflows/run_benchmark/main.nf index 826dec4..f912a21 100644 --- a/src/workflows/run_benchmark/main.nf +++ b/src/workflows/run_benchmark/main.nf @@ -164,14 +164,23 @@ workflow run_wf { metric_configs_file.write(metric_configs_yaml_blob) // store the task info in a file - def viash_file = meta.resources_dir.resolve("_viash.yaml") + def task_info = readYaml(meta.resources_dir.resolve("_viash.yaml")) + // commitId is null when nextflow runs from a local checkout instead of a revision + if (workflow.commitId) { + task_info.commit = workflow.commitId + } + // the launch time -- workflow.complete is only known once the run is over + task_info.timestamp = workflow.start.toInstant() + .truncatedTo(java.time.temporal.ChronoUnit.SECONDS).toString() + def task_info_file = tempFile("task_info.yaml") + task_info_file.write(toYamlBlob(task_info)) // create output state def new_state = [ output_dataset_info: dataset_uns_file, output_method_configs: method_configs_file, output_metric_configs: metric_configs_file, - output_task_info: viash_file, + output_task_info: task_info_file, _meta: states[0]._meta ]