Skip to content

fix(create_inputs): skip empty optional File/Directory inputs - #13

Merged
sujen1412 merged 1 commit into
developfrom
fix/optional-file-dir-inputs
Oct 12, 2026
Merged

sujen1412 merged 1 commit into
developfrom
fix/optional-file-dir-inputs

Conversation

@sujen1412

Copy link
Copy Markdown
Collaborator

Closes #12

Problem

hysds-ogc-container-builder writes optional: true with no default for File? / Directory? inputs. When the user leaves one empty, validate_job_submit drops it from the job, and map_inputs_from_context then:

  • File?: calls os.path.basename(None) → TypeError, so the job fails before cwltool runs. A "" value instead produced a bogus {"class": "File", "path": "<cwd>"}.
  • Directory?: calls load_json_from_uri(None), so STAC staging fails.

Change

Before the File / Directory branches in map_inputs_from_context:

  • If the value is missing, "" or "None" (the same empty values convert_value_to_cwl_type treats as empty) and the type is optional → skip the input, so cwltool passes no flag to the algorithm.
  • If the value is empty and the input is required → raise ValueError naming the input.

Primitive-type handling is unchanged.

Tests

New tests/test_create_inputs.py (19 tests):

  • Empty optional File? / Directory? (both ["null", T] and T? forms; missing, "", "None") are omitted, and STAC staging isn't called.
  • Empty required File / Directory raises.
  • Provided optional File / Directory values still map and stage as before.
  • Mixed inputs: other inputs are unaffected.
tests/test_create_inputs.py  19 passed

Note: tests/test_stage_in.py::TestStacMetadataPreservation has 2 failures (test_stac_extensions_preserved, test_self_href_set_to_local_path) that also fail on unmodified develop. They're unrelated to this change.

Optional File?/Directory? inputs left empty at submission are now omitted
from inputs.yml instead of crashing on os.path.basename(None) or
attempting STAC staging from an empty URI. Empty required File/Directory
inputs fail early with a clear error.

Closes #12
@sujen1412 sujen1412 self-assigned this Oct 12, 2026
@sujen1412
sujen1412 merged commit 62bfdd5 into develop Oct 12, 2026
1 check passed
@sujen1412
sujen1412 deleted the fix/optional-file-dir-inputs branch October 12, 2026 21:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant