Skip to content

Commit

Permalink
Migrate CWL parsing from cwltool to cwl-utils
Browse files Browse the repository at this point in the history
This commit replaces the cwltool parser with the faster
auto-generated parser included in cwl-utils.
  • Loading branch information
GlassOfWhiskey committed Feb 1, 2023
1 parent 278bcd9 commit a656498
Show file tree
Hide file tree
Showing 10 changed files with 764 additions and 547 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
- commit: "6397014050177074c9ccd0d771577f7fa9f728a3"
exclude: "docker_entrypoint,stdin_shorcut,inplace_update_on_file_content"
version: "v1.1"
- commit: "ad6f77c648ae9f0eaa2fd53ba7032b0523e12de8"
- commit: "f79146f6b59884ecbe6445ab3cb2b8a374b0ee64"
exclude: "docker_entrypoint,modify_file_content"
version: "v1.2"
steps:
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ asyncssh==2.13.0
bcrypt==4.0.1
cachetools==5.3.0
cwltool==3.1.20230127121939
cwl-utils==0.22
cwl-utils==0.23
importlib_metadata==6.0.0
Jinja2==3.1.2
jsonref==1.1.0
Expand Down
11 changes: 7 additions & 4 deletions streamflow/cwl/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import logging
import os

import cwl_utils.parser
import cwltool.context
import cwltool.load_tool
import cwltool.loghandler
Expand All @@ -12,7 +13,7 @@
from streamflow.config.config import WorkflowConfig
from streamflow.core.context import StreamFlowContext
from streamflow.cwl.translator import CWLTranslator
from streamflow.cwl.utils import load_cwl_inputs, load_cwl_workflow
from streamflow.cwl.utils import load_cwl_inputs
from streamflow.log_handler import logger
from streamflow.workflow.executor import StreamFlowExecutor

Expand Down Expand Up @@ -43,9 +44,12 @@ async def main(
# noinspection PyProtectedMember
cwltool.loghandler._logger.setLevel(logging.WARN)
# Load CWL workflow definition
cwl_definition, loading_context = load_cwl_workflow(cwl_args[0])
cwl_definition = cwl_utils.parser.load_document_by_uri(cwl_args[0])
if len(cwl_args) == 2:
cwl_inputs = load_cwl_inputs(loading_context, cwl_definition, cwl_args[1])
loading_context = cwltool.context.LoadingContext()
cwl_inputs = load_cwl_inputs(
loading_context, cwl_definition.loadingOptions, cwl_args[1]
)
else:
cwl_inputs = {}
# Transpile CWL workflow to the StreamFlow representation
Expand All @@ -58,7 +62,6 @@ async def main(
cwl_definition=cwl_definition,
cwl_inputs=cwl_inputs,
workflow_config=workflow_config,
loading_context=loading_context,
)
if logger.isEnabledFor(logging.INFO):
logger.info("Building workflow execution plan")
Expand Down
Loading

0 comments on commit a656498

Please sign in to comment.