streamflow-postgresql 0.0.9__tar.gz → 0.0.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- streamflow_postgresql-0.0.10/MANIFEST.in +2 -0
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/PKG-INFO +5 -18
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/pyproject.toml +31 -12
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/streamflow/plugins/unito/postgresql/database.py +11 -5
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/streamflow/plugins/unito/postgresql/schemas/postgresql.sql +7 -7
- streamflow_postgresql-0.0.10/streamflow/plugins/unito/postgresql/version.py +3 -0
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/streamflow_postgresql.egg-info/PKG-INFO +5 -18
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/streamflow_postgresql.egg-info/SOURCES.txt +0 -4
- streamflow_postgresql-0.0.10/streamflow_postgresql.egg-info/requires.txt +2 -0
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/tests/test_cwl_persistence.py +192 -388
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/tests/test_persistence.py +14 -5
- streamflow_postgresql-0.0.9/MANIFEST.in +0 -6
- streamflow_postgresql-0.0.9/bandit-requirements.txt +0 -1
- streamflow_postgresql-0.0.9/lint-requirements.txt +0 -5
- streamflow_postgresql-0.0.9/requirements.txt +0 -2
- streamflow_postgresql-0.0.9/streamflow/plugins/unito/postgresql/version.py +0 -1
- streamflow_postgresql-0.0.9/streamflow_postgresql.egg-info/requires.txt +0 -18
- streamflow_postgresql-0.0.9/test-requirements.txt +0 -4
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/LICENSE +0 -0
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/README.md +0 -0
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/setup.cfg +0 -0
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/streamflow/plugins/unito/postgresql/__init__.py +0 -0
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/streamflow/plugins/unito/postgresql/plugin.py +0 -0
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/streamflow/plugins/unito/postgresql/schemas/postgresql.json +0 -0
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/streamflow_postgresql.egg-info/dependency_links.txt +0 -0
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/streamflow_postgresql.egg-info/entry_points.txt +0 -0
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/streamflow_postgresql.egg-info/top_level.txt +0 -0
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/streamflow_postgresql.egg-info/zip-safe +0 -0
- {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/tests/test_database.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: streamflow-postgresql
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.10
|
|
4
4
|
Summary: StreamFlow PostgreSQL plugin
|
|
5
5
|
Author-email: Iacopo Colonnelli <iacopo.colonnelli@unito.it>
|
|
6
6
|
License: LGPL-3.0-or-later
|
|
@@ -14,31 +14,18 @@ Classifier: Operating System :: POSIX
|
|
|
14
14
|
Classifier: Operating System :: MacOS
|
|
15
15
|
Classifier: Programming Language :: Python
|
|
16
16
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
22
|
Classifier: Topic :: Scientific/Engineering
|
|
23
23
|
Classifier: Topic :: System :: Distributed Computing
|
|
24
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
25
|
Description-Content-Type: text/markdown
|
|
26
26
|
License-File: LICENSE
|
|
27
|
-
Requires-Dist: asyncpg==0.
|
|
28
|
-
Requires-Dist: streamflow==0.2.0.
|
|
29
|
-
Provides-Extra: bandit
|
|
30
|
-
Requires-Dist: bandit==1.8.6; extra == "bandit"
|
|
31
|
-
Provides-Extra: lint
|
|
32
|
-
Requires-Dist: black==25.9.0; extra == "lint"
|
|
33
|
-
Requires-Dist: codespell==2.4.1; extra == "lint"
|
|
34
|
-
Requires-Dist: flake8-bugbear==24.12.12; extra == "lint"
|
|
35
|
-
Requires-Dist: isort==6.0.1; extra == "lint"
|
|
36
|
-
Requires-Dist: pyupgrade==3.20.0; extra == "lint"
|
|
37
|
-
Provides-Extra: test
|
|
38
|
-
Requires-Dist: pytest==8.4.2; extra == "test"
|
|
39
|
-
Requires-Dist: pytest-asyncio==1.2.0; extra == "test"
|
|
40
|
-
Requires-Dist: pytest-cov==7.0.0; extra == "test"
|
|
41
|
-
Requires-Dist: pytest-xdist==3.8.0; extra == "test"
|
|
27
|
+
Requires-Dist: asyncpg==0.31.0
|
|
28
|
+
Requires-Dist: streamflow==0.2.0.dev14
|
|
42
29
|
Dynamic: license-file
|
|
43
30
|
|
|
44
31
|
# PostgreSQL Plugin for StreamFlow
|
|
@@ -9,7 +9,7 @@ authors = [
|
|
|
9
9
|
]
|
|
10
10
|
description = "StreamFlow PostgreSQL plugin"
|
|
11
11
|
readme = "README.md"
|
|
12
|
-
requires-python = ">=3.
|
|
12
|
+
requires-python = ">=3.10"
|
|
13
13
|
license = {text = "LGPL-3.0-or-later"}
|
|
14
14
|
classifiers = [
|
|
15
15
|
"Development Status :: 3 - Alpha",
|
|
@@ -20,15 +20,19 @@ classifiers = [
|
|
|
20
20
|
"Operating System :: MacOS",
|
|
21
21
|
"Programming Language :: Python",
|
|
22
22
|
"Programming Language :: Python :: 3 :: Only",
|
|
23
|
-
"Programming Language :: Python :: 3.9",
|
|
24
23
|
"Programming Language :: Python :: 3.10",
|
|
25
24
|
"Programming Language :: Python :: 3.11",
|
|
26
25
|
"Programming Language :: Python :: 3.12",
|
|
27
26
|
"Programming Language :: Python :: 3.13",
|
|
27
|
+
"Programming Language :: Python :: 3.14",
|
|
28
28
|
"Topic :: Scientific/Engineering",
|
|
29
29
|
"Topic :: System :: Distributed Computing",
|
|
30
30
|
]
|
|
31
|
-
|
|
31
|
+
dependencies = [
|
|
32
|
+
"asyncpg==0.31.0",
|
|
33
|
+
"streamflow==0.2.0.dev14"
|
|
34
|
+
]
|
|
35
|
+
version = "0.0.10"
|
|
32
36
|
|
|
33
37
|
[project.urls]
|
|
34
38
|
Package = "https://pypi.org/project/streamflow-postgresql"
|
|
@@ -37,6 +41,30 @@ Repository = "https://github.com/alpha-unito/streamflow-postgresql"
|
|
|
37
41
|
[project.entry-points]
|
|
38
42
|
"unito.streamflow.plugin" = {"unito.postgresql" = "streamflow.plugins.unito.postgresql.plugin:PostgreSQLStreamFlowPlugin"}
|
|
39
43
|
|
|
44
|
+
[dependency-groups]
|
|
45
|
+
dev = [
|
|
46
|
+
{include-group = "bandit"},
|
|
47
|
+
{include-group = "lint"},
|
|
48
|
+
{include-group = "test"}
|
|
49
|
+
]
|
|
50
|
+
bandit = [
|
|
51
|
+
"bandit==1.9.3"
|
|
52
|
+
]
|
|
53
|
+
lint = [
|
|
54
|
+
"black==26.1.0",
|
|
55
|
+
"codespell==2.4.1",
|
|
56
|
+
"flake8-bugbear==25.11.29",
|
|
57
|
+
"isort==7.0.0",
|
|
58
|
+
"pyupgrade==3.21.2"
|
|
59
|
+
]
|
|
60
|
+
test = [
|
|
61
|
+
"cwltest==2.6.20251216093331",
|
|
62
|
+
"pytest==9.0.2",
|
|
63
|
+
"pytest-asyncio==1.3.0",
|
|
64
|
+
"pytest-cov==7.0.0",
|
|
65
|
+
"pytest-xdist==3.8.0"
|
|
66
|
+
]
|
|
67
|
+
|
|
40
68
|
[tool.setuptools]
|
|
41
69
|
packages = [
|
|
42
70
|
"streamflow.plugins.unito.postgresql"
|
|
@@ -46,14 +74,5 @@ zip-safe = true
|
|
|
46
74
|
[tool.setuptools.package-data]
|
|
47
75
|
"streamflow.plugins.unito.postgresql" = ["schemas/*.json", "schemas/*.sql"]
|
|
48
76
|
|
|
49
|
-
[tool.setuptools.dynamic]
|
|
50
|
-
dependencies = {file = "requirements.txt"}
|
|
51
|
-
version = {attr = "streamflow.plugins.unito.postgresql.version.VERSION"}
|
|
52
|
-
|
|
53
|
-
[tool.setuptools.dynamic.optional-dependencies]
|
|
54
|
-
bandit = {file = "bandit-requirements.txt"}
|
|
55
|
-
lint = {file = "lint-requirements.txt"}
|
|
56
|
-
test = {file = "test-requirements.txt"}
|
|
57
|
-
|
|
58
77
|
[tool.isort]
|
|
59
78
|
profile = "black"
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
import hashlib
|
|
3
4
|
import json
|
|
4
5
|
from collections.abc import MutableMapping, MutableSequence
|
|
5
6
|
from importlib.resources import files
|
|
@@ -54,12 +55,17 @@ class PostgreSQLConnectionPool:
|
|
|
54
55
|
)
|
|
55
56
|
async with self._pool.acquire() as conn:
|
|
56
57
|
async with conn.transaction():
|
|
57
|
-
|
|
58
|
+
schema = (
|
|
58
59
|
files(__package__)
|
|
59
60
|
.joinpath("schemas")
|
|
60
61
|
.joinpath("postgresql.sql")
|
|
61
62
|
.read_text("utf-8")
|
|
62
63
|
)
|
|
64
|
+
schema_checksum = hashlib.new("sha1", usedforsecurity=False)
|
|
65
|
+
schema_checksum.update(schema.encode("utf-8"))
|
|
66
|
+
lock_key = int(schema_checksum.hexdigest(), 16) % (2**63 - 1)
|
|
67
|
+
await conn.execute(f"SELECT pg_advisory_xact_lock({lock_key})")
|
|
68
|
+
await conn.execute(schema)
|
|
63
69
|
return self._pool
|
|
64
70
|
|
|
65
71
|
async def __aexit__(self, exc_type, exc_val, exc_tb):
|
|
@@ -148,17 +154,17 @@ class PostgreSQLDatabase(CachedDatabase):
|
|
|
148
154
|
json.dumps(wraps) if wraps else None,
|
|
149
155
|
)
|
|
150
156
|
|
|
151
|
-
async def add_execution(self, step_id: int,
|
|
157
|
+
async def add_execution(self, step_id: int, job_token_id: int, cmd: str) -> int:
|
|
152
158
|
async with self.pool as pool:
|
|
153
159
|
async with pool.acquire() as conn:
|
|
154
160
|
async with conn.transaction():
|
|
155
161
|
return await conn.fetchval(
|
|
156
|
-
"INSERT INTO execution(step,
|
|
162
|
+
"INSERT INTO execution(step, job_token, cmd) "
|
|
157
163
|
"VALUES($1, $2, $3) "
|
|
158
164
|
"RETURNING id",
|
|
159
165
|
step_id,
|
|
160
|
-
|
|
161
|
-
cmd
|
|
166
|
+
job_token_id,
|
|
167
|
+
cmd,
|
|
162
168
|
)
|
|
163
169
|
|
|
164
170
|
async def add_filter(
|
|
@@ -69,6 +69,13 @@ CREATE TABLE IF NOT EXISTS token
|
|
|
69
69
|
);
|
|
70
70
|
|
|
71
71
|
|
|
72
|
+
CREATE TABLE IF NOT EXISTS recoverable
|
|
73
|
+
(
|
|
74
|
+
id SERIAL PRIMARY KEY,
|
|
75
|
+
FOREIGN KEY (id) REFERENCES token (id)
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
|
|
72
79
|
CREATE TABLE IF NOT EXISTS provenance
|
|
73
80
|
(
|
|
74
81
|
dependee INTEGER,
|
|
@@ -106,13 +113,6 @@ CREATE TABLE IF NOT EXISTS target
|
|
|
106
113
|
);
|
|
107
114
|
|
|
108
115
|
|
|
109
|
-
CREATE TABLE IF NOT EXISTS recoverable
|
|
110
|
-
(
|
|
111
|
-
id SERIAL PRIMARY KEY,
|
|
112
|
-
FOREIGN KEY (id) REFERENCES token (id)
|
|
113
|
-
);
|
|
114
|
-
|
|
115
|
-
|
|
116
116
|
CREATE TABLE IF NOT EXISTS filter
|
|
117
117
|
(
|
|
118
118
|
id SERIAL PRIMARY KEY,
|
{streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/streamflow_postgresql.egg-info/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: streamflow-postgresql
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.10
|
|
4
4
|
Summary: StreamFlow PostgreSQL plugin
|
|
5
5
|
Author-email: Iacopo Colonnelli <iacopo.colonnelli@unito.it>
|
|
6
6
|
License: LGPL-3.0-or-later
|
|
@@ -14,31 +14,18 @@ Classifier: Operating System :: POSIX
|
|
|
14
14
|
Classifier: Operating System :: MacOS
|
|
15
15
|
Classifier: Programming Language :: Python
|
|
16
16
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
22
|
Classifier: Topic :: Scientific/Engineering
|
|
23
23
|
Classifier: Topic :: System :: Distributed Computing
|
|
24
|
-
Requires-Python: >=3.
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
25
|
Description-Content-Type: text/markdown
|
|
26
26
|
License-File: LICENSE
|
|
27
|
-
Requires-Dist: asyncpg==0.
|
|
28
|
-
Requires-Dist: streamflow==0.2.0.
|
|
29
|
-
Provides-Extra: bandit
|
|
30
|
-
Requires-Dist: bandit==1.8.6; extra == "bandit"
|
|
31
|
-
Provides-Extra: lint
|
|
32
|
-
Requires-Dist: black==25.9.0; extra == "lint"
|
|
33
|
-
Requires-Dist: codespell==2.4.1; extra == "lint"
|
|
34
|
-
Requires-Dist: flake8-bugbear==24.12.12; extra == "lint"
|
|
35
|
-
Requires-Dist: isort==6.0.1; extra == "lint"
|
|
36
|
-
Requires-Dist: pyupgrade==3.20.0; extra == "lint"
|
|
37
|
-
Provides-Extra: test
|
|
38
|
-
Requires-Dist: pytest==8.4.2; extra == "test"
|
|
39
|
-
Requires-Dist: pytest-asyncio==1.2.0; extra == "test"
|
|
40
|
-
Requires-Dist: pytest-cov==7.0.0; extra == "test"
|
|
41
|
-
Requires-Dist: pytest-xdist==3.8.0; extra == "test"
|
|
27
|
+
Requires-Dist: asyncpg==0.31.0
|
|
28
|
+
Requires-Dist: streamflow==0.2.0.dev14
|
|
42
29
|
Dynamic: license-file
|
|
43
30
|
|
|
44
31
|
# PostgreSQL Plugin for StreamFlow
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
LICENSE
|
|
2
2
|
MANIFEST.in
|
|
3
3
|
README.md
|
|
4
|
-
bandit-requirements.txt
|
|
5
|
-
lint-requirements.txt
|
|
6
4
|
pyproject.toml
|
|
7
|
-
requirements.txt
|
|
8
|
-
test-requirements.txt
|
|
9
5
|
streamflow/plugins/unito/postgresql/__init__.py
|
|
10
6
|
streamflow/plugins/unito/postgresql/database.py
|
|
11
7
|
streamflow/plugins/unito/postgresql/plugin.py
|
|
@@ -11,7 +11,16 @@ from streamflow.core import utils
|
|
|
11
11
|
from streamflow.core.config import BindingConfig
|
|
12
12
|
from streamflow.core.context import StreamFlowContext
|
|
13
13
|
from streamflow.core.deployment import FilterConfig, LocalTarget
|
|
14
|
-
from streamflow.core.
|
|
14
|
+
from streamflow.core.processor import (
|
|
15
|
+
CommandOutputProcessor,
|
|
16
|
+
MapTokenProcessor,
|
|
17
|
+
NullTokenProcessor,
|
|
18
|
+
ObjectTokenProcessor,
|
|
19
|
+
PopCommandOutputProcessor,
|
|
20
|
+
UnionCommandOutputProcessor,
|
|
21
|
+
UnionTokenProcessor,
|
|
22
|
+
)
|
|
23
|
+
from streamflow.core.workflow import CommandTokenProcessor, Step
|
|
15
24
|
from streamflow.cwl.combinator import ListMergeCombinator
|
|
16
25
|
from streamflow.cwl.command import (
|
|
17
26
|
CWLCommand,
|
|
@@ -23,14 +32,10 @@ from streamflow.cwl.command import (
|
|
|
23
32
|
from streamflow.cwl.hardware import CWLHardwareRequirement
|
|
24
33
|
from streamflow.cwl.processor import (
|
|
25
34
|
CWLCommandOutputProcessor,
|
|
35
|
+
CWLExpressionToolOutputProcessor,
|
|
26
36
|
CWLFileToken,
|
|
27
|
-
CWLMapCommandOutputProcessor,
|
|
28
|
-
CWLMapTokenProcessor,
|
|
29
37
|
CWLObjectCommandOutputProcessor,
|
|
30
|
-
CWLObjectTokenProcessor,
|
|
31
38
|
CWLTokenProcessor,
|
|
32
|
-
CWLUnionCommandOutputProcessor,
|
|
33
|
-
CWLUnionTokenProcessor,
|
|
34
39
|
)
|
|
35
40
|
from streamflow.cwl.step import (
|
|
36
41
|
CWLConditionalStep,
|
|
@@ -70,12 +75,11 @@ from tests.utils.workflow import CWL_VERSION, create_workflow
|
|
|
70
75
|
def _create_cwl_command(
|
|
71
76
|
step: Step, processors: MutableSequence[CommandTokenProcessor] | None = None
|
|
72
77
|
) -> CWLCommand:
|
|
73
|
-
processors = processors or []
|
|
74
78
|
return get_full_instantiation(
|
|
75
79
|
cls_=CWLCommand,
|
|
76
80
|
step=step,
|
|
77
81
|
absolute_initial_workdir_allowed=True,
|
|
78
|
-
processors=processors,
|
|
82
|
+
processors=processors or [],
|
|
79
83
|
base_command=["command", "tool"],
|
|
80
84
|
expression_lib=["Requirement"],
|
|
81
85
|
environment={"ARCH": "$(inputs.arch)", "PYTHONPATH": "$(inputs.pythonpath)"},
|
|
@@ -121,14 +125,15 @@ def _create_cwl_command_output_processor(
|
|
|
121
125
|
|
|
122
126
|
|
|
123
127
|
def _create_cwl_command_token_processor(
|
|
124
|
-
|
|
125
|
-
):
|
|
126
|
-
processor = processor or CWLCommandTokenProcessor("test1", "test2")
|
|
128
|
+
expression: Any | None = None,
|
|
129
|
+
) -> CWLCommandTokenProcessor:
|
|
127
130
|
return get_full_instantiation(
|
|
128
131
|
cls_=CWLCommandTokenProcessor,
|
|
129
132
|
name="test",
|
|
130
133
|
expression=expression,
|
|
131
|
-
processor=
|
|
134
|
+
processor=CWLCommandTokenProcessor(
|
|
135
|
+
"test1", "test2"
|
|
136
|
+
), # no full instantiation required
|
|
132
137
|
token_type="string",
|
|
133
138
|
is_shell_command=True,
|
|
134
139
|
item_separator="&",
|
|
@@ -142,10 +147,9 @@ def _create_cwl_command_token_processor(
|
|
|
142
147
|
def _create_cwl_token_processor(name: str, workflow: CWLWorkflow) -> CWLTokenProcessor:
|
|
143
148
|
return get_full_instantiation(
|
|
144
149
|
cls_=CWLTokenProcessor,
|
|
145
|
-
name=
|
|
150
|
+
name=name,
|
|
146
151
|
workflow=workflow,
|
|
147
152
|
token_type="enum",
|
|
148
|
-
check_type=False,
|
|
149
153
|
enum_symbols=["path1", "path2"],
|
|
150
154
|
expression_lib=["expr_lib1", "expr_lib2"],
|
|
151
155
|
file_format="directory",
|
|
@@ -153,7 +157,6 @@ def _create_cwl_token_processor(name: str, workflow: CWLWorkflow) -> CWLTokenPro
|
|
|
153
157
|
load_contents=True,
|
|
154
158
|
load_listing=LoadListing.no_listing,
|
|
155
159
|
only_propagate_secondary_files=False,
|
|
156
|
-
optional=True,
|
|
157
160
|
secondary_files=[
|
|
158
161
|
get_full_instantiation(cls_=SecondaryFile, pattern="file1", required=True)
|
|
159
162
|
],
|
|
@@ -203,17 +206,68 @@ async def test_cwl_file_token(context: StreamFlowContext):
|
|
|
203
206
|
|
|
204
207
|
|
|
205
208
|
@pytest.mark.asyncio
|
|
206
|
-
|
|
207
|
-
|
|
209
|
+
@pytest.mark.parametrize("processor_t", ["none", "primitive", "map", "object", "union"])
|
|
210
|
+
async def test_cwl_command(context: StreamFlowContext, processor_t: str):
|
|
211
|
+
"""Test saving and loading ExecuteStep with CWLCommand and CWLCommandTokenProcessor classes from database"""
|
|
208
212
|
workflow = CWLWorkflow(
|
|
209
213
|
context=context, name=utils.random_name(), config={}, cwl_version=CWL_VERSION
|
|
210
214
|
)
|
|
211
215
|
job_port = workflow.create_port(JobPort)
|
|
212
216
|
await workflow.save(context)
|
|
217
|
+
match processor_t:
|
|
218
|
+
case "none":
|
|
219
|
+
processors = None
|
|
220
|
+
case "primitive":
|
|
221
|
+
processors = [
|
|
222
|
+
_create_cwl_command_token_processor(
|
|
223
|
+
expression=DoubleQuotedScalarString("60")
|
|
224
|
+
),
|
|
225
|
+
_create_cwl_command_token_processor(
|
|
226
|
+
expression=LiteralScalarString("${ return 10 + 20 - (5 * 4) }")
|
|
227
|
+
),
|
|
228
|
+
]
|
|
229
|
+
case "map":
|
|
230
|
+
processors = [
|
|
231
|
+
get_full_instantiation(
|
|
232
|
+
cls_=CWLMapCommandTokenProcessor,
|
|
233
|
+
name="test1",
|
|
234
|
+
processor=_create_cwl_command_token_processor(expression="z"),
|
|
235
|
+
),
|
|
236
|
+
get_full_instantiation(
|
|
237
|
+
cls_=CWLMapCommandTokenProcessor,
|
|
238
|
+
name="test2",
|
|
239
|
+
processor=_create_cwl_command_token_processor(expression="xy"),
|
|
240
|
+
),
|
|
241
|
+
]
|
|
242
|
+
case "object":
|
|
243
|
+
processors = [
|
|
244
|
+
get_full_instantiation(
|
|
245
|
+
cls_=CWLObjectCommandTokenProcessor,
|
|
246
|
+
name="test",
|
|
247
|
+
processors={
|
|
248
|
+
"a": _create_cwl_command_token_processor(expression=10),
|
|
249
|
+
"b": _create_cwl_command_token_processor(expression=234),
|
|
250
|
+
},
|
|
251
|
+
)
|
|
252
|
+
]
|
|
253
|
+
case "union":
|
|
254
|
+
processors = [
|
|
255
|
+
get_full_instantiation(
|
|
256
|
+
cls_=UnionCommandTokenProcessor,
|
|
257
|
+
name="test",
|
|
258
|
+
processors=[
|
|
259
|
+
_create_cwl_command_token_processor(expression="qwerty"),
|
|
260
|
+
_create_cwl_command_token_processor(expression=987),
|
|
261
|
+
_create_cwl_command_token_processor(expression="qaz"),
|
|
262
|
+
],
|
|
263
|
+
)
|
|
264
|
+
]
|
|
265
|
+
case _:
|
|
266
|
+
raise Exception(f"Unknown processor type: {processor_t}")
|
|
213
267
|
step = workflow.create_step(
|
|
214
268
|
cls=ExecuteStep, name=utils.random_name(), job_port=job_port
|
|
215
269
|
)
|
|
216
|
-
step.command = _create_cwl_command(step)
|
|
270
|
+
step.command = _create_cwl_command(step=step, processors=processors)
|
|
217
271
|
await save_load_and_test(step, context)
|
|
218
272
|
|
|
219
273
|
|
|
@@ -242,59 +296,10 @@ async def test_cwl_expression_command(context: StreamFlowContext):
|
|
|
242
296
|
await save_load_and_test(step, context)
|
|
243
297
|
|
|
244
298
|
|
|
245
|
-
@pytest.mark.asyncio
|
|
246
|
-
async def test_cwl_command_token_processor(context: StreamFlowContext):
|
|
247
|
-
"""Test saving and loading CWLCommand with CWLCommandTokens from database"""
|
|
248
|
-
workflow = CWLWorkflow(
|
|
249
|
-
context=context, name=utils.random_name(), config={}, cwl_version=CWL_VERSION
|
|
250
|
-
)
|
|
251
|
-
job_port = workflow.create_port(JobPort)
|
|
252
|
-
await workflow.save(context)
|
|
253
|
-
step = workflow.create_step(
|
|
254
|
-
cls=ExecuteStep, name=utils.random_name(), job_port=job_port
|
|
255
|
-
)
|
|
256
|
-
step.command = _create_cwl_command(
|
|
257
|
-
step,
|
|
258
|
-
[
|
|
259
|
-
_create_cwl_command_token_processor(
|
|
260
|
-
expression=DoubleQuotedScalarString("60")
|
|
261
|
-
),
|
|
262
|
-
_create_cwl_command_token_processor(
|
|
263
|
-
expression=LiteralScalarString("${ return 10 + 20 - (5 * 4) }")
|
|
264
|
-
),
|
|
265
|
-
],
|
|
266
|
-
)
|
|
267
|
-
await save_load_and_test(step, context)
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
@pytest.mark.asyncio
|
|
271
|
-
async def test_cwl_command_token_processors_nested(context: StreamFlowContext):
|
|
272
|
-
"""Test saving and loading CWLCommand with nested CWLCommandTokenProcessors from database"""
|
|
273
|
-
workflow = CWLWorkflow(
|
|
274
|
-
context=context, name=utils.random_name(), config={}, cwl_version=CWL_VERSION
|
|
275
|
-
)
|
|
276
|
-
job_port = workflow.create_port(JobPort)
|
|
277
|
-
await workflow.save(context)
|
|
278
|
-
step = workflow.create_step(
|
|
279
|
-
cls=ExecuteStep, name=utils.random_name(), job_port=job_port
|
|
280
|
-
)
|
|
281
|
-
step.command = _create_cwl_command(
|
|
282
|
-
step,
|
|
283
|
-
[
|
|
284
|
-
_create_cwl_command_token_processor(
|
|
285
|
-
processor=_create_cwl_command_token_processor(expression=1123)
|
|
286
|
-
),
|
|
287
|
-
_create_cwl_command_token_processor(
|
|
288
|
-
processor=_create_cwl_command_token_processor(expression="hello")
|
|
289
|
-
),
|
|
290
|
-
],
|
|
291
|
-
)
|
|
292
|
-
await save_load_and_test(step, context)
|
|
293
|
-
|
|
294
|
-
|
|
295
299
|
@pytest.mark.asyncio
|
|
296
300
|
@pytest.mark.parametrize(
|
|
297
|
-
"output_type",
|
|
301
|
+
"output_type",
|
|
302
|
+
["no_output", "default", "expression", "primitive", "object", "union"],
|
|
298
303
|
)
|
|
299
304
|
async def test_cwl_execute_step(context: StreamFlowContext, output_type: str):
|
|
300
305
|
"""Test saving and loading CWLExecuteStep from database"""
|
|
@@ -318,223 +323,64 @@ async def test_cwl_execute_step(context: StreamFlowContext, output_type: str):
|
|
|
318
323
|
workflow.steps[step.name] = step
|
|
319
324
|
|
|
320
325
|
if output_type != "no_output":
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
326
|
+
match output_type:
|
|
327
|
+
case "default":
|
|
328
|
+
processor = None
|
|
329
|
+
case "expression":
|
|
330
|
+
processor = get_full_instantiation(
|
|
331
|
+
cls_=CWLExpressionToolOutputProcessor,
|
|
332
|
+
name=utils.random_name(),
|
|
333
|
+
workflow=workflow,
|
|
334
|
+
target=get_full_instantiation(cls_=LocalTarget, workdir="/home"),
|
|
335
|
+
token_type=["string"],
|
|
336
|
+
enum_symbols=["test"],
|
|
337
|
+
file_format="file",
|
|
338
|
+
optional=True,
|
|
339
|
+
streamable=True,
|
|
340
|
+
)
|
|
341
|
+
case "primitive":
|
|
342
|
+
processor = _create_cwl_command_output_processor(
|
|
333
343
|
name=utils.random_name(), workflow=workflow
|
|
334
|
-
),
|
|
335
|
-
target=LocalTarget(workdir="/home"),
|
|
336
|
-
)
|
|
337
|
-
elif output_type == "object":
|
|
338
|
-
processor = get_full_instantiation(
|
|
339
|
-
cls_=CWLObjectCommandOutputProcessor,
|
|
340
|
-
name=utils.random_name(),
|
|
341
|
-
workflow=workflow,
|
|
342
|
-
processors={
|
|
343
|
-
"attr_a": _create_cwl_command_output_processor(
|
|
344
|
-
name=utils.random_name(), workflow=workflow
|
|
345
|
-
),
|
|
346
|
-
},
|
|
347
|
-
expression_lib=["a", "b"],
|
|
348
|
-
full_js=True,
|
|
349
|
-
output_eval="$(1 == 1)",
|
|
350
|
-
target=LocalTarget("/shared"),
|
|
351
|
-
)
|
|
352
|
-
elif output_type == "union":
|
|
353
|
-
processor = get_full_instantiation(
|
|
354
|
-
cls_=CWLUnionCommandOutputProcessor,
|
|
355
|
-
name=utils.random_name(),
|
|
356
|
-
workflow=workflow,
|
|
357
|
-
processors=[
|
|
358
|
-
_create_cwl_command_output_processor(
|
|
359
|
-
name=utils.random_name(), workflow=workflow
|
|
360
|
-
),
|
|
361
|
-
],
|
|
362
|
-
)
|
|
363
|
-
else:
|
|
364
|
-
raise Exception(f"Unknown output type: {output_type}")
|
|
365
|
-
step.add_output_port("my_output", port, processor)
|
|
366
|
-
await save_load_and_test(step, context)
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
@pytest.mark.asyncio
|
|
370
|
-
async def test_cwl_object_command_token_processor(context: StreamFlowContext):
|
|
371
|
-
"""Test saving and loading CWLCommand with CWLObjectCommandProcessors from database"""
|
|
372
|
-
workflow = CWLWorkflow(
|
|
373
|
-
context=context, name=utils.random_name(), config={}, cwl_version=CWL_VERSION
|
|
374
|
-
)
|
|
375
|
-
job_port = workflow.create_port(JobPort)
|
|
376
|
-
await workflow.save(context)
|
|
377
|
-
step = workflow.create_step(
|
|
378
|
-
cls=ExecuteStep, name=utils.random_name(), job_port=job_port
|
|
379
|
-
)
|
|
380
|
-
step.command = _create_cwl_command(
|
|
381
|
-
step,
|
|
382
|
-
[
|
|
383
|
-
get_full_instantiation(
|
|
384
|
-
cls_=CWLObjectCommandTokenProcessor,
|
|
385
|
-
name="test",
|
|
386
|
-
processors={
|
|
387
|
-
"a": _create_cwl_command_token_processor(expression=10),
|
|
388
|
-
"b": _create_cwl_command_token_processor(expression=234),
|
|
389
|
-
},
|
|
390
|
-
)
|
|
391
|
-
],
|
|
392
|
-
)
|
|
393
|
-
await save_load_and_test(step, context)
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
@pytest.mark.asyncio
|
|
397
|
-
async def test_cwl_object_command_token_processors_nested(context: StreamFlowContext):
|
|
398
|
-
"""Test saving and loading CWLCommandToken with nested CWLObjectCommandTokenProcessors from database"""
|
|
399
|
-
workflow = CWLWorkflow(
|
|
400
|
-
context=context, name=utils.random_name(), config={}, cwl_version=CWL_VERSION
|
|
401
|
-
)
|
|
402
|
-
job_port = workflow.create_port(JobPort)
|
|
403
|
-
await workflow.save(context)
|
|
404
|
-
step = workflow.create_step(
|
|
405
|
-
cls=ExecuteStep, name=utils.random_name(), job_port=job_port
|
|
406
|
-
)
|
|
407
|
-
|
|
408
|
-
processors = [
|
|
409
|
-
get_full_instantiation(
|
|
410
|
-
cls_=CWLObjectCommandTokenProcessor,
|
|
411
|
-
name="test",
|
|
412
|
-
processors={
|
|
413
|
-
"zero": get_full_instantiation(
|
|
414
|
-
cls_=CWLObjectCommandTokenProcessor,
|
|
415
|
-
name="test",
|
|
416
|
-
processors={
|
|
417
|
-
"type": _create_cwl_command_token_processor(expression="File"),
|
|
418
|
-
"params": _create_cwl_command_token_processor(expression=None),
|
|
419
|
-
},
|
|
420
344
|
)
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
processors={
|
|
427
|
-
"zero": CWLObjectCommandTokenProcessor(
|
|
428
|
-
name="test",
|
|
345
|
+
case "object":
|
|
346
|
+
processor = get_full_instantiation(
|
|
347
|
+
cls_=CWLObjectCommandOutputProcessor,
|
|
348
|
+
name=utils.random_name(),
|
|
349
|
+
workflow=workflow,
|
|
429
350
|
processors={
|
|
430
|
-
"
|
|
431
|
-
|
|
432
|
-
|
|
351
|
+
"attr_a": _create_cwl_command_output_processor(
|
|
352
|
+
name=utils.random_name(), workflow=workflow
|
|
353
|
+
),
|
|
433
354
|
},
|
|
355
|
+
expression_lib=["a", "b"],
|
|
356
|
+
full_js=True,
|
|
357
|
+
output_eval="$(1 == 1)",
|
|
358
|
+
target=LocalTarget("/shared"),
|
|
359
|
+
single=True,
|
|
434
360
|
)
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
cls_=UnionCommandTokenProcessor,
|
|
459
|
-
name="test",
|
|
460
|
-
processors=[
|
|
461
|
-
_create_cwl_command_token_processor(expression="qwerty"),
|
|
462
|
-
_create_cwl_command_token_processor(expression=987),
|
|
463
|
-
_create_cwl_command_token_processor(expression="qaz"),
|
|
464
|
-
],
|
|
465
|
-
)
|
|
466
|
-
],
|
|
467
|
-
)
|
|
468
|
-
await save_load_and_test(step, context)
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
@pytest.mark.asyncio
|
|
472
|
-
async def test_cwl_union_command_token_processor_nested(context: StreamFlowContext):
|
|
473
|
-
"""Test saving and loading CWLCommand with nested CWLUnionCommandProcessors from database"""
|
|
474
|
-
workflow = CWLWorkflow(
|
|
475
|
-
context=context, name=utils.random_name(), config={}, cwl_version=CWL_VERSION
|
|
476
|
-
)
|
|
477
|
-
job_port = workflow.create_port(JobPort)
|
|
478
|
-
await workflow.save(context)
|
|
479
|
-
step = workflow.create_step(
|
|
480
|
-
cls=ExecuteStep, name=utils.random_name(), job_port=job_port
|
|
481
|
-
)
|
|
482
|
-
step.command = _create_cwl_command(
|
|
483
|
-
step,
|
|
484
|
-
[
|
|
485
|
-
get_full_instantiation(
|
|
486
|
-
cls_=UnionCommandTokenProcessor,
|
|
487
|
-
name="test",
|
|
488
|
-
processors=[
|
|
489
|
-
get_full_instantiation(
|
|
490
|
-
cls_=UnionCommandTokenProcessor,
|
|
491
|
-
name="test",
|
|
492
|
-
processors=[
|
|
493
|
-
_create_cwl_command_token_processor(expression="aaa"),
|
|
494
|
-
_create_cwl_command_token_processor(expression="bbb"),
|
|
495
|
-
],
|
|
496
|
-
),
|
|
497
|
-
get_full_instantiation(
|
|
498
|
-
cls_=UnionCommandTokenProcessor,
|
|
499
|
-
name="test",
|
|
500
|
-
processors=[
|
|
501
|
-
_create_cwl_command_token_processor(expression="ccc"),
|
|
502
|
-
_create_cwl_command_token_processor(expression="ddd"),
|
|
503
|
-
],
|
|
504
|
-
),
|
|
505
|
-
],
|
|
506
|
-
)
|
|
507
|
-
],
|
|
508
|
-
)
|
|
509
|
-
await save_load_and_test(step, context)
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
@pytest.mark.asyncio
|
|
513
|
-
async def test_cwl_map_command_token_processor(context: StreamFlowContext):
|
|
514
|
-
"""Test saving and loading CWLCommand with CWLMapCommandTokenProcessor from database"""
|
|
515
|
-
workflow = CWLWorkflow(
|
|
516
|
-
context=context, name=utils.random_name(), config={}, cwl_version=CWL_VERSION
|
|
517
|
-
)
|
|
518
|
-
job_port = workflow.create_port(JobPort)
|
|
519
|
-
await workflow.save(context)
|
|
520
|
-
step = workflow.create_step(
|
|
521
|
-
cls=ExecuteStep, name=utils.random_name(), job_port=job_port
|
|
522
|
-
)
|
|
523
|
-
step.command = _create_cwl_command(
|
|
524
|
-
step,
|
|
525
|
-
[
|
|
526
|
-
get_full_instantiation(
|
|
527
|
-
cls_=CWLMapCommandTokenProcessor,
|
|
528
|
-
name="test",
|
|
529
|
-
processor=_create_cwl_command_token_processor(expression="z"),
|
|
530
|
-
),
|
|
531
|
-
get_full_instantiation(
|
|
532
|
-
cls_=CWLMapCommandTokenProcessor,
|
|
533
|
-
name="test",
|
|
534
|
-
processor=_create_cwl_command_token_processor(expression="xy"),
|
|
535
|
-
),
|
|
536
|
-
],
|
|
537
|
-
)
|
|
361
|
+
case "union":
|
|
362
|
+
inner_p = _create_cwl_command_output_processor(
|
|
363
|
+
name=utils.random_name(), workflow=workflow
|
|
364
|
+
)
|
|
365
|
+
processor = get_full_instantiation(
|
|
366
|
+
cls_=UnionCommandOutputProcessor,
|
|
367
|
+
name=utils.random_name(),
|
|
368
|
+
workflow=workflow,
|
|
369
|
+
processors=[
|
|
370
|
+
get_full_instantiation(
|
|
371
|
+
cls_=PopCommandOutputProcessor,
|
|
372
|
+
name=utils.random_name(),
|
|
373
|
+
workflow=workflow,
|
|
374
|
+
processor=inner_p,
|
|
375
|
+
target=LocalTarget("/shared"),
|
|
376
|
+
),
|
|
377
|
+
inner_p,
|
|
378
|
+
],
|
|
379
|
+
target=LocalTarget("/shared"),
|
|
380
|
+
)
|
|
381
|
+
case _:
|
|
382
|
+
raise Exception(f"Unknown output type: {output_type}")
|
|
383
|
+
step.add_output_port("my_output", port, processor)
|
|
538
384
|
await save_load_and_test(step, context)
|
|
539
385
|
|
|
540
386
|
|
|
@@ -578,7 +424,7 @@ async def test_default_transformer(context: StreamFlowContext):
|
|
|
578
424
|
workflow, (port,) = await create_workflow(context=context, num_port=1)
|
|
579
425
|
step = get_full_instantiation(
|
|
580
426
|
cls_=DefaultTransformer,
|
|
581
|
-
name=utils.random_name()
|
|
427
|
+
name=f"{utils.random_name()}-transformer",
|
|
582
428
|
default_port=port,
|
|
583
429
|
workflow=workflow,
|
|
584
430
|
)
|
|
@@ -592,7 +438,7 @@ async def test_default_retag_transformer(context: StreamFlowContext):
|
|
|
592
438
|
workflow, (port,) = await create_workflow(context=context, num_port=1)
|
|
593
439
|
step = get_full_instantiation(
|
|
594
440
|
cls_=DefaultRetagTransformer,
|
|
595
|
-
name=utils.random_name()
|
|
441
|
+
name=f"{utils.random_name()}-transformer",
|
|
596
442
|
default_port=port,
|
|
597
443
|
primary_port="prime",
|
|
598
444
|
workflow=workflow,
|
|
@@ -602,8 +448,11 @@ async def test_default_retag_transformer(context: StreamFlowContext):
|
|
|
602
448
|
|
|
603
449
|
|
|
604
450
|
@pytest.mark.asyncio
|
|
605
|
-
|
|
606
|
-
"""
|
|
451
|
+
@pytest.mark.parametrize(
|
|
452
|
+
"processor_t", ["primitive", "map", "object", "union", "optional"]
|
|
453
|
+
)
|
|
454
|
+
async def test_cwl_token_transformer(context: StreamFlowContext, processor_t: str):
|
|
455
|
+
"""Test saving and loading CWLTokenTransformer with different TokenProcessor classes from database"""
|
|
607
456
|
workflow = CWLWorkflow(
|
|
608
457
|
context=context, name=utils.random_name(), config={}, cwl_version=CWL_VERSION
|
|
609
458
|
)
|
|
@@ -611,13 +460,50 @@ async def test_cwl_token_transformer(context: StreamFlowContext):
|
|
|
611
460
|
if workflow.format_graph is None:
|
|
612
461
|
workflow.format_graph = Graph()
|
|
613
462
|
await workflow.save(context)
|
|
614
|
-
|
|
615
|
-
|
|
463
|
+
processor = None
|
|
464
|
+
match processor_t:
|
|
465
|
+
case "primitive":
|
|
466
|
+
processor = _create_cwl_token_processor(port.name, workflow)
|
|
467
|
+
case "map":
|
|
468
|
+
processor = get_full_instantiation(
|
|
469
|
+
cls_=MapTokenProcessor,
|
|
470
|
+
name=port.name,
|
|
471
|
+
workflow=workflow,
|
|
472
|
+
processor=_create_cwl_token_processor(port.name, workflow),
|
|
473
|
+
)
|
|
474
|
+
case "object":
|
|
475
|
+
processor = get_full_instantiation(
|
|
476
|
+
cls_=ObjectTokenProcessor,
|
|
477
|
+
name=port.name,
|
|
478
|
+
workflow=workflow,
|
|
479
|
+
processors={
|
|
480
|
+
f"p_{i}": _create_cwl_token_processor(port.name, workflow)
|
|
481
|
+
for i in range(2)
|
|
482
|
+
},
|
|
483
|
+
)
|
|
484
|
+
case "union" | "optional":
|
|
485
|
+
processor = get_full_instantiation(
|
|
486
|
+
cls_=UnionTokenProcessor,
|
|
487
|
+
name=port.name,
|
|
488
|
+
workflow=workflow,
|
|
489
|
+
processors=[
|
|
490
|
+
(
|
|
491
|
+
get_full_instantiation(
|
|
492
|
+
cls_=NullTokenProcessor, name=port.name, workflow=workflow
|
|
493
|
+
)
|
|
494
|
+
if i == 0 and processor_t == "optional"
|
|
495
|
+
else _create_cwl_token_processor(port.name, workflow)
|
|
496
|
+
)
|
|
497
|
+
for i in range(2)
|
|
498
|
+
],
|
|
499
|
+
)
|
|
500
|
+
case _:
|
|
501
|
+
raise Exception(f"Unknown processor type: {processor_t}")
|
|
616
502
|
step = get_full_instantiation(
|
|
617
503
|
cls_=CWLTokenTransformer,
|
|
618
|
-
name=
|
|
504
|
+
name=f"{utils.random_name()}-transformer",
|
|
619
505
|
port_name=port.name,
|
|
620
|
-
processor=
|
|
506
|
+
processor=processor,
|
|
621
507
|
workflow=workflow,
|
|
622
508
|
)
|
|
623
509
|
workflow.steps[step.name] = step
|
|
@@ -631,20 +517,18 @@ async def test_value_from_transformer(context: StreamFlowContext):
|
|
|
631
517
|
context=context, name=utils.random_name(), config={}, cwl_version=CWL_VERSION
|
|
632
518
|
)
|
|
633
519
|
port = workflow.create_port()
|
|
634
|
-
job_port = workflow.create_port(JobPort)
|
|
635
520
|
if workflow.format_graph is None:
|
|
636
521
|
workflow.format_graph = Graph()
|
|
637
522
|
await workflow.save(context)
|
|
638
523
|
|
|
639
524
|
step = get_full_instantiation(
|
|
640
525
|
cls_=ValueFromTransformer,
|
|
641
|
-
name=utils.random_name()
|
|
526
|
+
name=f"{utils.random_name()}-value-from-transformer",
|
|
642
527
|
processor=_create_cwl_token_processor(port.name, workflow),
|
|
643
528
|
port_name=port.name,
|
|
644
529
|
expression_lib=True,
|
|
645
530
|
full_js=True,
|
|
646
531
|
value_from="$(1 + 1)",
|
|
647
|
-
job_port=job_port,
|
|
648
532
|
workflow=workflow,
|
|
649
533
|
)
|
|
650
534
|
workflow.steps[step.name] = step
|
|
@@ -657,111 +541,31 @@ async def test_loop_value_from_transformer(context: StreamFlowContext):
|
|
|
657
541
|
workflow = CWLWorkflow(
|
|
658
542
|
context=context, name=utils.random_name(), config={}, cwl_version=CWL_VERSION
|
|
659
543
|
)
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
if workflow.format_graph is None:
|
|
663
|
-
workflow.format_graph = Graph()
|
|
664
|
-
await workflow.save(context)
|
|
665
|
-
|
|
666
|
-
step = get_full_instantiation(
|
|
667
|
-
cls_=LoopValueFromTransformer,
|
|
668
|
-
name=utils.random_name() + "-loop-value-from-transformer",
|
|
669
|
-
processor=_create_cwl_token_processor(port.name, workflow),
|
|
670
|
-
port_name=port.name,
|
|
671
|
-
expression_lib=True,
|
|
672
|
-
full_js=True,
|
|
673
|
-
value_from="$(1 + 1 == 0)",
|
|
674
|
-
job_port=job_port,
|
|
675
|
-
workflow=workflow,
|
|
676
|
-
)
|
|
677
|
-
workflow.steps[step.name] = step
|
|
678
|
-
await save_load_and_test(step, context)
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
@pytest.mark.asyncio
|
|
682
|
-
async def test_cwl_map_token_transformer(context: StreamFlowContext):
|
|
683
|
-
"""Test saving and loading CWLTokenTransformer with CWLMapTokenProcessor from database"""
|
|
684
|
-
workflow = CWLWorkflow(
|
|
685
|
-
context=context, name=utils.random_name(), config={}, cwl_version=CWL_VERSION
|
|
686
|
-
)
|
|
687
|
-
port = workflow.create_port()
|
|
544
|
+
ports = [workflow.create_port() for _ in range(2)]
|
|
545
|
+
port_name = utils.random_name()
|
|
688
546
|
if workflow.format_graph is None:
|
|
689
547
|
workflow.format_graph = Graph()
|
|
690
548
|
await workflow.save(context)
|
|
691
549
|
|
|
692
|
-
step =
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
),
|
|
703
|
-
workflow=workflow,
|
|
704
|
-
)
|
|
705
|
-
workflow.steps[step.name] = step
|
|
706
|
-
await save_load_and_test(step, context)
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
@pytest.mark.asyncio
|
|
710
|
-
async def test_cwl_object_token_transformer(context: StreamFlowContext):
|
|
711
|
-
"""Test saving and loading CWLTokenTransformer with CWLObjectTokenProcessor from database"""
|
|
712
|
-
workflow = CWLWorkflow(
|
|
713
|
-
context=context, name=utils.random_name(), config={}, cwl_version=CWL_VERSION
|
|
714
|
-
)
|
|
715
|
-
port = workflow.create_port()
|
|
716
|
-
if workflow.format_graph is None:
|
|
717
|
-
workflow.format_graph = Graph()
|
|
718
|
-
await workflow.save(context)
|
|
719
|
-
|
|
720
|
-
step = get_full_instantiation(
|
|
721
|
-
cls_=CWLTokenTransformer,
|
|
722
|
-
name=utils.random_name() + "-transformer",
|
|
723
|
-
port_name=port.name,
|
|
724
|
-
processor=get_full_instantiation(
|
|
725
|
-
cls_=CWLObjectTokenProcessor,
|
|
726
|
-
name=port.name,
|
|
550
|
+
step = cast(
|
|
551
|
+
LoopValueFromTransformer,
|
|
552
|
+
get_full_instantiation(
|
|
553
|
+
cls_=LoopValueFromTransformer,
|
|
554
|
+
name=f"{utils.random_name()}-loop-value-from-transformer",
|
|
555
|
+
processor=_create_cwl_token_processor(port_name, workflow),
|
|
556
|
+
port_name=port_name,
|
|
557
|
+
expression_lib=True,
|
|
558
|
+
full_js=True,
|
|
559
|
+
value_from="$(1 + 1 == 0)",
|
|
727
560
|
workflow=workflow,
|
|
728
|
-
processors={
|
|
729
|
-
utils.random_name(): _create_cwl_token_processor(port.name, workflow)
|
|
730
|
-
},
|
|
731
|
-
optional=True,
|
|
732
561
|
),
|
|
733
|
-
workflow=workflow,
|
|
734
562
|
)
|
|
563
|
+
step.add_loop_input_port(port_name, ports[0])
|
|
564
|
+
step.add_loop_source_port(port_name, ports[1])
|
|
735
565
|
workflow.steps[step.name] = step
|
|
736
566
|
await save_load_and_test(step, context)
|
|
737
567
|
|
|
738
568
|
|
|
739
|
-
@pytest.mark.asyncio
|
|
740
|
-
async def test_cwl_union_token_transformer(context: StreamFlowContext):
|
|
741
|
-
"""Test saving and loading CWLTokenTransformer with CWLUnionTokenProcessor from database"""
|
|
742
|
-
workflow = CWLWorkflow(
|
|
743
|
-
context=context, name=utils.random_name(), config={}, cwl_version=CWL_VERSION
|
|
744
|
-
)
|
|
745
|
-
port = workflow.create_port()
|
|
746
|
-
if workflow.format_graph is None:
|
|
747
|
-
workflow.format_graph = Graph()
|
|
748
|
-
await workflow.save(context)
|
|
749
|
-
|
|
750
|
-
name = utils.random_name()
|
|
751
|
-
transformer = workflow.create_step(
|
|
752
|
-
cls=CWLTokenTransformer,
|
|
753
|
-
name=name + "-transformer",
|
|
754
|
-
port_name=port.name,
|
|
755
|
-
processor=get_full_instantiation(
|
|
756
|
-
cls_=CWLUnionTokenProcessor,
|
|
757
|
-
name=port.name,
|
|
758
|
-
workflow=workflow,
|
|
759
|
-
processors=[_create_cwl_token_processor(port.name, workflow)],
|
|
760
|
-
),
|
|
761
|
-
)
|
|
762
|
-
await save_load_and_test(transformer, context)
|
|
763
|
-
|
|
764
|
-
|
|
765
569
|
@pytest.mark.asyncio
|
|
766
570
|
async def test_all_non_null_transformer(context: StreamFlowContext):
|
|
767
571
|
"""Test saving and loading AllNonNullTransformer from database"""
|
|
@@ -865,7 +669,7 @@ async def test_cwl_conditional_step(context: StreamFlowContext):
|
|
|
865
669
|
workflow, (skip_port,) = await create_workflow(context=context, num_port=1)
|
|
866
670
|
step = get_full_instantiation(
|
|
867
671
|
cls_=CWLConditionalStep,
|
|
868
|
-
name=utils.random_name()
|
|
672
|
+
name=f"{utils.random_name()}-when",
|
|
869
673
|
expression="$(inputs.name.length == 10)",
|
|
870
674
|
expression_lib=[],
|
|
871
675
|
full_js=True,
|
|
@@ -882,7 +686,7 @@ async def test_cwl_loop_conditional_step(context: StreamFlowContext):
|
|
|
882
686
|
workflow, (skip_port,) = await create_workflow(context=context, num_port=1)
|
|
883
687
|
step = get_full_instantiation(
|
|
884
688
|
cls_=CWLLoopConditionalStep,
|
|
885
|
-
name=utils.random_name()
|
|
689
|
+
name=f"{utils.random_name()}-when",
|
|
886
690
|
expression="$(inputs.name.length == 10)",
|
|
887
691
|
expression_lib=[],
|
|
888
692
|
full_js=True,
|
|
@@ -188,7 +188,7 @@ async def test_gather_step(context: StreamFlowContext):
|
|
|
188
188
|
|
|
189
189
|
step = get_full_instantiation(
|
|
190
190
|
cls_=GatherStep,
|
|
191
|
-
name=utils.random_name()
|
|
191
|
+
name=f"{utils.random_name()}-gather",
|
|
192
192
|
depth=2,
|
|
193
193
|
size_port=port,
|
|
194
194
|
workflow=workflow,
|
|
@@ -205,7 +205,7 @@ async def test_scatter_step(context: StreamFlowContext):
|
|
|
205
205
|
|
|
206
206
|
step = get_full_instantiation(
|
|
207
207
|
cls_=ScatterStep,
|
|
208
|
-
name=utils.random_name()
|
|
208
|
+
name=f"{utils.random_name()}-scatter",
|
|
209
209
|
size_port=port,
|
|
210
210
|
workflow=workflow,
|
|
211
211
|
)
|
|
@@ -285,11 +285,14 @@ async def test_job_token(context: StreamFlowContext):
|
|
|
285
285
|
@pytest.mark.asyncio
|
|
286
286
|
async def test_list_token(context: StreamFlowContext):
|
|
287
287
|
"""Test saving and loading ListToken from database"""
|
|
288
|
+
# The `ListToken` does not accept `recoverable=True` and set its internal attribute to `False`.
|
|
289
|
+
# However, when using `get_full_instantiation`, passing the `recoverable` value is mandatory.
|
|
290
|
+
# To handle this, `None` is passed, allowing the `get_full_instantiation` function to control the value.
|
|
288
291
|
token = get_full_instantiation(
|
|
289
292
|
cls_=ListToken,
|
|
290
|
-
value=[Token("list"), Token("test")],
|
|
293
|
+
value=[Token("list", recoverable=True), Token("test", recoverable=True)],
|
|
291
294
|
tag="0.0",
|
|
292
|
-
recoverable=
|
|
295
|
+
recoverable=None,
|
|
293
296
|
)
|
|
294
297
|
await save_load_and_test(token, context)
|
|
295
298
|
|
|
@@ -297,8 +300,14 @@ async def test_list_token(context: StreamFlowContext):
|
|
|
297
300
|
@pytest.mark.asyncio
|
|
298
301
|
async def test_object_token(context: StreamFlowContext):
|
|
299
302
|
"""Test saving and loading ObjectToken from database"""
|
|
303
|
+
# The `ObjectToken` does not accept `recoverable=True` and set its internal attribute to `False`.
|
|
304
|
+
# However, when using `get_full_instantiation`, passing the `recoverable` value is mandatory.
|
|
305
|
+
# To handle this, `None` is passed, allowing the `get_full_instantiation` function to control the value.
|
|
300
306
|
token = get_full_instantiation(
|
|
301
|
-
cls_=ObjectToken,
|
|
307
|
+
cls_=ObjectToken,
|
|
308
|
+
value={"test": Token("object", recoverable=True)},
|
|
309
|
+
tag="0.0",
|
|
310
|
+
recoverable=None,
|
|
302
311
|
)
|
|
303
312
|
await save_load_and_test(token, context)
|
|
304
313
|
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
bandit==1.8.6
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = "0.0.9"
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
asyncpg==0.30.0
|
|
2
|
-
streamflow==0.2.0.dev13
|
|
3
|
-
|
|
4
|
-
[bandit]
|
|
5
|
-
bandit==1.8.6
|
|
6
|
-
|
|
7
|
-
[lint]
|
|
8
|
-
black==25.9.0
|
|
9
|
-
codespell==2.4.1
|
|
10
|
-
flake8-bugbear==24.12.12
|
|
11
|
-
isort==6.0.1
|
|
12
|
-
pyupgrade==3.20.0
|
|
13
|
-
|
|
14
|
-
[test]
|
|
15
|
-
pytest==8.4.2
|
|
16
|
-
pytest-asyncio==1.2.0
|
|
17
|
-
pytest-cov==7.0.0
|
|
18
|
-
pytest-xdist==3.8.0
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.10}/streamflow_postgresql.egg-info/zip-safe
RENAMED
|
File without changes
|
|
File without changes
|