Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass input_files value as an array #425

Merged
merged 1 commit into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion nmdc_automation/workflow_automation/sched.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,12 @@ def create_job_rec(self, job: SchedulerJob):
continue
raise ValueError(f"Unable to find {do_type} in {do_by_type}")
input_data_objects.append(dobj.as_dict())
v = dobj["url"]

if k == "input_files":
v = [dobj["url"]]
else:
v = dobj["url"]

# TODO: Make this smarter
elif v == "{was_informed_by}":
v = job.informed_by
Expand Down
23 changes: 23 additions & 0 deletions tests/test_sched.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,4 +266,27 @@ def test_scheduler_find_new_jobs(test_db, mock_api, workflows_config_dir, site_c
assert job_req["config"]["input_data_objects"]


def test_scheduler_create_job_rec_has_input_files_as_array(test_db, mock_api, workflows_config_dir, site_config_file):
"""
Test that the input_data_objects field is an array of strings.
"""
reset_db(test_db)
load_fixture(test_db, "data_object_set.json")
load_fixture(test_db, "data_generation_set.json")
load_fixture(test_db, "read_qc_analysis.json", col="workflow_execution_set")

jm = Scheduler(
test_db, workflow_yaml=workflows_config_dir / "workflows.yaml",
site_conf=site_config_file
)

resp = jm.cycle()
assemblies = [j for j in resp if j["config"]["activity"]["type"] == "nmdc:MetagenomeAssembly"]
assert assemblies
assembly = assemblies[0]

assert isinstance(assembly["config"]["inputs"]["shortRead"], bool)
assert assembly["config"]["inputs"]["shortRead"] == False
assert isinstance(assembly["config"]["inputs"]["input_files"], list)