From f55d7181bb60074357bda26bffb2c513fa5666bb Mon Sep 17 00:00:00 2001 From: Michael Thornton Date: Mon, 9 Dec 2024 14:55:06 -0800 Subject: [PATCH 1/2] replicate error in unit test --- tests/test_wfutils.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_wfutils.py b/tests/test_wfutils.py index f6a75300..c0b9038b 100644 --- a/tests/test_wfutils.py +++ b/tests/test_wfutils.py @@ -320,6 +320,18 @@ def test_workflow_execution_record_from_workflow_job(site_config, fixtures_dir, assert wfe.ended_at_time +def test_make_data_objects_substutes_workflow_id(site_config, fixtures_dir, tmp_path): + job_metadata = json.load(open(fixtures_dir / "mags_job_metadata.json")) + workflow_state = json.load(open(fixtures_dir / "mags_workflow_state.json")) + job = WorkflowJob(site_config, workflow_state, job_metadata) + data_objects = job.make_data_objects(output_dir=tmp_path) + assert data_objects + for data_object in data_objects: + assert isinstance(data_object, DataObject) + assert job.workflow_execution_id in data_object.description + + + def test_workflow_job_from_database_job_record(site_config, fixtures_dir): job_rec = json.load(open(fixtures_dir / "nmdc_api/unsubmitted_job.json")) From 0cd861ac241097123511e82f95695398da20a98c Mon Sep 17 00:00:00 2001 From: Michael Thornton Date: Mon, 9 Dec 2024 14:56:25 -0800 Subject: [PATCH 2/2] Update data_object init to sub wf ID into description --- nmdc_automation/workflow_automation/wfutils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nmdc_automation/workflow_automation/wfutils.py b/nmdc_automation/workflow_automation/wfutils.py index c9da153c..667acbc1 100755 --- a/nmdc_automation/workflow_automation/wfutils.py +++ b/nmdc_automation/workflow_automation/wfutils.py @@ -537,7 +537,8 @@ def make_data_objects(self, output_dir: Union[str, Path] = None) -> List[DataObj data_object = DataObject( id=output_spec["id"], name=output_file_path.name, type="nmdc:DataObject", url=file_url, data_object_type=output_spec["data_object_type"], md5_checksum=md5_sum, - description=output_spec["description"], was_generated_by=self.workflow_execution_id, ) + description=output_spec["description"].replace('{id}', self.workflow_execution_id), + was_generated_by=self.workflow_execution_id, ) data_objects.append(data_object) return data_objects