Repository navigation
fix: read a packed CWL tool through its main, and an inputs file's output-target Directory as a name - #530
Conversation
06d3b7a to
39dbf1d
Compare
c1dc182 to
94af05c
Compare
darkclad
left a comment
There was a problem hiding this comment.
Reviewed the five commits above #529 (cca269c6..94af05c2), diffed against #529's head 42c496c1.
The inputs-file Directory fix, the scatter-as-list change, the Windows skips and the Read the Docs move all read right. All 37 new and touched tests pass in WSL (-k "output_target or packed or ctrl_c or scatter"), including test_a_packed_tool_step_validates_in_cwltool.
One blocker inline: a packed tool whose ports are written the way a CWL packer writes them (list form, id: '#main/text') still compiles to a step with no ports, through all four load points.
| 'CWL runs a packed document through its main, so name the process to run main, ' | ||
| 'or unpack it into a file of its own') | ||
| shared = {key: cwl[key] for key in ('cwlVersion', '$namespaces', '$schemas') if key in cwl} | ||
| return {**shared, **{key: value for key, value in main.items() if key != 'id'}} |
There was a problem hiding this comment.
This drops main's own id but keeps its ports' ids. A packer writes those as #main/<port> in list form (cwltool --pack echo.cwl writes inputs: [{id: '#main/text', ...}]). With $graph: [{id: '#main', class: CommandLineTool, inputs: [{id: '#main/text', type: string, ...}], outputs: [{id: '#main/out', type: stdout}]}], binding text fails with wic028 "binds 'text', which its resolved process does not declare" via run: packed.cwl, the search paths, Step(clt_path=...) and Step.from_cwl_document. On the Python side step.inputs still lists text, because cwl_utils shortens the ids, so only the compile fails. The tests' _PACKED_TOOL uses map-form ports with bare names, which a packer never writes. Stripping the main/ prefix (with or without the leading #) from port ids here, and adding a list-form #main/... case to both _PACKED_TOOL fixtures, would cover it.
There was a problem hiding this comment.
You're right. I only dropped main's own id, so list-form ports written as #main/<port> kept their prefix and the step bound no ports. tool_process now strips the # and main/ prefix from list-form input and output ids of a packed main. Since that is where the document is loaded, all four load points get it. Both _PACKED_TOOL fixtures now use list-form #main/... ports, and they fail without the fix.
Fixed in 171bc0c.
There was a problem hiding this comment.
A closer look found the first fix covered only a $graph, so I amended the commit (now f248b6d). cwltool --pack of a single tool, the case you cited, writes no $graph at all: the tool itself with id: '#main' and #main/<port> ids, which was still read as a plain tool and failed wic028. A document whose id is main or #main is now read as main too: its own id is dropped and main/ is stripped from its port ids, as for a $graph's main. Real cwltool --pack output of echo.cwl and echo_3.cwl now binds every port. The fixtures cover the single-tool form through .wic (beside the root and on the search paths), Step(clt_path=...) and Step.from_cwl_document, plus map-form ports in a $graph, and the cwltool validation test uses the single-tool form. Could you take another look?
94af05c to
171bc0c
Compare
|
Thanks for the review. The blocker is fixed: a packed main's list-form ports ( Fixed in 171bc0c. |
29a26f2 to
f248b6d
Compare
f248b6d to
0dd9eed
Compare
0dd9eed to
fd17287
Compare
darkclad
left a comment
There was a problem hiding this comment.
LGTM. fd172879 fixes the port-id blocker for both forms: a $graph's main and the single-tool id: '#main' that cwltool --pack writes. Real cwltool --pack echo.cwl output now binds every port through run: and Step(clt_path=...). The five earlier commits are unchanged by the rebase. In WSL, test_diagnostics, test_python_api_workflow, test_frontdoor, test_python_api_from_wic and test_ci_coverage pass at this head (398 passed).
Non-blocking, for later: a record-typed port's field names keep their packed id (name: '#main/rec/f'), because only port ids lose the prefix.
A .cwl file that packs its process in a $graph compiled as a tool with no ports, so a step naming it failed with wic028, or in cwltool with the empty step the compile wrote. A CWL runner runs a packed document through its main, and so do we now: wherever a tool document is loaded (the search paths, a run: path beside the document, a Step's clt_path or a document given to Step.from_cwl_document), tool_process picks main, with the cwlVersion, $namespaces and $schemas the packed document declares at its top, so every reader of a tool's CWL sees one process and the file written for the step is main alone. A $graph with no main is refused (wic013), naming the file, the processes it holds and the fix. The Workflow refusal no longer needs to look inside a $graph itself.
The exit-130 test relies on a POSIX process-group SIGINT, so it is skipped on Windows like the other POSIX-only tests. build_pdf.py guarded os.killpg with os.name, which mypy does not narrow on Windows and so reported killpg as missing there; sys.platform is what it narrows on, with the same branch taken on every platform.
…un to create
Written as CWL writes a Directory, {class: Directory, location: result.outDir},
it was made absolute against the inputs file before it was read as an output
target, so the run stopped with "cannot use an absolute location", a path the
user never wrote. Past that, the pre-flight looked for it as a missing input.
The inputs file is now read as the runner reads it before its paths are made
absolute and before the pre-flight checks it, as values bound in Python were.
`scatter: p` and `scatter: [p]` mean the same in CWL, but the compiler copied the authored spelling into the emitted CWL while the Python API always writes the list, so Workflow.from_wic of a file with `scatter: p` compiled to different text than the file. The compiler now always writes the list, and the from_wic comparison no longer needs a scatter rule. No corpus file writes the single-name spelling, so no corpus CWL changes.
RTD removed the ubuntu-20.04 build image on 2026-06-01, so every build since failed at config validation. Also move to Python 3.12 and Sphinx >= 7.2 (the api page uses :no-index:), and fail on warnings as the CI docs build does.
A packer writes main's ports in list form with ids like #main/text, and `cwltool --pack` of a single tool writes no $graph at all: the tool itself, as `id: '#main'`. Only a $graph's main lost its own id, so the ports kept the prefix and a step could not bind them (wic028), and the single-tool form was not read as packed. Either form is now main as a file of its own: no id, and the main/ prefix stripped from its port ids. The fixtures cover both forms, and map-form ports in a $graph.
fd17287 to
a2ea6ed
Compare
Stacked on #529 (
ci/runs-name-what-they-test). Merge that first; this PR's own changes are the commits above it.What
main. One function picksmainfrom a$graphwherever a tool file is loaded: the search paths,run:beside the document,Step(clt_path=...)andStep.from_cwl_document. The step's ports aremain's, and the emitted CWL validates in cwltool. A$graphwith nomainis wic013, naming the processes it holds. The packed-Workflow refusal is unchanged.{class: Directory, location: result.outDir}) is the name of the directory the step creates. It was made absolute before it was read as one, so the run stopped with "cannot use an absolute location" for a path nobody wrote, and the pre-flight then looked for it as a missing input. The inputs file is now read as the runner reads it before either, as values bound in Python already were.scatteris written as a list in the emitted CWL, whichever spelling the.wicuses (scatter: pandscatter: [p]mean the same in CWL). The Python API already wrote the list, soWorkflow.from_wicand the file now compile alike without a scatter rule in the comparison.docs/build_pdf.pycheckssys.platform, which mypy narrows on Windows..readthedocs.yamlmoves fromubuntu-20.04, which Read the Docs removed on 2026-06-01, toubuntu-24.04and Python 3.12, and fails on a warning as the CI docs build does.docs/requirements.txttakes Sphinx 7.2 or newer, because the API page uses:no-index:; the oldsphinx==6.1.*pin rejected it.Why
A packed tool is valid CWL, but it compiled to a step with no ports and failed later in cwltool. An inputs file could not name an output directory the way CWL writes one. The Windows items failed only off CI's Windows selection. Every Read the Docs build since June failed, so
lateststill showed May's docs.