Skip to content

feat(logic): ingest CWL processes, flat per transformation - #1118

Draft
ryuwd wants to merge 5 commits into
DIRACGrid:mainfrom
ryuwd:cwl-5-ingest
Draft

ryuwd wants to merge 5 commits into
DIRACGrid:mainfrom
ryuwd:cwl-5-ingest

Conversation

@ryuwd

@ryuwd ryuwd commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Closes #1110. Part of #1080.

Blocked by #1116 and #1117, whose commits this branch includes until they merge. Validation is schema-only until #1113.

ryuwd added 5 commits October 23, 2026 16:18
A process is identified by the SHA-256 of a canonical form defined over
the parsed JSON document, not over any CWL library's output, so that it
is deterministic, stable across library upgrades and reproducible by any
tool. Ids, doc and label where they are metadata, $namespaces and dirac:
hints are dropped; prefixes are expanded to full URIs; lists become
maps; fully scoped identifiers are shortened against their scope; type
shorthands are expanded and named types written by short name. Each
child run body is replaced by its own identity, so a workflow's identity
covers its children's (a Merkle tree). pack and unpack convert to and
from a self-contained $graph whose components are named by their
identity.

Documents must be resolved before canonicalisation: $import, $include
and any other schema-salad directive is refused, since the identity
would not cover what it names and a runner would fetch it. Standard
library only.

Closes DIRACGrid#1106
Part of DIRACGrid#1080
Unit tests ran on SQLite only, but production runs on MySQL and MariaDB,
which differ from SQLite where the transformation tables rely on them.
The diracx-db transformation tests now share one fixture that runs each
test on SQLite and on every server given by DIRACX_TEST_MYSQL_URL or
DIRACX_TEST_MARIADB_URL, and a CI job runs them on MySQL 8.4 and
MariaDB 11.4 service containers, pinned by digest.

It found one difference already: a failed CHECK constraint is an
IntegrityError on SQLite but an OperationalError on MySQL and MariaDB
through PyMySQL, so the deltas test now accepts either, matched on the
constraint's name.

Closes DIRACGrid#1108
…onDB

insert_processes stores documents under their content hash with INSERT
IGNORE, so concurrent submissions of a shared process are safe, and
get_processes fetches them, on the DX-ADR-004 Processes table unchanged.

MySQL's JSON type re-sorts keys and reformats numbers, so a stored row is
not the bytes that were hashed: what must hold is that the value read
back re-hashes to its identity, which the round-trip test checks on
SQLite, MySQL and MariaDB.

Closes DIRACGrid#1109
Part of DIRACGrid#1080
check_policy checks every process of a canonical tree against rules
beyond valid CWL, and lists every violation in one error:

- requirements outside an allow-list every backend can honour are
  refused, on a process and on a step, dirac: requirements included;
  hints are not restricted;
- DockerRequirement is accepted, to run with Apptainer, for an image to
  pull (dockerPull, dockerImageId); dockerFile, dockerLoad and
  dockerImport are refused, in hints too, since they build or fetch an
  image on the worker node;
- abstract Operations are refused, since no runner can execute them;
- processes larger than 256 kB are refused.

Closes DIRACGrid#1107
store_process canonicalises a submitted process, checks the policy, and
returns at once if it is already stored. Otherwise it inlines any stored
process it references, packs the tree into one self-contained $graph,
validates every component of it against the CWL v1.2 schema with
cwl-utils and stores it: one Processes row per transformation, keyed by
the Merkle root, so a parcel's payload is a single read (load_process)
and exactly what a stock runner executes.

Validation reads nothing but the packed document: any other file or URL
is refused rather than fetched on the server. Step input wiring is not
checked yet, until a cwl-utils release fixes its static checker
(common-workflow-language/cwl-utils#480).

The MCSimulation fixture is the JSON the DIRACGrid#1080 workgraph resolves to, as
the submission endpoint will receive it.

Closes DIRACGrid#1110
Part of DIRACGrid#1080
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 diracx | 🛠️ Build #35356709 | 📁 Comparing 4fb2019 against latest (833c593)

  🔍 Preview build  

2 files changed
+ dev/explanations/cwl-process-store/index.html
± dev/explanations/components/db/index.html

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.

[Transformation System] Ingest CWL processes, one validated row per transformation

1 participant