Repository navigation
chore(nextflow): rebase the backend onto master - #563
Conversation
--basepath and --outdir choose the directories Sophios writes to; the docs said they move them.
Running and the landing page named a cluster's login node as a place to run Sophios.
run_setup writes what a check reads into a temporary directory it removes; nothing creates the base path before writing into it, and --check refuses --graphviz, which writes drawings.
…nputs in one call write(path=None) writes <name>.cwl and <name>_inputs.yml, everything a CWL runner needs, into one directory (the current one by default) and returns it. write_cwl() and write_job_inputs() stay as the one-file writers. The CWL page and the example scripts that wrote the pair now make the one call.
Dependabot's 16 alerts were all in the lockfiles of the four actions in .github/my_actions, for packages they barely used: @actions/core for getInput, setOutput and setFailed, @actions/github for the repository name and the event payload, and node-fetch for a fetch that Node 24 has built in. Bumping the packages meant rebuilding four 1.5 MB ncc bundles. Each index.js now does those few things with Node's built-ins: inputs from INPUT_*, the repository from GITHUB_REPOSITORY, the payload from GITHUB_EVENT_PATH, outputs appended to GITHUB_OUTPUT in the heredoc form @actions/core wrote, and a failure as ::error:: with exit code 1. action.yml runs index.js itself, so package.json, package-lock.json and dist/ go, and with them the ncc build step in each header, the pre-commit excludes for the bundles and the node_modules/ ignore. dist/ stays ignored: Python builds land there. Under Node 24, against a local mock of the GitHub API, the bundles on master and the new index.js send the same requests, print the same lines, write the same outputs and exit with the same code, in 17 scenarios across the four actions. Only the headers fetch adds on its own differ (User-Agent and the like), and, with an empty token, fetch trims "Bearer " to "Bearer"; GitHub answers both with the same 401.
nodejs<26.8 held every conda env at 26.6.0, below Node's security releases. The ceiling kept out conda-forge's 26.8.0, whose `node --version` was a pre-release string cwltool's sandboxjs cannot parse (d51bac1). conda-forge now has 26.12.1, the 2026-10-21 security release, for linux-64, osx-64, osx-arm64 and win-64, and it prints a plain v26.12.1. nodejs=26 takes the newest 26.x: each env file solves to 26.12.1, and an existing env moves to it on update. A pre-release build would still stop cwltool with "invalid literal for int() with base 10", so it cannot slip by unnoticed. The Windows file points to system_deps.yml for the reason, as the CI file already did. README and the install page give the same command. For a pre-release build the troubleshooting entry installs the release before it, "nodejs=26,<26.8.0" for its example: such a build is most likely the newest 26.x, which nodejs=26 alone would install again.
The hook failed on master's own files while CI's mypy passed, so commits were made with SKIP=mypy. mirrors-mypy ran a different check: mypy 1.9.0 against CI's 2.3.0, with --no-strict-optional, in an isolated env holding only pydantic, pytest and stubs. Each alone fails master: the old mypy gives 7 errors, the flags 1, the env 67, 66 of them missing imports (cwltool, hypothesis and the rest), which --ignore-missing-imports turned into Any, leaving 1. Given only the staged files, that env could not see sophios either, so a test-only commit passing an int to dump_wic_yaml passed. The hook now runs the active environment's `mypy` with no arguments, as CI does, over the paths now named once as `files` in [tool.mypy], on every commit: pre-commit's staged list leaves out deletions, so a filter on it skipped a commit that only deletes a module still imported. A commit needs that environment active; without it the hook fails with "Executable `mypy` not found". Warm, the hook takes about a second on any commit; cold, about nine. The Python files outside `files` (conftest.py, setup.py, docs/conf.py, docs/build_pdf.py, .github/update_sophios_config.py) were checked by the old hook when staged and never by CI; now neither checks them. mypy checks for the platform it runs on, and CI runs it on Linux and macOS only. On Windows typeshed leaves out the Unix signals test_run_local.py sends, so `platform = "linux"` in [tool.mypy] makes a run there check what CI checks. A pull request runs master's workflow on its own head, so once this is on master, an open PR whose pyproject.toml has no `files` fails the MyPy step with mypy's usage error (exit 2) until it is rebased onto master.
…; cancel says whether it cancelled RunHandle.wait(timeout=None) returns the run's RunStatus and raises nothing for a run that FAILED or was CANCELLED; once the run has ended it returns the same status at once. RunHandle.collect(timeout=None) is wait(), then the RunResult of a COMPLETED run, or WorkflowRunError for any other end. Workflow.run() is start().collect(), and run_async() collects after its wait. RunHandle.cancel() returns a bool, as concurrent.futures.Future.cancel() does: True when this call cancelled the run or it was CANCELLED already, False when it had ended COMPLETED or FAILED, which it stays. WorkflowRunError moves from sophios.api.python._errors to sophios.run_status, beside RunResult, so run_local raises it without importing the API above it. sophios.api.python.workflow still exports it. It takes the run status's reason and says it, so a cancelled run's error reads as cancelled, not as a failed step; api005 is a local run that did not complete. BREAKING CHANGE: h.wait() returned a RunResult; it is now h.collect(), and h.wait() returns a RunStatus. h.cancel() returns a bool. WorkflowRunError is a SophiosError and no longer an ApiError, so `except ApiError` no longer catches a failed run.
# Conflicts: # docs/cli-reference.md # src/sophios/api/python/_workflow_runtime.py # src/sophios/main.py
…aves the base path as it found it
darkclad
left a comment
There was a problem hiding this comment.
The merge resolution keeps master's side in all three conflicts and puts the backend's additions on top, and the Nextflow check now matches master's CWL check in run_setup.prepare: it writes into a temporary directory and makes no output-target Directory. One stale sentence is left in the design doc, inline. Note that master has moved on since the merge (the refactor(compute)! series up to 30143e1), so a later sync will be needed.
| @@ -151,7 +151,7 @@ Import (§4.2) is exposed from the concrete `sophios.api.python.nextflow` module | |||
| Sophios runs a generated pipeline through the run mechanism of its CWL runners. The backend registered for the target `nextflow` and the runner `nextflow` answers the four questions every backend answers, and Sophios starts what it launches as one child process on this machine, then streams, stops and reports on it as it does a CWL runner. | |||
|
|
|||
| - **Check.** Each File or Directory input value, as the CWL pre-flight checks it (`wic016`), except an output-target `Directory`, which prepare makes; the `nextflow` program, which must start (`nextflow -version`) and so find a Java it can run; and, when a process has a container, the container engine the generated configuration enables, Docker, checked as the CWL pre-flight checks an engine; which processes have a container it reads from the three files prepare wrote, through the reader (§4.2), as the import does. The program is found as a CWL runner is: for `--generate_run_script` on PATH, where `run.sh` calls it, and otherwise in this Python environment first; on Windows the run is sent to WSL, since Sophios conducts a run on POSIX only. A missing or failing program is `wic029`, an engine that cannot run containers `wic015`, whose message names no option of the CWL target. The pipeline still checks its input values itself when it starts (§6, Inputs and channels). `--check` stops after it, with the artifacts written. | |||
There was a problem hiding this comment.
This bullet still ends with --check stopping "with the artifacts written", which contradicts the Prepare sentence this PR adds just below: a check now writes the four files into a temporary directory and removes it when the check ends. Suggest something like "--check stops after it; the artifacts it read were written into a temporary directory that is now removed (Prepare)."
There was a problem hiding this comment.
Fixed in 5f09590. The bullet now ends: "--check stops after it; the artifacts it read were written into a temporary directory that is now removed (Prepare)." The same bullet also said the check skips an output-target Directory "which prepare makes", but a check now makes none, so that reads "which prepare makes for a run". No other sentence in the design or the docs says a check leaves artifacts behind.
…irectory it removes
|
On master moving on: a test merge of 30143e1 into this head conflicts in |
What
CompiledWorkflow.write()(feat(api): CompiledWorkflow.write() writes the workflow and its job inputs in one call #557), a--checkthat leaves the base path untouched, Node on the 26.x line, home-made actions with no npm packages, and mypy run as CI runs it. In each conflict master's side wins, and the backend's additions sit on top of it:main.py: master's check message, "Nothing was written, pulled or run.", in the backend's_checked, which now names the workflow as master's check does; master's refusal of--checkwith--graphviz, then the backend's--allow_raw_cwlunder--target cwlonly._workflow_runtime.py: master's imports, withoutWorkflowRunError, which the handle'scollect()now raises, plusCompiledNextflowWorkflow.docs/cli-reference.md: master's--checkrow, "nothing is written, pulled or run, so--graphvizis refused", with the backend's Nextflow clauses.start().collect(), as master's run handle has it.--checkwrites into a temporary directory it removes, as master's CWL check does, so it leaves the base path as it found it. Before, it wrote the four files intonextflow_<workflow>/under the base path, after removing any earlier pipeline there. The design states it (§4.4, Prepare),docs/nextflow.mdsays it, and tests hold the base path unmade, an earlier pipeline unchanged by a passing and by a failing check, and the backend'spreparewriting nothing under the base path for a check.Why
The backend branch tracks master, so master's run handle and its check rule are what the backend is built against.
Merge this with a merge commit, as #536, #469 and #434 were: a squash would drop master from the branch's ancestry. Like #536, this PR lists master's commits since the last merge; the backend's are the merge and the four commits on top of it.
The merge commit skips only the mypy pre-commit hook. Master's hook now checks the whole tree as CI does, and it reports the one Nextflow test the next commit moves to master's run handle. Every commit after the merge passes every hook.
Checked locally (macOS, Nextflow 26.04.2 on Java 17)
mypy,lint-imports,autopep8andpylintas Lint And Test runs them: pass.pytest -m "not skip_pypi_ci and not nextflow" -k "not test_cwl_docker_extract": pass, except the twoserialCtrl-C tests intest_run_local.py, which lost their timing beside two other suites run at once and pass run alone (3 of 3).skip_pypi_cigroup,test_entry_points.pyandtest_ci_coverage.py: pass.test_env_var_requirement_values_reach_the_command_byte_for_byte, whoseprintenv GREETING LITERALprints one variable under macOS's BSDprintenv; it fails the same way onfeat/nf-supporthere and passes on the Ubuntu lane.