streamflow-postgresql 0.0.5__tar.gz → 0.0.7__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.5/streamflow_postgresql.egg-info → streamflow_postgresql-0.0.7}/PKG-INFO +13 -2
- streamflow_postgresql-0.0.7/bandit-requirements.txt +1 -0
- streamflow_postgresql-0.0.7/lint-requirements.txt +4 -0
- streamflow_postgresql-0.0.7/requirements.txt +2 -0
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/streamflow_postgresql/database.py +127 -54
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/streamflow_postgresql/schemas/postgresql.sql +11 -2
- streamflow_postgresql-0.0.7/streamflow_postgresql/version.py +1 -0
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7/streamflow_postgresql.egg-info}/PKG-INFO +13 -2
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/streamflow_postgresql.egg-info/SOURCES.txt +2 -0
- streamflow_postgresql-0.0.7/streamflow_postgresql.egg-info/requires.txt +17 -0
- streamflow_postgresql-0.0.7/test-requirements.txt +4 -0
- streamflow_postgresql-0.0.7/tests/test_cwl_persistence.py +53 -0
- streamflow_postgresql-0.0.7/tests/test_database.py +53 -0
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/tests/test_persistence.py +24 -21
- streamflow-postgresql-0.0.5/bandit-requirements.txt +0 -1
- streamflow-postgresql-0.0.5/lint-requirements.txt +0 -4
- streamflow-postgresql-0.0.5/requirements.txt +0 -2
- streamflow-postgresql-0.0.5/streamflow_postgresql/version.py +0 -1
- streamflow-postgresql-0.0.5/streamflow_postgresql.egg-info/requires.txt +0 -17
- streamflow-postgresql-0.0.5/test-requirements.txt +0 -4
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/LICENSE +0 -0
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/MANIFEST.in +0 -0
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/README.md +0 -0
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/pyproject.toml +0 -0
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/setup.cfg +0 -0
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/streamflow_postgresql/__init__.py +0 -0
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/streamflow_postgresql/plugin.py +0 -0
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/streamflow_postgresql/schemas/postgresql.json +0 -0
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/streamflow_postgresql.egg-info/dependency_links.txt +0 -0
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/streamflow_postgresql.egg-info/entry_points.txt +0 -0
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/streamflow_postgresql.egg-info/top_level.txt +0 -0
- {streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/streamflow_postgresql.egg-info/zip-safe +0 -0
{streamflow-postgresql-0.0.5/streamflow_postgresql.egg-info → streamflow_postgresql-0.0.7}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: streamflow-postgresql
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Summary: StreamFlow PostgreSQL plugin
|
|
5
5
|
Author-email: Iacopo Colonnelli <iacopo.colonnelli@unito.it>
|
|
6
6
|
License: LGPL-3.0-or-later
|
|
@@ -22,10 +22,21 @@ Classifier: Topic :: Scientific/Engineering
|
|
|
22
22
|
Classifier: Topic :: System :: Distributed Computing
|
|
23
23
|
Requires-Python: >=3.8
|
|
24
24
|
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: asyncpg==0.29.0
|
|
27
|
+
Requires-Dist: streamflow==0.2.0.dev11
|
|
25
28
|
Provides-Extra: bandit
|
|
29
|
+
Requires-Dist: bandit==1.7.8; extra == "bandit"
|
|
26
30
|
Provides-Extra: lint
|
|
31
|
+
Requires-Dist: black==24.4.2; extra == "lint"
|
|
32
|
+
Requires-Dist: codespell==2.2.6; extra == "lint"
|
|
33
|
+
Requires-Dist: flake8-bugbear==24.4.26; extra == "lint"
|
|
34
|
+
Requires-Dist: pyupgrade==3.15.2; extra == "lint"
|
|
27
35
|
Provides-Extra: test
|
|
28
|
-
|
|
36
|
+
Requires-Dist: pytest==8.0.1; extra == "test"
|
|
37
|
+
Requires-Dist: pytest-asyncio==0.21.1; extra == "test"
|
|
38
|
+
Requires-Dist: pytest-cov==5.0.0; extra == "test"
|
|
39
|
+
Requires-Dist: pytest-xdist==3.6.1; extra == "test"
|
|
29
40
|
|
|
30
41
|
# PostgreSQL Plugin for StreamFlow
|
|
31
42
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bandit==1.7.8
|
{streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/streamflow_postgresql/database.py
RENAMED
|
@@ -91,19 +91,6 @@ class PostgreSQLDatabase(CachedDatabase):
|
|
|
91
91
|
__name__, os.path.join("schemas", "postgresql.json")
|
|
92
92
|
)
|
|
93
93
|
|
|
94
|
-
async def add_command(self, step_id: int, tag: str, cmd: str) -> int:
|
|
95
|
-
async with self.pool as pool:
|
|
96
|
-
async with pool.acquire() as conn:
|
|
97
|
-
async with conn.transaction():
|
|
98
|
-
return await conn.fetchval(
|
|
99
|
-
"INSERT INTO command(step, tag, cmd) "
|
|
100
|
-
"VALUES($1, $2, $3) "
|
|
101
|
-
"RETURNING id",
|
|
102
|
-
step_id,
|
|
103
|
-
tag,
|
|
104
|
-
cmd.encode("utf-8"),
|
|
105
|
-
)
|
|
106
|
-
|
|
107
94
|
async def add_dependency(
|
|
108
95
|
self, step: int, port: int, type: DependencyType, name: str
|
|
109
96
|
) -> None:
|
|
@@ -128,13 +115,14 @@ class PostgreSQLDatabase(CachedDatabase):
|
|
|
128
115
|
external: bool,
|
|
129
116
|
lazy: bool,
|
|
130
117
|
workdir: str | None,
|
|
118
|
+
wraps: MutableMapping[str, Any] | None,
|
|
131
119
|
) -> int:
|
|
132
120
|
async with self.pool as pool:
|
|
133
121
|
async with pool.acquire() as conn:
|
|
134
122
|
async with conn.transaction():
|
|
135
123
|
return await conn.fetchval(
|
|
136
|
-
"INSERT INTO deployment(name, type, config, external, lazy, workdir) "
|
|
137
|
-
"VALUES ($1, $2, $3, $4, $5, $6) "
|
|
124
|
+
"INSERT INTO deployment(name, type, config, external, lazy, workdir, wraps) "
|
|
125
|
+
"VALUES ($1, $2, $3, $4, $5, $6, $7) "
|
|
138
126
|
"RETURNING id",
|
|
139
127
|
name,
|
|
140
128
|
type,
|
|
@@ -142,6 +130,33 @@ class PostgreSQLDatabase(CachedDatabase):
|
|
|
142
130
|
external,
|
|
143
131
|
lazy,
|
|
144
132
|
workdir,
|
|
133
|
+
json.dumps(wraps),
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
async def add_execution(self, step_id: int, tag: str, cmd: str) -> int:
|
|
137
|
+
async with self.pool as pool:
|
|
138
|
+
async with pool.acquire() as conn:
|
|
139
|
+
async with conn.transaction():
|
|
140
|
+
return await conn.fetchval(
|
|
141
|
+
"INSERT INTO execution(step, tag, cmd) "
|
|
142
|
+
"VALUES($1, $2, $3) "
|
|
143
|
+
"RETURNING id",
|
|
144
|
+
step_id,
|
|
145
|
+
tag,
|
|
146
|
+
cmd.encode("utf-8"),
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
async def add_filter(self, name: str, type: str, config: str) -> int:
|
|
150
|
+
async with self.pool as pool:
|
|
151
|
+
async with pool.acquire() as conn:
|
|
152
|
+
async with conn.transaction():
|
|
153
|
+
return await conn.fetchval(
|
|
154
|
+
"INSERT INTO filter(name, type, config) "
|
|
155
|
+
"VALUES($1, $2, $3) "
|
|
156
|
+
"RETURNING id",
|
|
157
|
+
name,
|
|
158
|
+
type,
|
|
159
|
+
config,
|
|
145
160
|
)
|
|
146
161
|
|
|
147
162
|
async def add_port(
|
|
@@ -242,24 +257,52 @@ class PostgreSQLDatabase(CachedDatabase):
|
|
|
242
257
|
type,
|
|
243
258
|
)
|
|
244
259
|
|
|
245
|
-
async def
|
|
260
|
+
async def get_dependees(
|
|
261
|
+
self, token_id: int
|
|
262
|
+
) -> MutableSequence[MutableMapping[str, Any]]:
|
|
263
|
+
async with self.pool as pool:
|
|
264
|
+
async with pool.acquire() as conn:
|
|
265
|
+
return await conn.fetch(
|
|
266
|
+
"SELECT * FROM provenance WHERE depender = $1",
|
|
267
|
+
token_id,
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
async def get_dependers(
|
|
271
|
+
self, token_id: int
|
|
272
|
+
) -> MutableSequence[MutableMapping[str, Any]]:
|
|
273
|
+
async with self.pool as pool:
|
|
274
|
+
async with pool.acquire() as conn:
|
|
275
|
+
return await conn.fetch(
|
|
276
|
+
"SELECT * FROM provenance WHERE dependee = $1",
|
|
277
|
+
token_id,
|
|
278
|
+
)
|
|
279
|
+
|
|
280
|
+
async def get_deployment(self, deplyoment_id: int) -> MutableMapping[str, Any]:
|
|
281
|
+
async with self.pool as pool:
|
|
282
|
+
async with pool.acquire() as conn:
|
|
283
|
+
return await conn.fetchrow(
|
|
284
|
+
"SELECT * FROM deployment WHERE id = $1",
|
|
285
|
+
deplyoment_id,
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
async def get_execution(self, execution_id: int) -> MutableMapping[str, Any]:
|
|
246
289
|
async with self.pool as pool:
|
|
247
290
|
async with pool.acquire() as conn:
|
|
248
291
|
row = await conn.fetchrow(
|
|
249
|
-
"SELECT * FROM
|
|
292
|
+
"SELECT * FROM execution WHERE id = $1", execution_id
|
|
250
293
|
)
|
|
251
294
|
return {
|
|
252
295
|
k: bytearray(v) if isinstance(v, memoryview) else v
|
|
253
296
|
for k, v in row.items()
|
|
254
297
|
}
|
|
255
298
|
|
|
256
|
-
async def
|
|
299
|
+
async def get_executions_by_step(
|
|
257
300
|
self, step_id: int
|
|
258
301
|
) -> MutableSequence[MutableMapping[str, Any]]:
|
|
259
302
|
async with self.pool as pool:
|
|
260
303
|
async with pool.acquire() as conn:
|
|
261
304
|
rows = await conn.fetch(
|
|
262
|
-
"SELECT * FROM
|
|
305
|
+
"SELECT * FROM execution WHERE step = $1", step_id
|
|
263
306
|
)
|
|
264
307
|
return [
|
|
265
308
|
{
|
|
@@ -269,35 +312,37 @@ class PostgreSQLDatabase(CachedDatabase):
|
|
|
269
312
|
for row in rows
|
|
270
313
|
]
|
|
271
314
|
|
|
272
|
-
async def
|
|
273
|
-
self, token_id: int
|
|
274
|
-
) -> MutableSequence[MutableMapping[str, Any]]:
|
|
315
|
+
async def get_filter(self, filter_id: int) -> MutableMapping[str, Any]:
|
|
275
316
|
async with self.pool as pool:
|
|
276
317
|
async with pool.acquire() as conn:
|
|
277
|
-
return await conn.
|
|
278
|
-
"SELECT * FROM
|
|
279
|
-
|
|
318
|
+
return await conn.fetchrow(
|
|
319
|
+
"SELECT * FROM filter WHERE id = $1",
|
|
320
|
+
filter_id,
|
|
280
321
|
)
|
|
281
322
|
|
|
282
|
-
async def
|
|
283
|
-
self,
|
|
323
|
+
async def get_input_ports(
|
|
324
|
+
self, step_id: int
|
|
284
325
|
) -> MutableSequence[MutableMapping[str, Any]]:
|
|
285
326
|
async with self.pool as pool:
|
|
286
327
|
async with pool.acquire() as conn:
|
|
287
328
|
return await conn.fetch(
|
|
288
|
-
"SELECT * FROM
|
|
289
|
-
|
|
329
|
+
"SELECT * FROM dependency WHERE step = $1 AND type = $2",
|
|
330
|
+
step_id,
|
|
331
|
+
DependencyType.INPUT.value,
|
|
290
332
|
)
|
|
291
333
|
|
|
292
|
-
async def
|
|
334
|
+
async def get_input_steps(
|
|
335
|
+
self, port_id: int
|
|
336
|
+
) -> MutableSequence[MutableMapping[str, Any]]:
|
|
293
337
|
async with self.pool as pool:
|
|
294
338
|
async with pool.acquire() as conn:
|
|
295
|
-
return await conn.
|
|
296
|
-
"SELECT * FROM
|
|
297
|
-
|
|
339
|
+
return await conn.fetch(
|
|
340
|
+
"SELECT * FROM dependency WHERE port = $1 AND type = $2",
|
|
341
|
+
port_id,
|
|
342
|
+
DependencyType.OUTPUT.value,
|
|
298
343
|
)
|
|
299
344
|
|
|
300
|
-
async def
|
|
345
|
+
async def get_output_ports(
|
|
301
346
|
self, step_id: int
|
|
302
347
|
) -> MutableSequence[MutableMapping[str, Any]]:
|
|
303
348
|
async with self.pool as pool:
|
|
@@ -305,18 +350,18 @@ class PostgreSQLDatabase(CachedDatabase):
|
|
|
305
350
|
return await conn.fetch(
|
|
306
351
|
"SELECT * FROM dependency WHERE step = $1 AND type = $2",
|
|
307
352
|
step_id,
|
|
308
|
-
DependencyType.
|
|
353
|
+
DependencyType.OUTPUT.value,
|
|
309
354
|
)
|
|
310
355
|
|
|
311
|
-
async def
|
|
312
|
-
self,
|
|
356
|
+
async def get_output_steps(
|
|
357
|
+
self, port_id: int
|
|
313
358
|
) -> MutableSequence[MutableMapping[str, Any]]:
|
|
314
359
|
async with self.pool as pool:
|
|
315
360
|
async with pool.acquire() as conn:
|
|
316
361
|
return await conn.fetch(
|
|
317
|
-
"SELECT * FROM dependency WHERE
|
|
318
|
-
|
|
319
|
-
DependencyType.
|
|
362
|
+
"SELECT * FROM dependency WHERE port = $1 AND type = $2",
|
|
363
|
+
port_id,
|
|
364
|
+
DependencyType.INPUT.value,
|
|
320
365
|
)
|
|
321
366
|
|
|
322
367
|
async def get_port(self, port_id: int) -> MutableMapping[str, Any]:
|
|
@@ -324,6 +369,16 @@ class PostgreSQLDatabase(CachedDatabase):
|
|
|
324
369
|
async with pool.acquire() as conn:
|
|
325
370
|
return await conn.fetchrow("SELECT * FROM port WHERE id = $1", port_id)
|
|
326
371
|
|
|
372
|
+
async def get_port_from_token(self, token_id: int) -> MutableMapping[str, Any]:
|
|
373
|
+
async with self.pool as pool:
|
|
374
|
+
async with pool.acquire() as conn:
|
|
375
|
+
return await conn.fetchrow(
|
|
376
|
+
"SELECT port.* "
|
|
377
|
+
"FROM token JOIN port ON token.port = port.id"
|
|
378
|
+
"WHERE token.id = $1",
|
|
379
|
+
token_id,
|
|
380
|
+
)
|
|
381
|
+
|
|
327
382
|
async def get_port_tokens(self, port_id: int) -> MutableSequence[int]:
|
|
328
383
|
async with self.pool as pool:
|
|
329
384
|
async with pool.acquire() as conn:
|
|
@@ -338,7 +393,7 @@ class PostgreSQLDatabase(CachedDatabase):
|
|
|
338
393
|
if last_only:
|
|
339
394
|
rows = await conn.fetch(
|
|
340
395
|
"SELECT c.id, s.name, c.start_time, c.end_time "
|
|
341
|
-
"FROM step AS s,
|
|
396
|
+
"FROM step AS s, execution AS c "
|
|
342
397
|
"WHERE s.id = c.step "
|
|
343
398
|
"AND s.workflow = ("
|
|
344
399
|
"SELECT id FROM workflow "
|
|
@@ -351,7 +406,7 @@ class PostgreSQLDatabase(CachedDatabase):
|
|
|
351
406
|
async with conn.transaction():
|
|
352
407
|
cursor = conn.cursor(
|
|
353
408
|
"SELECT s.workflow, c.id, s.name, c.start_time, c.end_time "
|
|
354
|
-
"FROM step AS s,
|
|
409
|
+
"FROM step AS s, execution AS c "
|
|
355
410
|
"WHERE s.id = c.step "
|
|
356
411
|
"AND s.workflow IN (SELECT id FROM workflow WHERE name = $1) "
|
|
357
412
|
"ORDER BY s.workflow DESC",
|
|
@@ -446,37 +501,55 @@ class PostgreSQLDatabase(CachedDatabase):
|
|
|
446
501
|
"ORDER BY name DESC"
|
|
447
502
|
)
|
|
448
503
|
|
|
449
|
-
async def
|
|
450
|
-
self,
|
|
504
|
+
async def update_deployment(
|
|
505
|
+
self, deployment_id: int, updates: MutableMapping[str, Any]
|
|
451
506
|
) -> int:
|
|
452
507
|
async with self.pool as pool:
|
|
453
508
|
async with pool.acquire() as conn:
|
|
454
509
|
async with conn.transaction():
|
|
455
510
|
await conn.execute(
|
|
456
|
-
"UPDATE
|
|
511
|
+
"UPDATE deployment SET {} WHERE id = $1".format( # nosec
|
|
457
512
|
", ".join([f"{k} = ${i+2}" for i, k in enumerate(updates)])
|
|
458
513
|
),
|
|
459
|
-
|
|
514
|
+
deployment_id,
|
|
460
515
|
*updates.values(),
|
|
461
516
|
)
|
|
462
|
-
self.port_cache.pop(
|
|
463
|
-
return
|
|
517
|
+
self.port_cache.pop(deployment_id, None)
|
|
518
|
+
return deployment_id
|
|
464
519
|
|
|
465
|
-
async def
|
|
466
|
-
self,
|
|
520
|
+
async def update_execution(
|
|
521
|
+
self, execution_id: int, updates: MutableMapping[str, Any]
|
|
467
522
|
) -> int:
|
|
468
523
|
async with self.pool as pool:
|
|
469
524
|
async with pool.acquire() as conn:
|
|
470
525
|
async with conn.transaction():
|
|
471
526
|
await conn.execute(
|
|
472
|
-
"UPDATE
|
|
527
|
+
"UPDATE execution SET {} WHERE id = $1".format( # nosec
|
|
473
528
|
", ".join([f"{k} = ${i+2}" for i, k in enumerate(updates)])
|
|
474
529
|
),
|
|
475
|
-
|
|
530
|
+
execution_id,
|
|
476
531
|
*updates.values(),
|
|
477
532
|
)
|
|
478
|
-
self.port_cache.pop(
|
|
479
|
-
return
|
|
533
|
+
self.port_cache.pop(execution_id, None)
|
|
534
|
+
return execution_id
|
|
535
|
+
|
|
536
|
+
async def update_filter(
|
|
537
|
+
self, filter_id: int, updates: MutableMapping[str, Any]
|
|
538
|
+
) -> int:
|
|
539
|
+
async with self.pool as pool:
|
|
540
|
+
async with pool.acquire() as conn:
|
|
541
|
+
async with conn.transaction():
|
|
542
|
+
await conn.execute(
|
|
543
|
+
"UPDATE filter SET {} WHERE id = $1".format( # nosec
|
|
544
|
+
", ".join(
|
|
545
|
+
[f"{k} = ${i + 2}" for i, k in enumerate(updates)]
|
|
546
|
+
)
|
|
547
|
+
),
|
|
548
|
+
filter_id,
|
|
549
|
+
*updates.values(),
|
|
550
|
+
)
|
|
551
|
+
self.filter_cache.pop(filter_id, None)
|
|
552
|
+
return filter_id
|
|
480
553
|
|
|
481
554
|
async def update_port(self, port_id: int, updates: MutableMapping[str, Any]) -> int:
|
|
482
555
|
async with self.pool as pool:
|
|
@@ -43,7 +43,7 @@ CREATE TABLE IF NOT EXISTS dependency
|
|
|
43
43
|
);
|
|
44
44
|
|
|
45
45
|
|
|
46
|
-
CREATE TABLE IF NOT EXISTS
|
|
46
|
+
CREATE TABLE IF NOT EXISTS execution
|
|
47
47
|
(
|
|
48
48
|
id SERIAL PRIMARY KEY,
|
|
49
49
|
step INTEGER,
|
|
@@ -86,7 +86,8 @@ CREATE TABLE IF NOT EXISTS deployment
|
|
|
86
86
|
config TEXT,
|
|
87
87
|
external BOOLEAN,
|
|
88
88
|
lazy BOOLEAN,
|
|
89
|
-
workdir TEXT
|
|
89
|
+
workdir TEXT,
|
|
90
|
+
wraps TEXT
|
|
90
91
|
);
|
|
91
92
|
|
|
92
93
|
|
|
@@ -101,3 +102,11 @@ CREATE TABLE IF NOT EXISTS target
|
|
|
101
102
|
params TEXT,
|
|
102
103
|
FOREIGN KEY (deployment) REFERENCES deployment (id)
|
|
103
104
|
);
|
|
105
|
+
|
|
106
|
+
CREATE TABLE IF NOT EXISTS filter
|
|
107
|
+
(
|
|
108
|
+
id SERIAL PRIMARY KEY,
|
|
109
|
+
name TEXT,
|
|
110
|
+
type TEXT,
|
|
111
|
+
config TEXT
|
|
112
|
+
);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
VERSION = "0.0.7"
|
{streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7/streamflow_postgresql.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: streamflow-postgresql
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.7
|
|
4
4
|
Summary: StreamFlow PostgreSQL plugin
|
|
5
5
|
Author-email: Iacopo Colonnelli <iacopo.colonnelli@unito.it>
|
|
6
6
|
License: LGPL-3.0-or-later
|
|
@@ -22,10 +22,21 @@ Classifier: Topic :: Scientific/Engineering
|
|
|
22
22
|
Classifier: Topic :: System :: Distributed Computing
|
|
23
23
|
Requires-Python: >=3.8
|
|
24
24
|
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: asyncpg==0.29.0
|
|
27
|
+
Requires-Dist: streamflow==0.2.0.dev11
|
|
25
28
|
Provides-Extra: bandit
|
|
29
|
+
Requires-Dist: bandit==1.7.8; extra == "bandit"
|
|
26
30
|
Provides-Extra: lint
|
|
31
|
+
Requires-Dist: black==24.4.2; extra == "lint"
|
|
32
|
+
Requires-Dist: codespell==2.2.6; extra == "lint"
|
|
33
|
+
Requires-Dist: flake8-bugbear==24.4.26; extra == "lint"
|
|
34
|
+
Requires-Dist: pyupgrade==3.15.2; extra == "lint"
|
|
27
35
|
Provides-Extra: test
|
|
28
|
-
|
|
36
|
+
Requires-Dist: pytest==8.0.1; extra == "test"
|
|
37
|
+
Requires-Dist: pytest-asyncio==0.21.1; extra == "test"
|
|
38
|
+
Requires-Dist: pytest-cov==5.0.0; extra == "test"
|
|
39
|
+
Requires-Dist: pytest-xdist==3.6.1; extra == "test"
|
|
29
40
|
|
|
30
41
|
# PostgreSQL Plugin for StreamFlow
|
|
31
42
|
|
|
@@ -19,4 +19,6 @@ streamflow_postgresql.egg-info/top_level.txt
|
|
|
19
19
|
streamflow_postgresql.egg-info/zip-safe
|
|
20
20
|
streamflow_postgresql/schemas/postgresql.json
|
|
21
21
|
streamflow_postgresql/schemas/postgresql.sql
|
|
22
|
+
tests/test_cwl_persistence.py
|
|
23
|
+
tests/test_database.py
|
|
22
24
|
tests/test_persistence.py
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
asyncpg==0.29.0
|
|
2
|
+
streamflow==0.2.0.dev11
|
|
3
|
+
|
|
4
|
+
[bandit]
|
|
5
|
+
bandit==1.7.8
|
|
6
|
+
|
|
7
|
+
[lint]
|
|
8
|
+
black==24.4.2
|
|
9
|
+
codespell==2.2.6
|
|
10
|
+
flake8-bugbear==24.4.26
|
|
11
|
+
pyupgrade==3.15.2
|
|
12
|
+
|
|
13
|
+
[test]
|
|
14
|
+
pytest==8.0.1
|
|
15
|
+
pytest-asyncio==0.21.1
|
|
16
|
+
pytest-cov==5.0.0
|
|
17
|
+
pytest-xdist==3.6.1
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from typing import Any
|
|
4
|
+
|
|
5
|
+
import pytest
|
|
6
|
+
from ruamel.yaml.scalarstring import DoubleQuotedScalarString, LiteralScalarString
|
|
7
|
+
|
|
8
|
+
from streamflow.core import utils
|
|
9
|
+
from streamflow.core.context import StreamFlowContext
|
|
10
|
+
from streamflow.core.workflow import Workflow
|
|
11
|
+
from streamflow.cwl.command import CWLCommand, CWLCommandToken
|
|
12
|
+
from streamflow.workflow.step import ExecuteStep
|
|
13
|
+
from tests.conftest import save_load_and_test
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _create_cwl_command_token(
|
|
17
|
+
cls: type[CWLCommandToken] = CWLCommandToken, value: Any | None = None
|
|
18
|
+
):
|
|
19
|
+
return cls(
|
|
20
|
+
is_shell_command=False,
|
|
21
|
+
item_separator="&",
|
|
22
|
+
name="test",
|
|
23
|
+
position=2,
|
|
24
|
+
prefix="--test",
|
|
25
|
+
separate=True,
|
|
26
|
+
shell_quote=True,
|
|
27
|
+
token_type="string",
|
|
28
|
+
value=value,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@pytest.mark.asyncio
|
|
33
|
+
async def test_cwl_command_token(context: StreamFlowContext):
|
|
34
|
+
"""Test saving and loading CWLCommand with CWLCommandTokens from database"""
|
|
35
|
+
workflow = Workflow(
|
|
36
|
+
context=context, type="cwl", name=utils.random_name(), config={}
|
|
37
|
+
)
|
|
38
|
+
port = workflow.create_port()
|
|
39
|
+
await workflow.save(context)
|
|
40
|
+
step = workflow.create_step(
|
|
41
|
+
cls=ExecuteStep, name=utils.random_name(), job_port=port
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
step.command = CWLCommand(
|
|
45
|
+
step=step,
|
|
46
|
+
command_tokens=[
|
|
47
|
+
_create_cwl_command_token(value=DoubleQuotedScalarString("60")),
|
|
48
|
+
_create_cwl_command_token(
|
|
49
|
+
value=LiteralScalarString("${ return 10 + 20 - (5 * 4) }")
|
|
50
|
+
),
|
|
51
|
+
],
|
|
52
|
+
)
|
|
53
|
+
await save_load_and_test(step, context)
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import pytest
|
|
2
|
+
|
|
3
|
+
from streamflow.core import utils
|
|
4
|
+
from streamflow.core.context import StreamFlowContext
|
|
5
|
+
from streamflow.core.workflow import Workflow
|
|
6
|
+
from streamflow.workflow.port import JobPort
|
|
7
|
+
from streamflow.workflow.step import ExecuteStep
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@pytest.mark.asyncio
|
|
11
|
+
async def test_get_steps_queries(context: StreamFlowContext):
|
|
12
|
+
"""Test get_input_steps and get_output_steps queries"""
|
|
13
|
+
workflow = Workflow(
|
|
14
|
+
context=context, type="cwl", name=utils.random_name(), config={}
|
|
15
|
+
)
|
|
16
|
+
ports = [workflow.create_port() for _ in range(3)]
|
|
17
|
+
job_ports = [workflow.create_port(JobPort) for _ in range(2)]
|
|
18
|
+
step = workflow.create_step(
|
|
19
|
+
cls=ExecuteStep, name=utils.random_name(), job_port=job_ports[0]
|
|
20
|
+
)
|
|
21
|
+
step_2 = workflow.create_step(
|
|
22
|
+
cls=ExecuteStep, name=utils.random_name(), job_port=job_ports[1]
|
|
23
|
+
)
|
|
24
|
+
step.add_input_port("in", ports[0])
|
|
25
|
+
step.add_output_port("out", ports[1])
|
|
26
|
+
step_2.add_input_port("in2", ports[1])
|
|
27
|
+
step_2.add_output_port("out2", ports[2])
|
|
28
|
+
await workflow.save(context)
|
|
29
|
+
|
|
30
|
+
input_steps_port_a = await context.database.get_input_steps(ports[0].persistent_id)
|
|
31
|
+
assert len(input_steps_port_a) == 0
|
|
32
|
+
output_steps_port_a = await context.database.get_output_steps(
|
|
33
|
+
ports[0].persistent_id
|
|
34
|
+
)
|
|
35
|
+
assert len(output_steps_port_a) == 1
|
|
36
|
+
assert output_steps_port_a[0]["step"] == step.persistent_id
|
|
37
|
+
|
|
38
|
+
input_steps_port_b = await context.database.get_input_steps(ports[1].persistent_id)
|
|
39
|
+
assert len(input_steps_port_b) == 1
|
|
40
|
+
assert input_steps_port_b[0]["step"] == step.persistent_id
|
|
41
|
+
output_steps_port_b = await context.database.get_output_steps(
|
|
42
|
+
ports[1].persistent_id
|
|
43
|
+
)
|
|
44
|
+
assert len(output_steps_port_b) == 1
|
|
45
|
+
assert output_steps_port_b[0]["step"] == step_2.persistent_id
|
|
46
|
+
|
|
47
|
+
input_steps_port_c = await context.database.get_input_steps(ports[2].persistent_id)
|
|
48
|
+
assert len(input_steps_port_c) == 1
|
|
49
|
+
assert input_steps_port_c[0]["step"] == step_2.persistent_id
|
|
50
|
+
output_steps_port_c = await context.database.get_output_steps(
|
|
51
|
+
ports[2].persistent_id
|
|
52
|
+
)
|
|
53
|
+
assert len(output_steps_port_c) == 0
|
|
@@ -5,37 +5,35 @@ import pytest
|
|
|
5
5
|
from tests.conftest import get_docker_deployment_config, save_load_and_test
|
|
6
6
|
|
|
7
7
|
from streamflow.core import utils
|
|
8
|
-
from streamflow.core.context import StreamFlowContext
|
|
9
8
|
from streamflow.core.config import BindingConfig
|
|
10
|
-
from streamflow.core.
|
|
9
|
+
from streamflow.core.context import StreamFlowContext
|
|
10
|
+
from streamflow.core.deployment import LocalTarget, Target, FilterConfig
|
|
11
11
|
from streamflow.core.workflow import Job, Token, Workflow
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
from streamflow.workflow.combinator import (
|
|
13
|
+
CartesianProductCombinator,
|
|
14
|
+
DotProductCombinator,
|
|
15
|
+
LoopCombinator,
|
|
16
|
+
LoopTerminationCombinator,
|
|
17
|
+
)
|
|
18
|
+
from streamflow.workflow.port import ConnectorPort, JobPort
|
|
14
19
|
from streamflow.workflow.step import (
|
|
15
20
|
CombinatorStep,
|
|
16
21
|
DeployStep,
|
|
17
22
|
ExecuteStep,
|
|
18
23
|
GatherStep,
|
|
19
|
-
ScheduleStep,
|
|
20
|
-
ScatterStep,
|
|
21
24
|
LoopCombinatorStep,
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
CartesianProductCombinator,
|
|
25
|
-
DotProductCombinator,
|
|
26
|
-
LoopCombinator,
|
|
27
|
-
LoopTerminationCombinator,
|
|
25
|
+
ScatterStep,
|
|
26
|
+
ScheduleStep,
|
|
28
27
|
)
|
|
29
28
|
from streamflow.workflow.token import (
|
|
29
|
+
IterationTerminationToken,
|
|
30
30
|
JobToken,
|
|
31
31
|
ListToken,
|
|
32
32
|
ObjectToken,
|
|
33
33
|
TerminationToken,
|
|
34
|
-
IterationTerminationToken,
|
|
35
34
|
)
|
|
36
35
|
|
|
37
36
|
|
|
38
|
-
# Testing Workflow
|
|
39
37
|
@pytest.mark.asyncio
|
|
40
38
|
async def test_workflow(context: StreamFlowContext):
|
|
41
39
|
"""Test saving and loading Workflow from database"""
|
|
@@ -45,7 +43,6 @@ async def test_workflow(context: StreamFlowContext):
|
|
|
45
43
|
await save_load_and_test(workflow, context)
|
|
46
44
|
|
|
47
45
|
|
|
48
|
-
# Testing Port and its extension classes
|
|
49
46
|
@pytest.mark.asyncio
|
|
50
47
|
async def test_port(context: StreamFlowContext):
|
|
51
48
|
"""Test saving and loading Port from database"""
|
|
@@ -79,7 +76,6 @@ async def test_connector_port(context: StreamFlowContext):
|
|
|
79
76
|
await save_load_and_test(port, context)
|
|
80
77
|
|
|
81
78
|
|
|
82
|
-
# Testing Step and its extension classes
|
|
83
79
|
@pytest.mark.asyncio
|
|
84
80
|
async def test_combinator_step(context: StreamFlowContext):
|
|
85
81
|
"""Test saving and loading CombinatorStep with CartesianProductCombinator from database"""
|
|
@@ -180,10 +176,14 @@ async def test_gather_step(context: StreamFlowContext):
|
|
|
180
176
|
workflow = Workflow(
|
|
181
177
|
context=context, type="cwl", name=utils.random_name(), config={}
|
|
182
178
|
)
|
|
179
|
+
size_port = workflow.create_port()
|
|
183
180
|
await workflow.save(context)
|
|
184
181
|
|
|
185
182
|
step = workflow.create_step(
|
|
186
|
-
cls=GatherStep,
|
|
183
|
+
cls=GatherStep,
|
|
184
|
+
name=utils.random_name() + "-gather",
|
|
185
|
+
depth=1,
|
|
186
|
+
size_port=size_port,
|
|
187
187
|
)
|
|
188
188
|
await save_load_and_test(step, context)
|
|
189
189
|
|
|
@@ -200,7 +200,6 @@ async def test_scatter_step(context: StreamFlowContext):
|
|
|
200
200
|
await save_load_and_test(step, context)
|
|
201
201
|
|
|
202
202
|
|
|
203
|
-
# Subtest - Step param combinator
|
|
204
203
|
@pytest.mark.asyncio
|
|
205
204
|
async def test_dot_product_combinator(context: StreamFlowContext):
|
|
206
205
|
"""Test saving and loading CombinatorStep with DotProductCombinator from database"""
|
|
@@ -254,7 +253,6 @@ async def test_loop_termination_combinator(context: StreamFlowContext):
|
|
|
254
253
|
await save_load_and_test(step, context)
|
|
255
254
|
|
|
256
255
|
|
|
257
|
-
# Testing the Target and its extension classes
|
|
258
256
|
@pytest.mark.asyncio
|
|
259
257
|
async def test_target(context: StreamFlowContext):
|
|
260
258
|
"""Test saving and loading Target from database"""
|
|
@@ -273,7 +271,6 @@ async def test_local_target(context: StreamFlowContext):
|
|
|
273
271
|
await save_load_and_test(target, context)
|
|
274
272
|
|
|
275
273
|
|
|
276
|
-
# Testing the Token and its extension classes
|
|
277
274
|
@pytest.mark.asyncio
|
|
278
275
|
async def test_token(context: StreamFlowContext):
|
|
279
276
|
"""Test saving and loading Token from database"""
|
|
@@ -325,7 +322,13 @@ async def test_iteration_termination_token(context: StreamFlowContext):
|
|
|
325
322
|
await save_load_and_test(token, context)
|
|
326
323
|
|
|
327
324
|
|
|
328
|
-
|
|
325
|
+
@pytest.mark.asyncio
|
|
326
|
+
async def test_filter_config(context: StreamFlowContext):
|
|
327
|
+
"""Test saving and loading filter configuration from database"""
|
|
328
|
+
config = FilterConfig(config={}, name=utils.random_name(), type="shuffle")
|
|
329
|
+
await save_load_and_test(config, context)
|
|
330
|
+
|
|
331
|
+
|
|
329
332
|
@pytest.mark.asyncio
|
|
330
333
|
async def test_deployment(context: StreamFlowContext):
|
|
331
334
|
"""Test saving and loading deployment configuration from database"""
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
bandit==1.7.5
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
VERSION = "0.0.5"
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
asyncpg==0.28.0
|
|
2
|
-
streamflow==0.2.0.dev8
|
|
3
|
-
|
|
4
|
-
[bandit]
|
|
5
|
-
bandit==1.7.5
|
|
6
|
-
|
|
7
|
-
[lint]
|
|
8
|
-
black==23.7.0
|
|
9
|
-
codespell==2.2.5
|
|
10
|
-
flake8-bugbear==23.7.10
|
|
11
|
-
pyupgrade==3.10.1
|
|
12
|
-
|
|
13
|
-
[test]
|
|
14
|
-
pytest==7.4.0
|
|
15
|
-
pytest-asyncio==0.21.1
|
|
16
|
-
pytest-cov==4.1.0
|
|
17
|
-
pytest-xdist==3.3.1
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/streamflow_postgresql/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{streamflow-postgresql-0.0.5 → streamflow_postgresql-0.0.7}/streamflow_postgresql.egg-info/zip-safe
RENAMED
|
File without changes
|