Skip to content

Commit 08d6eb8

Browse files
committed
ProcessGenerator: allow for pickling
1 parent 2dce710 commit 08d6eb8

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def _find_package_data(base: str, globs: list[str], root: str = "cwltool") -> li
7474
"cwlprov/__init__.py",
7575
"cuda.py", # for monkeypatch
7676
"run_job.py",
77+
"procgenerator.py", # for ProcessGenerator
7778
"cwlprov/writablebagfile.py", # WritableBag is having issues
7879
"stdfsaccess.py", # StdFsAccess needs to be subclassable
7980
)

tests/test_subclass_mypyc.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@
1313
from cwltool.builder import Builder
1414
from cwltool.command_line_tool import CommandLineTool, ExpressionTool
1515
from cwltool.context import LoadingContext, RuntimeContext
16+
from cwltool.procgenerator import ProcessGenerator
1617
from cwltool.stdfsaccess import StdFsAccess
1718
from cwltool.update import INTERNAL_VERSION
1819
from cwltool.workflow import Workflow
1920

2021
from .test_anon_types import snippet
22+
from .util import get_data
2123

2224

2325
@pytest.mark.parametrize("snippet", snippet)
@@ -52,6 +54,35 @@ def test_pickle_unpickle_workflow(snippet: CommentedMap) -> None:
5254
assert pickle.loads(stream)
5355

5456

57+
def test_pickle_processgenerator() -> None:
58+
"""We can pickle ProcessGenerator."""
59+
60+
pytoolgen = get_data("tests/wf/generator/pytoolgen.cwl")
61+
a = ProcessGenerator(
62+
CommentedMap(
63+
{
64+
"cwlVersion": "v1.0",
65+
"id": f"file://{pytoolgen}",
66+
"$namespaces": {"cwltool": "http://commonwl.org/cwltool#"},
67+
"class": "cwltool:ProcessGenerator",
68+
"inputs": {},
69+
"outputs": {},
70+
"run": {
71+
"id": f"file://{pytoolgen}#f9f617af-3088-4ade-bbf3-acd1d6f51355",
72+
"cwlVersion": "v1.0",
73+
"class": "CommandLineTool",
74+
"inputs": {},
75+
"outputs": {},
76+
"baseCommand": "echo",
77+
},
78+
},
79+
),
80+
LoadingContext(),
81+
)
82+
83+
assert pickle.dumps(a)
84+
85+
5586
def test_serialize_builder() -> None:
5687
"""We can pickle Builder."""
5788
runtime_context = RuntimeContext()

0 commit comments

Comments
 (0)