Skip to content

Commit

Permalink
Merge pull request #327 from microbiomedata/326-data-object-descripti…
Browse files Browse the repository at this point in the history
…ons-not-being-populated-correctly

326 data object descriptions not being populated correctly
  • Loading branch information
mbthornton-lbl authored Dec 10, 2024
2 parents b6b18ac + 0cd861a commit 1dad830
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nmdc_automation/workflow_automation/wfutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions tests/test_wfutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down

0 comments on commit 1dad830

Please sign in to comment.