Skip to content

Support ad-hoc CWL workflows #997

Open
Nazim-crim wants to merge 8 commits into
masterfrom
ad-hoc-workflow
Open

Support ad-hoc CWL workflows #997
Nazim-crim wants to merge 8 commits into
masterfrom
ad-hoc-workflow

Conversation

@Nazim-crim

@Nazim-crim Nazim-crim commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

https://crim-ca.atlassian.net/browse/NRCAN06-88

  • Add support for ad-hoc CWL workflow execution through the POST /jobs endpoint using multipart/mixed
    or multipart/related content types. Users can now deploy and execute a Process in a single request by
    submitting both the CWL workflow definition (with Content-Profile: http://www.opengis.net/def/ogcapi-processes/2.0/process-description)
    and execution parameters (with Content-Profile: http://www.opengis.net/def/ogcapi-processes/2.0/execute)
    in a multipart request body. The workflow is automatically deployed (with temporary ad-hoc tagging) before
    execution, eliminating the need for separate deployment and execution steps for one-time workflow runs

  • resolves Support ad-hoc CWL workflows #834

@Nazim-crim Nazim-crim self-assigned this Jul 14, 2026
@github-actions github-actions Bot added ci/tests Tests of the package and features ci/doc Issue related to documentation of the package process/wps3 Issue related to WPS 3.x (REST-JSON) processes support feature/job Issues related to job execution, reporting and logging. feature/oas Issues related to OpenAPI specifications. labels Jul 14, 2026
@codecov

codecov Bot commented Jul 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.13043% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 88.44%. Comparing base (874914a) to head (255d92e).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
weaver/processes/utils.py 84.37% 1 Missing and 9 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master     #997   +/-   ##
=======================================
  Coverage   88.44%   88.44%           
=======================================
  Files          88       88           
  Lines       20874    20961   +87     
  Branches     2760     2789   +29     
=======================================
+ Hits        18462    18540   +78     
  Misses       1726     1726           
- Partials      686      695    +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@Nazim-crim
Nazim-crim requested a review from fmigneault July 16, 2026 17:41
@Nazim-crim
Nazim-crim marked this pull request as ready for review July 16, 2026 17:41

@fmigneault fmigneault left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great PR! Thanks for the updates. Some semantic adjustment needed for the process description profile URI that is misused.

Comment thread docs/source/package.rst
Comment on lines +684 to +687
.. _app_pkg_adhoc:

Ad-hoc Workflow Execution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move the section under processes.rst.
I think it would make more sense there in between "Execution KVP-encoded" and "Execution Steps".
For consistency, the title could be "Execution of Ad-hoc Workflow"

Comment thread docs/source/package.rst
Ad-hoc Workflow Execution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

`Weaver` supports *ad-hoc* workflow execution, allowing users to deploy and execute a :term:`CWL` workflow in a single

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add this:

# in references.rst (near corresponding definitions)

.. |ogc-api-proc-part3-cwl-ad-hoc-exec| replace:: :term:`CWL` *ad-hoc* workflow execution
.. _ogc-api-proc-part3-cwl-ad-hoc-exec: https://docs.ogc.org/DRAFTS/21-009.html#section_cwl_workflows

Then, reword as

`Weaver` supports |ogc-api-proc-part3-cwl-ad-hoc-exec|_ from the |ogc-api-proc-part3|_ standard, which allows ...

Comment thread docs/source/package.rst
Comment on lines +696 to +697
1. One or more :term:`CWL` parts (workflow and any dependent tools) with
``Content-Profile: http://www.opengis.net/def/ogcapi-processes/2.0/process-description``

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Content-Profile: http://www.opengis.net/def/ogcapi-processes/2.0/process-description header would apply to cases where additional process metadata is provided (i.e.: #990)

Here, the CWL parts just need to have the relevant application/cwl[+json|yaml].

Therefore, there could optionally be other "Process Description" parts using the indicated Content-Profile.

Consider adding a reference to proc_ogc_api_multi_cwl section by indicating that it follows the same concepts and procedure defined there.

Comment thread docs/source/package.rst

1. One or more :term:`CWL` parts (workflow and any dependent tools) with
``Content-Profile: http://www.opengis.net/def/ogcapi-processes/2.0/process-description``
2. One execution request part with ``Content-Profile: http://www.opengis.net/def/ogcapi-processes/2.0/execute``

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to update the URIs with HTTPS.

Comment thread docs/source/package.rst
Comment on lines +718 to +719
Content-Profile: http://www.opengis.net/def/ogcapi-processes/2.0/process-description

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be removed since that is not the corresponding profile for the CWL part contents.

If the code already supports dealing with multiple application/json of different Content-Profile, you can move this under a separte section like:

--adhoc-boundary
Content-Type: application/json
Content-Profile: http://www.opengis.net/def/ogcapi-processes/2.0/process-description

{
  "id": "adhoc-workflow",
  "description": "Example ad-hoc workflow deployed and executed inline."
}

Comment thread weaver/processes/utils.py
Comment on lines +863 to +864
:param interpreted_parts: ``list`` of interpreted parts (content_type, content_id, content_location, profile, data)
:param root_workflow_cid: Content-ID of root workflow from ``start`` parameter (if any)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code quotes for Content-ID and the tuple

Comment thread weaver/processes/utils.py
Comment on lines +875 to +876
if profile == sd.OGC_API_PROC_PROFILE_EXECUTE_URI:
if execution_request is not None:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Planing ahead, the profile should be a list where matching must be "any of" those URI.

Comment thread weaver/processes/utils.py
isinstance(part_data, dict) and "cwlVersion" in part_data and "$graph" in part_data
):
deployment_parts.append((content_type_part, content_id, content_location, profile, part_data))
# JSON/YAML parts without profile could be execution request (fallback)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for clairity, indicate that the YAML is expecte to have been pre-converted to JSON

Comment thread weaver/processes/utils.py
"title": "Missing CWL packages",
"description": (
"Multipart request must contain at least one CWL package part for ad-hoc workflow execution. "
f"Use Content-Profile: {sd.OGC_API_PROC_PROFILE_PROC_DESC_URI} header "

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to adjust as per other comments
hint toward the CWL media-types instead

Comment thread weaver/processes/utils.py
Comment on lines +937 to +938
for _, content_id, _, _, part_data in deployment_parts:
if isinstance(part_data, dict):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should there be an extra check of application/cwl[+json|+yaml] here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/doc Issue related to documentation of the package ci/tests Tests of the package and features feature/job Issues related to job execution, reporting and logging. feature/oas Issues related to OpenAPI specifications. process/wps3 Issue related to WPS 3.x (REST-JSON) processes support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support ad-hoc CWL workflows

2 participants