Skip to content

Commit f94719e

Browse files
committed
ProcessGenerator: allow for pickling
1 parent 2f8c9c7 commit f94719e

File tree

4 files changed

+35
-3
lines changed

4 files changed

+35
-3
lines changed

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ requires = [
77
"types-psutil",
88
"importlib_resources>=1.4;python_version<'3.9'",
99
"ruamel.yaml>=0.16.0,<0.19",
10-
"schema-salad>=8.7,<9",
10+
"schema-salad>=8.9,<9",
1111
"cwl-utils>=0.32",
1212
"toml",
1313
"argcomplete>=1.12.0",

requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
requests>=2.6.1
22
ruamel.yaml>=0.16.0,<0.19
33
rdflib>=4.2.2,<7.2
4-
schema-salad>=8.7,<9
4+
schema-salad>=8.9,<9
55
prov==1.5.1
66
mypy-extensions
77
psutil>=5.6.6

setup.py

+2-1
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
)
@@ -150,7 +151,7 @@ def _find_package_data(base: str, globs: list[str], root: str = "cwltool") -> li
150151
# https://github.com/ionrock/cachecontrol/issues/137
151152
"ruamel.yaml >= 0.16, < 0.19",
152153
"rdflib >= 4.2.2, < 7.2.0",
153-
"schema-salad >= 8.7, < 9",
154+
"schema-salad >= 8.9, < 9",
154155
"prov == 1.5.1",
155156
"mypy-extensions",
156157
"psutil >= 5.6.6",

tests/test_subclass_mypyc.py

+31
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)