streamflow-postgresql 0.0.9__tar.gz → 0.0.11__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.
Files changed (29) hide show
  1. streamflow_postgresql-0.0.11/MANIFEST.in +2 -0
  2. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/PKG-INFO +5 -18
  3. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/pyproject.toml +31 -12
  4. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/streamflow/plugins/unito/postgresql/database.py +18 -12
  5. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/streamflow/plugins/unito/postgresql/schemas/postgresql.sql +7 -7
  6. streamflow_postgresql-0.0.11/streamflow/plugins/unito/postgresql/version.py +3 -0
  7. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/streamflow_postgresql.egg-info/PKG-INFO +5 -18
  8. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/streamflow_postgresql.egg-info/SOURCES.txt +0 -4
  9. streamflow_postgresql-0.0.11/streamflow_postgresql.egg-info/requires.txt +2 -0
  10. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/tests/test_cwl_persistence.py +211 -406
  11. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/tests/test_database.py +1 -1
  12. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/tests/test_persistence.py +35 -26
  13. streamflow_postgresql-0.0.9/MANIFEST.in +0 -6
  14. streamflow_postgresql-0.0.9/bandit-requirements.txt +0 -1
  15. streamflow_postgresql-0.0.9/lint-requirements.txt +0 -5
  16. streamflow_postgresql-0.0.9/requirements.txt +0 -2
  17. streamflow_postgresql-0.0.9/streamflow/plugins/unito/postgresql/version.py +0 -1
  18. streamflow_postgresql-0.0.9/streamflow_postgresql.egg-info/requires.txt +0 -18
  19. streamflow_postgresql-0.0.9/test-requirements.txt +0 -4
  20. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/LICENSE +0 -0
  21. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/README.md +0 -0
  22. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/setup.cfg +0 -0
  23. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/streamflow/plugins/unito/postgresql/__init__.py +0 -0
  24. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/streamflow/plugins/unito/postgresql/plugin.py +0 -0
  25. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/streamflow/plugins/unito/postgresql/schemas/postgresql.json +0 -0
  26. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/streamflow_postgresql.egg-info/dependency_links.txt +0 -0
  27. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/streamflow_postgresql.egg-info/entry_points.txt +0 -0
  28. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/streamflow_postgresql.egg-info/top_level.txt +0 -0
  29. {streamflow_postgresql-0.0.9 → streamflow_postgresql-0.0.11}/streamflow_postgresql.egg-info/zip-safe +0 -0
@@ -0,0 +1,2 @@
1
+ include LICENSE
2
+ include README.md
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamflow-postgresql
3
- Version: 0.0.9
3
+ Version: 0.0.11
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.9
24
+ Requires-Python: >=3.10
25
25
  Description-Content-Type: text/markdown
26
26
  License-File: LICENSE
27
- Requires-Dist: asyncpg==0.30.0
28
- Requires-Dist: streamflow==0.2.0.dev13
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.0rc1
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.9"
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
- dynamic = ["dependencies", "optional-dependencies", "version"]
31
+ dependencies = [
32
+ "asyncpg==0.31.0",
33
+ "streamflow==0.2.0rc1"
34
+ ]
35
+ version = "0.0.11"
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.4"
52
+ ]
53
+ lint = [
54
+ "black==26.3.1",
55
+ "codespell==2.4.2",
56
+ "flake8-bugbear==25.11.29",
57
+ "isort==8.0.1",
58
+ "pyupgrade==3.21.2"
59
+ ]
60
+ test = [
61
+ "cwltest==2.6.20251216093331",
62
+ "pytest==9.0.3",
63
+ "pytest-asyncio==1.3.0",
64
+ "pytest-cov==7.1.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,13 +1,14 @@
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
6
7
  from typing import Any
7
8
 
8
9
  import asyncpg
10
+ from cachebox import cached
9
11
  from streamflow.core import utils
10
- from streamflow.core.asyncache import cachedmethod
11
12
  from streamflow.core.context import StreamFlowContext
12
13
  from streamflow.core.deployment import Target
13
14
  from streamflow.core.persistence import DependencyType
@@ -54,12 +55,17 @@ class PostgreSQLConnectionPool:
54
55
  )
55
56
  async with self._pool.acquire() as conn:
56
57
  async with conn.transaction():
57
- await conn.execute(
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, tag: str, cmd: str) -> 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, tag, cmd) "
162
+ "INSERT INTO execution(step, job_token, cmd) "
157
163
  "VALUES($1, $2, $3) "
158
164
  "RETURNING id",
159
165
  step_id,
160
- tag,
161
- cmd.encode("utf-8"),
166
+ job_token_id,
167
+ cmd,
162
168
  )
163
169
 
164
170
  async def add_filter(
@@ -319,7 +325,7 @@ class PostgreSQLDatabase(CachedDatabase):
319
325
  token_id,
320
326
  )
321
327
 
322
- @cachedmethod(lambda self: self.deployment_cache)
328
+ @cached(cache=lambda self: self.deployment_cache)
323
329
  async def get_deployment(self, deployment_id: int) -> MutableMapping[str, Any]:
324
330
  async with self.pool as pool:
325
331
  async with pool.acquire() as conn:
@@ -362,7 +368,7 @@ class PostgreSQLDatabase(CachedDatabase):
362
368
  for row in rows
363
369
  ]
364
370
 
365
- @cachedmethod(lambda self: self.filter_cache)
371
+ @cached(cache=lambda self: self.filter_cache)
366
372
  async def get_filter(self, filter_id: int) -> MutableMapping[str, Any]:
367
373
  async with self.pool as pool:
368
374
  async with pool.acquire() as conn:
@@ -420,7 +426,7 @@ class PostgreSQLDatabase(CachedDatabase):
420
426
  DependencyType.INPUT.value,
421
427
  )
422
428
 
423
- @cachedmethod(lambda self: self.port_cache)
429
+ @cached(cache=lambda self: self.port_cache)
424
430
  async def get_port(self, port_id: int) -> MutableMapping[str, Any]:
425
431
  async with self.pool as pool:
426
432
  async with pool.acquire() as conn:
@@ -484,7 +490,7 @@ class PostgreSQLDatabase(CachedDatabase):
484
490
  )
485
491
  return list(result.values())
486
492
 
487
- @cachedmethod(lambda self: self.step_cache)
493
+ @cached(cache=lambda self: self.step_cache)
488
494
  async def get_step(self, step_id: int) -> MutableMapping[str, Any]:
489
495
  async with self.pool as pool:
490
496
  async with pool.acquire() as conn:
@@ -494,7 +500,7 @@ class PostgreSQLDatabase(CachedDatabase):
494
500
  )
495
501
  )
496
502
 
497
- @cachedmethod(lambda self: self.target_cache)
503
+ @cached(cache=lambda self: self.target_cache)
498
504
  async def get_target(self, target_id: int) -> MutableMapping[str, Any]:
499
505
  async with self.pool as pool:
500
506
  async with pool.acquire() as conn:
@@ -506,7 +512,7 @@ class PostgreSQLDatabase(CachedDatabase):
506
512
  )
507
513
  )
508
514
 
509
- @cachedmethod(lambda self: self.token_cache)
515
+ @cached(cache=lambda self: self.token_cache)
510
516
  async def get_token(self, token_id: int) -> MutableMapping[str, Any]:
511
517
  async with self.pool as pool:
512
518
  async with pool.acquire() as conn:
@@ -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,
@@ -0,0 +1,3 @@
1
+ from importlib.metadata import version
2
+
3
+ VERSION = version("streamflow-postgresql")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: streamflow-postgresql
3
- Version: 0.0.9
3
+ Version: 0.0.11
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.9
24
+ Requires-Python: >=3.10
25
25
  Description-Content-Type: text/markdown
26
26
  License-File: LICENSE
27
- Requires-Dist: asyncpg==0.30.0
28
- Requires-Dist: streamflow==0.2.0.dev13
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.0rc1
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
@@ -0,0 +1,2 @@
1
+ asyncpg==0.31.0
2
+ streamflow==0.2.0rc1