common-workflow-language / cwl-utils

Python utilities for CWL

Home Page:https://cwl-utils.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Reading a packed workflow returns only the Workflow object

simleo opened this issue · comments

Until version 0.15, reading a packed CWL file returned a list containing all workflows and tools defined there. Starting from 0.16, it only returns a single workflow.

File used in the following snippet: packed.cwl

import json
import pprint
from pathlib import Path
from cwl_utils.parser import load_document_by_yaml


wf_path = Path("packed.cwl")
with open(wf_path, "rt") as f:
    json_wf = json.load(f)
    doc = load_document_by_yaml(json_wf, wf_path.absolute().as_uri())
    pprint.pprint(doc)

0.15 output:

[<cwl_utils.parser.cwl_v1_0.CommandLineTool object at 0x7f41adb699d0>,
 <cwl_utils.parser.cwl_v1_0.Workflow object at 0x7f41adb7b2e0>,
 <cwl_utils.parser.cwl_v1_0.Workflow object at 0x7f41adb69b50>,
 <cwl_utils.parser.cwl_v1_0.CommandLineTool object at 0x7f41adb8e1c0>,
 <cwl_utils.parser.cwl_v1_0.CommandLineTool object at 0x7f41adb7b070>]

0.16 (and later) output:

<cwl_utils.parser.cwl_v1_0.Workflow object at 0x7f463552d9d0>

I git bisected to @GlassOfWhiskey 's commit 9a4f9d1 (but not his fault, as we didn't have a test for this behavior).

@simleo I can add a load_all parameter to load_document_by_yaml to restore the previous functionality. Would that work for you?