Repository navigation
feat(compute): run a workflow on the compute service with Nextflow - #597
Conversation
d18584d to
97e1325
Compare
ff46b27 to
481a8a0
Compare
schema-salad warns that an id is "previously defined" where an input and an output of one process share a name, as `outDir` does in a Polus plugin and `file` in the shipped append.cwl. The filter that drops the warning was installed by hand at three doors: the command line, Workflow.run() and the cwltool runner's process. Workflow.compile() passed none of them, so a program that compiles without running here printed the warning for every such tool, as will a site and the compute client. The filter is now installed where `utils_cwl` is imported, the one module that loads CWL through cwltool, so no door can miss it; the runner's process imports it with the compiler. cwltool's "Resolved '<path>' to '<uri>'" is said by the runner's process alone and is filtered there, in cwltool_main, beside rdflib's warning. `plugins.logging_filters` and its two filter classes are gone, with their three calls. The property that builds one tool through every door now finds no door logging a line, with a tool whose input and output share a name among its examples. docs/tool-builder.md no longer shows a "Resolved" line that `python count_words.py` does not print.
…under Singularity and publishes every output
darkclad
left a comment
There was a problem hiding this comment.
LGTM. Reviewed as its own four commits on top of #590 (443b0b4a..481a8a04). build_request and request_for keep a CWL request exactly as before, with no engine, so a 3.0.0 service still takes it. The Nextflow path lowers through the same target table compile(target='nextflow') uses, and the service form changes only the container directives, the task script's runscript and HOME lines, and the entry workflow's publish:/output block. The default emission is untouched. _params finds output folders the way the service does on CWL (staged writable and named by a Directory output's glob), and it refuses an absolute one before anything is sent. _cwl_objects now leaves Toil's objects as they are, because they carry a location. On Windows, test_compute.py, nextflow/test_service_form.py and test_ci_coverage.py pass. test_backends.py fails the same 4 tests at head and at #590's tip, all environmental. The Nextflow runtime and service-lane tests were not run here. One non-blocking note inline.
| request = build_request(workflow, config, tool_registry=tool_registry, inference=inference) | ||
| request = build_request(workflow, config, target=target, tool_registry=tool_registry, inference=inference) | ||
| self._client.speaks() | ||
| if target == 'nextflow' and self._client.contract == '3.0.0': |
There was a problem hiding this comment.
Nit, non-blocking: this compares the full version string, so a 3.0.x patch release of the service would get past the gate. The service would then refuse engine through its schema, so the user would not get this one-line message. Comparing the minor version (for example self._client.contract.split('.')[:2] == ['3', '0']) would cover every 3.0 service.
… to run render_nextflow(workflow, service=True) writes the pipeline a compute service runs, and service_pipeline(workflow) compiles a workflow to it: the model, the one file, its parameters as nextflow_params.json holds them, every path as written, and the real-time analyses it declares. compile(), write() and a local run never write it. A process with a container has its container directive and, when it asks for GPUs, containerOptions '--nv'; no beforeScript and no --entrypoint. Its script runs the command after /.singularity.d/runscript with SINGULARITY_NO_EVAL set, as singularity run --no-eval does, and alone where the image has no runscript. The entry workflow publishes each workflow output as one value, the one its record carries, once every output has completed: the pipeline places each path in the outputs folder as Toil places a CWL run's. A path inside a folder the workflow also returns is at its place in that folder's copy, never copied on its own; every other path is copied once, the outputs in the order of their names, under the first name no copy has taken, its own, or with _2, _3 and on, and a path two outputs return copied once. So the pipeline first copies each path no other returned path holds, and then gives every path its place. Nextflow publishes a path outside the work directory as it is. Nextflow's own publishing would put each file at its path in its task directory, where two files of one name meet, one lost or the run failed. -output-format json then prints the outputs laid out as a CWL run's. A null leaves its channel empty, since a null never binds one and the run would hang; Nextflow prints it as null. No sophios-output line is printed. A workflow output whose name Nextflow does not keep is refused (wic061), and so is each output of a workflow that declares none, named <step>~<port>, its message saying to declare the outputs: a client attaching to a run later reads its outputs by the published names. The import refuses the service form, at the publishing helper (wic047) or a containerized script (wic050).
…orkflow on the service with Nextflow Service.submit, build_request and request_for take target, 'cwl' by default, as Workflow.run does, and raise Workflow.compile's ValueError for any other. A Nextflow request names its engine, nextflow, and sends the pipeline's service form as its one file, main.nf, and the pipeline's parameters as its inputs, each path a location as written. A CWL request is as it was, naming no engine, so a 3.0.0 service takes it. An output folder, a parameter a process stages writable and a Directory output of it names in its glob, as the service finds one in a CWL workflow, is sent by its name as the empty Directory the service makes in the run, and the pipeline publishes it under that name; one given an absolute path is refused, naming the input, since only a CWL run writes in place. A Nextflow submit to a service of contract 3.0.0 is refused in one line before anything is sent. Run.outputs() gives each File and Directory its class, location, path and basename on both: each a pipeline published, its class and path, gains its location and basename, its copy's name, from the answer alone, so an attached run reads the same; a CWL runner's object, which has its location, is left as it is, with what Toil adds. The request schema is the driver's of contract 3.1.0, byte for byte.
…ow and on CWL, and their outputs agree With SOPHIOS_NEXTFLOW_ENV naming a conda env that holds Nextflow and its Java, the lane starts a second driver whose Toil env holds that Nextflow, as the driver's own Nextflow lane does, with a stand-in for singularity on the job's PATH that runs a task's command on this machine. A containerized tool that asks for a GPU, copies the folder it reads and ./models into the output folder it stages writable, given a name, and returns it, runs once and scattered over two names, its paths absolute and relative to basepath. On Nextflow it runs in its container, through the stand-in, which finds no runscript, and each task job asks Slurm for the GPU; on CWL with real Toil, with no container and no GPU, which Toil refuses on this machine. outputs(), and an attached run's, are the same: names, shapes, basenames and files, each in the run's outputs folder. A second workflow runs on both: two outputs of one file name, declared out of the order of their names, a third returning one of those files again, a folder returned with a file of that name in it, which an output whose name sorts before the folder's returns too, and a tool that stages a folder writable and returns something else. Toil and Nextflow agree on each output's class and its path in the outputs folder, on the files there and their text, the file in the returned folder held in the folder's copy alone, and on how many of the user's files the tool saw in the folder it was given.
481a8a0 to
8199573
Compare
What
Service.submit(workflow, config, target='nextflow')runs a workflow on the compute service with Nextflow: the leader one Slurm job, each task a Slurm job of its own.target='cwl', the default, runs it with Toil as before. The service must speak contract 3.1.0; one of 3.0.0 refuses a Nextflow submission in one line, before anything is sent.The service form of the pipeline (
design_docs/sophios_nextflow_backend.md§4.5, in thedesign:commit).service_pipeline(workflow)lowers through the target table with the viewcompile(target='nextflow')uses, andrender_nextflow(model, service=True)writes onemain.nf. It differs from the default emission in three places:containerdirective and loses the Docker bridge (beforeScript,--entrypoint). Its script runs the command after the image's runscript withSINGULARITY_NO_EVALset, assingularity run --no-evaldoes, so the image'sENTRYPOINTruns first, as through CWL; where the image has no runscript, the command alone. A process that asks for GPUs getscontainerOptions '--nv'.HOMEis its task directory, CWL's rule. Nextflow runs a container without the user's home, so a tool that writes under~(a cache, say) would otherwise fail on a read-only file system. A tool's ownEnvVarRequirementstill wins.x, thenx_2,x_3). Each output is published as one value, so-output-format jsonprints the outputs laid out as a CWL run's. Nosophios-outputline is printed.compile(),write()and a local run never write the service form, and the import refuses it (wic047at the publishing helper,wic050at a containerized script).The request. A Nextflow request names its
engine, its document is{'files': {'main.nf': ...}}, and its inputs are the pipeline's parameters. AFileorDirectorygoes as the CWL object it is. An output folder, aDirectoryits tool stages writable and returns through aDirectoryoutput's glob (the service's own rule on CWL), given a name goes as an emptyDirectoryliteral, which the service makes empty in the run; given an absolute path it is refused (RequestRefused): only a CWL run writes in place. A CWL request names no engine, so it is the request a 3.0.0 service takes.run-request.schema.jsonis the service's 3.1.0 schema, byte for byte.wic061. A workflow output whose name Nextflow does not keep is refused, and so is each output of a workflow that declares none: a client attaching to a run later reads its outputs by the published names. The message names the output, or the step and its port, and a name Nextflow keeps.Targets by the table.
targetiswic_types.TargetName, an unknown one is reported bytargets.target, and a workflow the Nextflow target cannot run raisesNotLowered, ascompile(target='nextflow')does.The first commit is a fix this PR needs, and every later PR of the chain: schema-salad warns that an id is
previously definedfor each tool whose input and output share a name (outDirin a Polus plugin,filein the shippedappend.cwl). The filter that drops the warning was installed by hand at three doors, the command line,Workflow.run()and the cwltool runner's process, andWorkflow.compile()passed none of them, so a program that compiles without running here printed it, asService.submitdoes. It is now installed whereutils_cwlis imported, the one module that loads CWL through cwltool, so no door can miss it. cwltool'sResolved '<path>' to '<uri>', which only the runner's process says, is filtered incwltool_main, beside rdflib's warning.What changes for callers
One warning is no longer printed:
compile(),check()andService.submitno longer print schema-salad'spreviously definedwarning, whichrun()and the command line never printed. A program that also uses schema-salad itself loses that warning from its import of Sophios's API on, where it lost it at its firstrun(); cwltool'sResolvedline is no longer filtered in such a program, only in the runner's process. Otherwise nothing, unlesstarget='nextflow'is passed toService.submit,build_requestorrequest_for. The default Nextflow emission is unchanged: 144 cases (576 files: each pipeline with its configuration, parameters and model), written with and without the four commits after the fix, while this PR sat on #590, are identical.Deleted
plugins.logging_filters, its two filter classes and its three calls: the filter is installed where CWL is loaded.Why
The compute service runs the same workflow on either engine, chosen per submission, with the same
RunConfig,Runand outputs.Verified
4b11628d) with nothing of Sites beneath it, five commits (81995735), and refactor: a backend describes a run, and the machine acts #587 to feat(sites): run Nextflow on a Slurm cluster #590 are stacked on it. What moved:previously definedwarning came from refactor: a backend describes a run, and the machine acts #587 and is this PR's first commit:Service.submitis a door that showed the warning.wic061, the next free one, where it waswic067; the sites' codes are one up. The entries below keep the numbers of their day.sophios.sitesis not beneath it.test_the_service_form_publishes_each_output_as_a_cwl_run_returns_itread all of stdout as the outputs object. It has failed in Lint And Test's Nextflow Runtime step on this PR's heads since 2026-11-13: all nine runs failed, and the three I read (the first, the last and one between) failed on this test alone. CI's launcher keeps Nextflow inNXF_HOME, which each test makes new, so it prints a line of its own before the object. The test now reads the object from its first{. With a launcher that prints that line the test failed as CI did before the change, and passes after it; with the plain launcher it passes as before.wic061sits in the code table and in the provocations, now in the order of the numbers, and feat(compute): run a workflow on the compute service with Nextflow #597's test fix.mypy(237 files) andlint-imports(8 contracts kept) clean;pylinton the files it changes gives one message master has not,compute.pyat 751 lines, known since 2026-11-17; the census of codes passed;test_compute.py,test_service_form.py, the Nextflow runtime file,test_python_api_workflow.py,test_plugins.py,test_backends.py,test_diagnostics.py,test_ci_coverage.pyandtest_entry_points.py: 114 passed, and the twowccases that fail on this Mac on master too;test_run_local.py: 40 passed; the service lane, which CI does not run, against the driver at8ba40d5with Nextflow: 18 passed. After the test fix: the two service-form runtime tests again, passed. The whole lanes are CI's.4b11628d), seven commits on from252d37a2: master deletes thepython_scriptstep with its codewic014, and says why the warning refactor: a backend describes a run, and the machine acts #587 drops is filtered. Three conflicts here. The Compile row ofdocs/checks-and-errors.mdis master's,wic011–wic013, withwic067at its end. The docstring oftests/core/helpers.pylists what master added (a Python file imported) and what this PR adds (the segmentation workflow).test_compute_service.pyimportsimport_python_filefrom the test helpers, as master has it now thatsophios.python_cwl_adapteris gone, beside this PR'sTargetName. Checked at the chain's top (481a8a04), not by the lanes, which CI runs:mypyas the pre-commit hook runs it, clean; every test module imports (595 tests collected); nothing in the chain names what master deleted.tests/core/nextflow/test_service_form.py,test_ci_coverage.pyandtest_diagnostics.pypass there. The service lane (test_compute_service.py, a local lane) was not run again: its one change is that import.8689def3), which adds the fix that drops schema-salad'spreviously definedwarning wherever CWL is loaded. A replay with no conflict:git range-diffshows each of this PR's commits as the patch it was.Service.submitcompiles without running here, the door at which the warning was seen: with the fix, the request of a segmentation tool whose input and output are bothoutputis built forcwland fornextflowwith nothing logged. Gated once at this tip (ff46b27e): see refactor: a backend describes a run, and the machine acts #587.252d37a2): the change of feat(sites): run a workflow on a machine of your own over ssh #588 to feat(sites): run Nextflow on a Slurm cluster #590 that sets a site's flags where the run is placed, carried here as feat(sites): run Nextflow on a Slurm cluster #590 has it; nothing of this PR's own. At this PR's tiptest_sites.py,test_python_api_workflow.py,test_basepath.pyandtest_run_local.py: 147 passed; the census of codes passed; lint-imports, 8 contracts kept.603c2194). feat(lang): write a tool in .wic #609 moved three times during the day (aef7ab98,681d54c6,603c2194) and the chain's 15 commits were replayed onto each. Three conflicts in all: two in feat(compute): run a workflow on the compute service with Nextflow #597 (the runtime adapter's imports, where feat(lang): write a tool in .wic #609 droppedlang.tool; the Compile row of the layer table indocs/checks-and-errors.md, which is feat(lang): write a tool in .wic #609's withwic067at its end) and one in feat(sites): run a workflow on a machine of your own over ssh #588 (the provocations table, where feat(lang): write a tool in .wic #609 removed theINVALID_NAMEentry the hunk sat beside).git range-diffshows no other change to any commit than the codes. What was run locally, and where: ataef7ab98, the whole chain was gated once at feat(compute): run a workflow on the compute service with Nextflow #597's tip as master's lanes run (mypy251 files,lint-imports8 contracts kept,pre-commit,autopep8,pylint9.95 as feat(lang): write a tool in .wic #609's tip, the chain adding the twotoo-many-linesmessages of feat(compute): run a workflow on the compute service with Nextflow #597;test_entry_points.pywithtest_ci_coverage.py12 passed; the census of codes 4 passed; the package job's selection 465 passed, 8 skipped; the Nextflow Runtime step 32 passed), with six failures, each reproduced on feat(lang): write a tool in .wic #609's head alone: the five known on this Mac (macOSwcpadding, four cases; Python 3.14'sPurePath.as_uri()deprecation, one) and one Hypothesis draw oftest_a_scatter_records_what_cwl_defines_for_its_methodwhose captured text passes the 64 KiBloadContentstakes. At681d54c6and603c2194each commit passed its pre-commit hooks,mypyamong them, and nothing else was run locally: CI is the gate for this head.wic058towic060, so every code of this chain moved up by two:wic061towic065in feat(sites): run a workflow on a machine of your own over ssh #588,wic066in feat(sites): run a workflow on a Slurm cluster, with the CWL runners #589,wic067in feat(compute): run a workflow on the compute service with Nextflow #597, in the code, the docs, the tests, the design and the commit messages. The numbers in the entries below are the ones the codes have now. The compute tests and the local service lane, against the driver'svasu_revampat8ba40d5: 46 passed at this PR's tip onaef7ab98; not run again at603c2194.b7ff2244), which carries fix(plugins): read a tool when a step runs it #608 and the tool documents. The whole chain was gated once at feat(compute): run a workflow on the compute service with Nextflow #597's tip, which contains this PR (CI runs each PR on its own), as master's lanes run:mypy(251 files),lint-imports(8 contracts kept),pre-commit runfrom feat(lang): write a tool in .wic #609's tip to the top (22 hooks),autopep8,pylint src/ examples/**/*.py tests/(9.96, feat(lang): write a tool in .wic #609's tip 9.95; the chain adds two messages to feat(lang): write a tool in .wic #609's, bothtoo-many-linesand both in feat(compute): run a workflow on the compute service with Nextflow #597:_workflow_runtime.pyat 763 lines andcompute.pyat 751) andmake html, whose pages are written, the code table listingwic057towic067and the contents the Sites page, and whose one warning is intersphinx's inventory fetch, which this network's proxy refuses and the docs Makefile now makes an error, on feat(lang): write a tool in .wic #609's tip alike;test_entry_points.pywithtest_ci_coverage.py12 passed; the census of codes (test_lang_parser.pyand its three siblings,-m skip_pypi_ci) 4 passed; the package job's selection (-m "not skip_pypi_ci and not nextflow and not cwl_corpus") 502 passed, 8 skipped; Lint And Test's Nextflow Runtime step with Nextflow 26.10.5 33 passed. Five cases fail on this Mac at this tip and at feat(lang): write a tool in .wic #609's alike:[commands]and[nested]oftest_an_example_runs_under_cwltool_as_statedand oftest_an_example_workflow_runs_under_nextflow_as_stated(macOSwcpads its count), andtest_cookbook.py::test_every_pair_compiles_alike_from_both_surfaces_and_as_stated, which stops on Python 3.14's deprecation ofPurePath.as_uri()in master'slang/cwl.py. The gate ran on feat(lang): write a tool in .wic #609 at0801d5bc; feat(lang): write a tool in .wic #609 was then rebased onto master asb7ff2244with the same tree, and the chain replayed onto it, changing one line of the design.wic058(a tool document Sophios cannot read), so every code of this chain moved up by one again:wic061towic065in feat(sites): run a workflow on a machine of your own over ssh #588,wic066in feat(sites): run a workflow on a Slurm cluster, with the CWL runners #589,wic067in feat(compute): run a workflow on the compute service with Nextflow #597, in the code, the docs, the tests, the design and the commit messages.tool_process; one docstring ofsites/_site.py, which feat(sites): run a workflow on a machine of your own over ssh #588 now words by the runner's engine; nothing of this PR's own. The compute tests and the local service lane (tests/core/test_compute.pyandtests/core/test_compute_service.py, against the driver'svasu_revampat8ba40d5, with Node 26 and Nextflow 26.10.5): 46 passed at this tip.05d2533a), which sits on master with feat(run): runner values on run(), and one run for both doors #600's runner values. The whole chain was gated once at feat(compute): run a workflow on the compute service with Nextflow #597's tip, which contains this PR (CI runs each PR on its own), as master's lanes run:mypy(247 files),lint-imports(8 contracts kept),pre-commit runfrom refactor: one statement for each fact, in docs, tests and the Nextflow target #605's tip to the top (22 hooks),autopep8,pylint src/ examples/**/*.py tests/(9.95) andmake html(its code table listswic057towic067, its contents the Sites page);test_entry_points.pywithtest_ci_coverage.py12 passed; the census of codes (test_lang_parser.pyand its three siblings,-m skip_pypi_ci) 4 passed; the package job's selection (-m "not skip_pypi_ci and not nextflow and not cwl_corpus") 440 passed, 8 skipped; Lint And Test's Nextflow Runtime step with Nextflow 26.10.5 33 passed. Five cases fail on this Mac at this tip and at refactor: one statement for each fact, in docs, tests and the Nextflow target #605's alike:[commands]and[nested]oftest_an_example_runs_under_cwltool_as_statedand oftest_an_example_workflow_runs_under_nextflow_as_stated(macOSwcpads its count), andtest_cookbook.py::test_every_pair_compiles_alike_from_both_surfaces_and_as_stated, which stops on Python 3.14's deprecation ofPurePath.as_uri()in master'slang/cwl.py.wic057meanwhile (a tool cwltool refuses), so every code of this chain moved up by one:wic061towic065in feat(sites): run a workflow on a machine of your own over ssh #588,wic066in feat(sites): run a workflow on a Slurm cluster, with the CWL runners #589,wic067in feat(compute): run a workflow on the compute service with Nextflow #597. Each is declared as master now declares a code, with its explanation in the enum;docs/error_codes.mdis built from them.service_pipelinelowers as master'scompile(target='nextflow')does, from the view alone; the depth of an output's value is read with master'sscatter_edges; and the sentence this PR added to the Nextflow design's paragraph on image entrypoints went with that paragraph, which refactor: one statement for each fact, in docs, tests and the Nextflow target #605 removed (§4.5 says it). The local service lane (SOPHIOS_SLURM_DRIVERon the driver'svasu_revamp, Node 26,SOPHIOS_NEXTFLOW_ENVon Nextflow 26.10.5) withtest_compute.py: 46 passed, once its containerized GPU step gave the two fields cwltool requires of acwltool:CUDARequirement, without which master now refuses the tool (wic057); that one test line changed after the gate, in a file no CI lane collects.2026-11-13, with Nextflow 26.10.5. At this tip, after the rebase onto feat(sites): run Nextflow on a Slurm cluster #590's current head:
mypy(250 files) andlint-imports(7 contracts kept).pytest -m fast: 361 passed, 8 skipped.tests/core/test_compute.py,tests/core/nextflow/test_service_form.pyandtests/core/test_ci_coverage.py: 41 passed. The two service-form tests moved totest_service_form.py, since master removedtest_renderer.py.tests/core/nextflow -m nextflow -k service: 2 passed, the Docker runscript test included.tests/core/test_compute_service.py -m skip_pypi_ci(local only: no CI checks the service out): 18 passed against a service at contract 3.1.0, with Nextflow under its fake Slurm. It runs the segmentation shape, and a second workflow of colliding file names, a file inside a returned folder and a folder staged writable, on both engines and requires their outputs to agree.Before the rebase, on the same four commits:
--nv; nowic067refusal; thewic067message with a Python line, which is not valid for a step inside a subworkflow; no runscript before the command;HOMEunset; the output-folder rule without "staged writable" (two forms) and without "returned"; outputs copied in declared order; a copy for each return of one path; and a path inside a returned folder copied on its own (three forms).