virtool-workflow 6.0.0a11__tar.gz → 7.0.0__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.
- virtool_workflow-7.0.0/PKG-INFO +76 -0
- virtool_workflow-7.0.0/README.md +49 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/pyproject.toml +27 -14
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/runtime/redis.py +19 -14
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/runtime/run.py +5 -5
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/runtime/run_subprocess.py +32 -8
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/runtime/sentry.py +4 -4
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/utils.py +9 -0
- virtool_workflow-6.0.0a11/PKG-INFO +0 -119
- virtool_workflow-6.0.0a11/README.md +0 -93
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/LICENSE +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/__init__.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/analysis/__init__.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/analysis/fastqc.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/analysis/skewer.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/analysis/trimming.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/analysis/utils.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/api/__init__.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/api/acquire.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/api/client.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/api/utils.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/cli.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/data/__init__.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/data/analyses.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/data/hmms.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/data/indexes.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/data/jobs.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/data/ml.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/data/samples.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/data/subtractions.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/data/uploads.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/decorators.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/errors.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/files.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/hooks.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/pytest_plugin/__init__.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/pytest_plugin/data.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/pytest_plugin/utils.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/runtime/__init__.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/runtime/config.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/runtime/discover.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/runtime/events.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/runtime/hook.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/runtime/path.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/runtime/ping.py +0 -0
- {virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/workflow.py +0 -0
@@ -0,0 +1,76 @@
|
|
1
|
+
Metadata-Version: 2.1
|
2
|
+
Name: virtool-workflow
|
3
|
+
Version: 7.0.0
|
4
|
+
Summary: A framework for developing bioinformatics workflows for Virtool.
|
5
|
+
Home-page: https://github.com/virtool/virtool-workflow
|
6
|
+
License: MIT
|
7
|
+
Author: Ian Boyes
|
8
|
+
Maintainer: Ian Boyes
|
9
|
+
Requires-Python: >=3.10,<3.13
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
15
|
+
Requires-Dist: aiofiles (>=0.7.0,<0.8.0)
|
16
|
+
Requires-Dist: aiohttp (>=3.8.1,<4.0.0)
|
17
|
+
Requires-Dist: biopython (>=1.81,<2.0)
|
18
|
+
Requires-Dist: click (>=8.1.7,<9.0.0)
|
19
|
+
Requires-Dist: orjson (>=3.9.9,<4.0.0)
|
20
|
+
Requires-Dist: pydantic-factories (>=1.17.3,<2.0.0)
|
21
|
+
Requires-Dist: pyfixtures (>=1.0.0,<2.0.0)
|
22
|
+
Requires-Dist: sentry-sdk (>=2.3.1,<3.0.0)
|
23
|
+
Requires-Dist: virtool-core (>=12.0.0,<13.0.0)
|
24
|
+
Project-URL: Repository, https://github.com/virtool/virtool-workflow
|
25
|
+
Description-Content-Type: text/markdown
|
26
|
+
|
27
|
+
# Virtool Workflow
|
28
|
+
|
29
|
+

|
30
|
+
[](https://badge.fury.io/py/virtool-workflow)
|
31
|
+
|
32
|
+
A framework for developing bioinformatic workflows in Python.
|
33
|
+
|
34
|
+
```python
|
35
|
+
from virtool_workflow import step
|
36
|
+
|
37
|
+
|
38
|
+
@step
|
39
|
+
def step_function():
|
40
|
+
...
|
41
|
+
|
42
|
+
|
43
|
+
@step
|
44
|
+
def step_function_2():
|
45
|
+
...
|
46
|
+
```
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
### Commits
|
51
|
+
|
52
|
+
We require specific commit formatting. Any commit that does not follow the guidelines
|
53
|
+
will be squashed at our discretion.
|
54
|
+
|
55
|
+
Read our [commit and release](https://dev.virtool.ca/en/latest/commits_releases.html)
|
56
|
+
documentation for more information.
|
57
|
+
|
58
|
+
### Tests
|
59
|
+
|
60
|
+
Run tests with:
|
61
|
+
|
62
|
+
```shell
|
63
|
+
# Bring up Redis and the test container.
|
64
|
+
docker compose up -d
|
65
|
+
|
66
|
+
# Run tests in the test container.
|
67
|
+
docker compose exec test poetry run pytest
|
68
|
+
|
69
|
+
```
|
70
|
+
|
71
|
+
Run specific tests like:
|
72
|
+
|
73
|
+
```shell
|
74
|
+
docker compose exec test poetry run pytest tests/test_status.py
|
75
|
+
```
|
76
|
+
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# Virtool Workflow
|
2
|
+
|
3
|
+

|
4
|
+
[](https://badge.fury.io/py/virtool-workflow)
|
5
|
+
|
6
|
+
A framework for developing bioinformatic workflows in Python.
|
7
|
+
|
8
|
+
```python
|
9
|
+
from virtool_workflow import step
|
10
|
+
|
11
|
+
|
12
|
+
@step
|
13
|
+
def step_function():
|
14
|
+
...
|
15
|
+
|
16
|
+
|
17
|
+
@step
|
18
|
+
def step_function_2():
|
19
|
+
...
|
20
|
+
```
|
21
|
+
|
22
|
+
## Contributing
|
23
|
+
|
24
|
+
### Commits
|
25
|
+
|
26
|
+
We require specific commit formatting. Any commit that does not follow the guidelines
|
27
|
+
will be squashed at our discretion.
|
28
|
+
|
29
|
+
Read our [commit and release](https://dev.virtool.ca/en/latest/commits_releases.html)
|
30
|
+
documentation for more information.
|
31
|
+
|
32
|
+
### Tests
|
33
|
+
|
34
|
+
Run tests with:
|
35
|
+
|
36
|
+
```shell
|
37
|
+
# Bring up Redis and the test container.
|
38
|
+
docker compose up -d
|
39
|
+
|
40
|
+
# Run tests in the test container.
|
41
|
+
docker compose exec test poetry run pytest
|
42
|
+
|
43
|
+
```
|
44
|
+
|
45
|
+
Run specific tests like:
|
46
|
+
|
47
|
+
```shell
|
48
|
+
docker compose exec test poetry run pytest tests/test_status.py
|
49
|
+
```
|
@@ -1,32 +1,44 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "virtool-workflow"
|
3
|
-
version = "
|
3
|
+
version = "7.0.0"
|
4
4
|
description = "A framework for developing bioinformatics workflows for Virtool."
|
5
|
-
authors = [
|
5
|
+
authors = [
|
6
|
+
"Ian Boyes",
|
7
|
+
"Blake Smith",
|
8
|
+
"Ryan Fang",
|
9
|
+
"Matt Curtis",
|
10
|
+
"Aman Monga",
|
11
|
+
"Bryce Davidson",
|
12
|
+
"Christine Wong Chong",
|
13
|
+
"Lilly Roberts",
|
14
|
+
"Markus Swoveland",
|
15
|
+
"Ryan Fang",
|
16
|
+
]
|
6
17
|
license = "MIT"
|
18
|
+
maintainers = [
|
19
|
+
"Ian Boyes",
|
20
|
+
"Reece Hoffman"
|
21
|
+
]
|
7
22
|
readme = "README.md"
|
8
23
|
repository = "https://github.com/virtool/virtool-workflow"
|
9
24
|
classifiers = [
|
10
|
-
"
|
11
|
-
"Programming Language :: Python :: 3.10"
|
25
|
+
"Programming Language :: Python :: 3.12",
|
12
26
|
]
|
13
27
|
packages = [
|
14
28
|
{ include = "virtool_workflow" },
|
15
29
|
]
|
16
30
|
|
17
31
|
[tool.poetry.dependencies]
|
18
|
-
python = "
|
19
|
-
click = "^8.1.7"
|
20
|
-
aiohttp = "^3.8.1"
|
32
|
+
python = "^3.10,<3.13"
|
21
33
|
aiofiles = "^0.7.0"
|
22
|
-
|
23
|
-
aioredis = "1.3.1"
|
24
|
-
sentry-sdk = "^1.5.7"
|
25
|
-
pyfixtures = "^1.0.0"
|
26
|
-
orjson = "^3.9.9"
|
34
|
+
aiohttp = "^3.8.1"
|
27
35
|
biopython = "^1.81"
|
36
|
+
click = "^8.1.7"
|
37
|
+
orjson = "^3.9.9"
|
28
38
|
pydantic-factories = "^1.17.3"
|
29
|
-
|
39
|
+
pyfixtures = "^1.0.0"
|
40
|
+
sentry-sdk = "^2.3.1"
|
41
|
+
virtool-core = "^12.0.0"
|
30
42
|
|
31
43
|
[tool.poetry.scripts]
|
32
44
|
run-workflow = "virtool_workflow.cli:cli_main"
|
@@ -36,13 +48,14 @@ pytest = "^7.4.2"
|
|
36
48
|
pytest-aiohttp = "^1.0.0"
|
37
49
|
pytest-asyncio = "^0.21.0"
|
38
50
|
pytest-mock = "^3.10.0"
|
39
|
-
pre-commit = "^2.18.1"
|
40
51
|
sphinx = "^4.0.2"
|
41
52
|
syrupy = "^3.0.5"
|
42
53
|
sphinx-autobuild = "^2021.3.14"
|
43
54
|
sphinx-nameko-theme = "^0.0.3"
|
44
55
|
pytest-structlog = "^0.6"
|
45
56
|
sphinx-toolbox = "^3.5.0"
|
57
|
+
ruff = "^0.4.6"
|
58
|
+
piccolo-theme = "^0.22.0"
|
46
59
|
|
47
60
|
[tool.pytest.ini_options]
|
48
61
|
asyncio_mode = "auto"
|
@@ -2,8 +2,8 @@ import asyncio
|
|
2
2
|
from asyncio import CancelledError
|
3
3
|
from typing import Callable
|
4
4
|
|
5
|
-
from aioredis import Redis
|
6
5
|
from structlog import get_logger
|
6
|
+
from virtool_core.redis import Redis
|
7
7
|
|
8
8
|
logger = get_logger("redis")
|
9
9
|
|
@@ -11,10 +11,11 @@ CANCELLATION_CHANNEL = "channel:cancel"
|
|
11
11
|
|
12
12
|
|
13
13
|
async def get_next_job_with_timeout(
|
14
|
-
list_name: str,
|
14
|
+
list_name: str,
|
15
|
+
redis: Redis,
|
16
|
+
timeout: int | None = None,
|
15
17
|
) -> str:
|
16
|
-
"""
|
17
|
-
Get the next job ID from a Redis list and raise a :class:``Timeout`` error if one
|
18
|
+
"""Get the next job ID from a Redis list and raise a :class:``Timeout`` error if one
|
18
19
|
is not found in ``timeout`` seconds.
|
19
20
|
|
20
21
|
:param list_name: the name of the list to pop from
|
@@ -24,35 +25,39 @@ async def get_next_job_with_timeout(
|
|
24
25
|
|
25
26
|
"""
|
26
27
|
logger.info(
|
27
|
-
"Waiting for a job",
|
28
|
+
"Waiting for a job",
|
29
|
+
timeout=f"{timeout if timeout else 'infinity'} seconds",
|
28
30
|
)
|
29
31
|
|
30
32
|
return await asyncio.wait_for(get_next_job(list_name, redis), timeout)
|
31
33
|
|
32
34
|
|
33
35
|
async def get_next_job(list_name: str, redis: Redis) -> str:
|
34
|
-
"""
|
35
|
-
Get the next job ID from a Redis list.
|
36
|
+
"""Get the next job ID from a Redis list.
|
36
37
|
|
37
38
|
:param list_name: the name of the list to pop from
|
38
39
|
:param redis: the Redis client
|
39
40
|
:return: the next job ID
|
40
41
|
|
41
42
|
"""
|
42
|
-
|
43
|
-
|
44
|
-
if result is not None:
|
45
|
-
job_id = str(result[1], encoding="utf-8")
|
43
|
+
if (job_id := await redis.blpop(list_name)) is not None:
|
46
44
|
logger.info("pulled job id from redis", id=job_id)
|
47
45
|
return job_id
|
48
46
|
|
47
|
+
raise ValueError("Unexpected None from job id list")
|
48
|
+
|
49
49
|
|
50
50
|
async def wait_for_cancellation(redis: Redis, job_id: str, func: Callable):
|
51
|
-
|
51
|
+
"""Call a function ``func`` when a job matching ``job_id`` is cancelled.
|
52
52
|
|
53
|
+
:param redis: the Redis client
|
54
|
+
:param job_id: the job ID to watch for
|
55
|
+
:param func: the function to call when the job is cancelled
|
56
|
+
|
57
|
+
"""
|
53
58
|
try:
|
54
|
-
async for cancelled_job_id in
|
55
|
-
if cancelled_job_id
|
59
|
+
async for cancelled_job_id in redis.subscribe(CANCELLATION_CHANNEL):
|
60
|
+
if cancelled_job_id == job_id:
|
56
61
|
return func()
|
57
62
|
|
58
63
|
except CancelledError:
|
@@ -6,12 +6,11 @@ from asyncio import CancelledError
|
|
6
6
|
from pathlib import Path
|
7
7
|
from typing import Callable
|
8
8
|
|
9
|
-
import pkg_resources
|
10
9
|
import structlog
|
11
10
|
from pyfixtures import FixtureScope, runs_in_new_fixture_context
|
12
11
|
from structlog import get_logger
|
13
12
|
from virtool_core.models.job import JobState
|
14
|
-
from virtool_core.redis import
|
13
|
+
from virtool_core.redis import Redis
|
15
14
|
|
16
15
|
from virtool_workflow.api.acquire import acquire_job_by_id
|
17
16
|
from virtool_workflow.api.client import api_client
|
@@ -42,6 +41,7 @@ from virtool_workflow.runtime.redis import (
|
|
42
41
|
wait_for_cancellation,
|
43
42
|
)
|
44
43
|
from virtool_workflow.runtime.sentry import configure_sentry
|
44
|
+
from virtool_workflow.utils import get_virtool_workflow_version
|
45
45
|
from virtool_workflow.workflow import Workflow
|
46
46
|
|
47
47
|
logger = get_logger("runtime")
|
@@ -229,7 +229,7 @@ async def start_runtime(
|
|
229
229
|
|
230
230
|
logger.info(
|
231
231
|
"found virtool-workflow",
|
232
|
-
version=
|
232
|
+
version=get_virtool_workflow_version(),
|
233
233
|
)
|
234
234
|
|
235
235
|
workflow = workflow_loader()
|
@@ -239,7 +239,7 @@ async def start_runtime(
|
|
239
239
|
|
240
240
|
configure_sentry(sentry_dsn)
|
241
241
|
|
242
|
-
async with
|
242
|
+
async with Redis(redis_connection_string) as redis:
|
243
243
|
try:
|
244
244
|
job_id = await get_next_job_with_timeout(redis_list_name, redis, timeout)
|
245
245
|
except asyncio.TimeoutError:
|
@@ -277,7 +277,7 @@ async def start_runtime(
|
|
277
277
|
events.cancelled.set()
|
278
278
|
run_workflow_task.cancel()
|
279
279
|
|
280
|
-
async with
|
280
|
+
async with Redis(redis_connection_string) as redis:
|
281
281
|
cancellation_task = asyncio.create_task(
|
282
282
|
wait_for_cancellation(redis, job_id, cancel_workflow),
|
283
283
|
)
|
{virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/runtime/run_subprocess.py
RENAMED
@@ -2,7 +2,7 @@
|
|
2
2
|
import asyncio
|
3
3
|
from asyncio.subprocess import Process
|
4
4
|
from pathlib import Path
|
5
|
-
from typing import
|
5
|
+
from typing import Callable, Coroutine, Protocol
|
6
6
|
|
7
7
|
from pyfixtures import fixture
|
8
8
|
from structlog import get_logger
|
@@ -14,7 +14,7 @@ logger = get_logger("subprocess")
|
|
14
14
|
|
15
15
|
|
16
16
|
class LineOutputHandler(Protocol):
|
17
|
-
async def __call__(self, line:
|
17
|
+
async def __call__(self, line: bytes):
|
18
18
|
"""Handle input from stdin, or stderr, line by line.
|
19
19
|
|
20
20
|
:param line: A line of output from the stream.
|
@@ -45,7 +45,8 @@ class RunSubprocess(Protocol):
|
|
45
45
|
|
46
46
|
|
47
47
|
async def watch_pipe(
|
48
|
-
stream: asyncio.StreamReader,
|
48
|
+
stream: asyncio.StreamReader,
|
49
|
+
handler: LineOutputHandler,
|
49
50
|
):
|
50
51
|
"""Watch the stdout or stderr stream and pass lines to the `handler` callback function.
|
51
52
|
|
@@ -62,6 +63,21 @@ async def watch_pipe(
|
|
62
63
|
await handler(line)
|
63
64
|
|
64
65
|
|
66
|
+
def stderr_logger(line: bytes):
|
67
|
+
"""Log a line of stderr output and try to decode it as UTF-8.
|
68
|
+
|
69
|
+
If the line is not decodable, log it as a string.
|
70
|
+
|
71
|
+
:param line: a line of stderr output
|
72
|
+
"""
|
73
|
+
line = line.rstrip()
|
74
|
+
|
75
|
+
try:
|
76
|
+
logger.info("stderr", line=line.decode())
|
77
|
+
except UnicodeDecodeError:
|
78
|
+
logger.info("stderr", line=line)
|
79
|
+
|
80
|
+
|
65
81
|
async def _run_subprocess(
|
66
82
|
command: list[str],
|
67
83
|
stdout_handler: LineOutputHandler | None = None,
|
@@ -75,12 +91,17 @@ async def _run_subprocess(
|
|
75
91
|
|
76
92
|
stdout = asyncio.subprocess.PIPE if stdout_handler else asyncio.subprocess.DEVNULL
|
77
93
|
|
78
|
-
|
79
|
-
logger.info("stderr", line=line.rstrip())
|
94
|
+
if stderr_handler:
|
80
95
|
|
81
|
-
|
96
|
+
async def _stderr_handler(line):
|
97
|
+
stderr_logger(line)
|
82
98
|
await stderr_handler(line)
|
83
99
|
|
100
|
+
else:
|
101
|
+
|
102
|
+
async def _stderr_handler(line):
|
103
|
+
stderr_logger(line)
|
104
|
+
|
84
105
|
process = await asyncio.create_subprocess_exec(
|
85
106
|
*(str(arg) for arg in command),
|
86
107
|
cwd=cwd,
|
@@ -106,9 +127,12 @@ async def _run_subprocess(
|
|
106
127
|
|
107
128
|
process.terminate()
|
108
129
|
|
109
|
-
# Have to do this to avoid Event loop closed error.
|
130
|
+
# Have to do this in Python 3.10 to avoid Event loop closed error.
|
110
131
|
# https://github.com/python/cpython/issues/88050
|
111
|
-
|
132
|
+
try:
|
133
|
+
process._transport.close()
|
134
|
+
except AttributeError:
|
135
|
+
pass
|
112
136
|
|
113
137
|
await process.wait()
|
114
138
|
logger.info("subprocess exited", code=process.returncode)
|
@@ -1,16 +1,16 @@
|
|
1
1
|
import logging
|
2
2
|
|
3
|
-
import pkg_resources
|
4
3
|
import sentry_sdk
|
5
4
|
from sentry_sdk.integrations.logging import LoggingIntegration
|
6
5
|
from structlog import get_logger
|
7
6
|
|
7
|
+
from virtool_workflow.utils import get_virtool_workflow_version
|
8
|
+
|
8
9
|
logger = get_logger("runtime")
|
9
10
|
|
10
11
|
|
11
12
|
def configure_sentry(dsn: str):
|
12
|
-
"""Initialize Sentry for log aggregation.
|
13
|
-
"""
|
13
|
+
"""Initialize Sentry for log aggregation."""
|
14
14
|
if dsn:
|
15
15
|
logger.info("initializing sentry", dsn=f"{dsn[:15]}...")
|
16
16
|
|
@@ -21,7 +21,7 @@ def configure_sentry(dsn: str):
|
|
21
21
|
event_level=logging.WARNING,
|
22
22
|
),
|
23
23
|
],
|
24
|
-
release=
|
24
|
+
release=get_virtool_workflow_version(),
|
25
25
|
traces_sample_rate=0.2,
|
26
26
|
)
|
27
27
|
else:
|
@@ -2,6 +2,7 @@ import asyncio
|
|
2
2
|
import tarfile
|
3
3
|
from collections.abc import Callable
|
4
4
|
from functools import wraps
|
5
|
+
from importlib import metadata
|
5
6
|
from inspect import iscoroutinefunction
|
6
7
|
from pathlib import Path
|
7
8
|
|
@@ -18,6 +19,14 @@ def coerce_to_coroutine_function(func: Callable):
|
|
18
19
|
return _func
|
19
20
|
|
20
21
|
|
22
|
+
def get_virtool_workflow_version() -> str:
|
23
|
+
"""Get the version of the installed virtool-workflow package."""
|
24
|
+
try:
|
25
|
+
return metadata.version("virtool-workflow")
|
26
|
+
except metadata.PackageNotFoundError:
|
27
|
+
return "0.0.0"
|
28
|
+
|
29
|
+
|
21
30
|
async def make_directory(path: Path):
|
22
31
|
await asyncio.to_thread(path.mkdir, exist_ok=True, parents=True)
|
23
32
|
|
@@ -1,119 +0,0 @@
|
|
1
|
-
Metadata-Version: 2.1
|
2
|
-
Name: virtool-workflow
|
3
|
-
Version: 6.0.0a11
|
4
|
-
Summary: A framework for developing bioinformatics workflows for Virtool.
|
5
|
-
Home-page: https://github.com/virtool/virtool-workflow
|
6
|
-
License: MIT
|
7
|
-
Author: Ian Boyes
|
8
|
-
Requires-Python: >=3.10,<3.11
|
9
|
-
Classifier: License :: OSI Approved :: MIT License
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
11
|
-
Classifier: Programming Language :: Python :: 3.10
|
12
|
-
Classifier: Topic :: Software Development :: Libraries
|
13
|
-
Requires-Dist: aiofiles (>=0.7.0,<0.8.0)
|
14
|
-
Requires-Dist: aiohttp (>=3.8.1,<4.0.0)
|
15
|
-
Requires-Dist: aioredis (==1.3.1)
|
16
|
-
Requires-Dist: biopython (>=1.81,<2.0)
|
17
|
-
Requires-Dist: click (>=8.1.7,<9.0.0)
|
18
|
-
Requires-Dist: orjson (>=3.9.9,<4.0.0)
|
19
|
-
Requires-Dist: pydantic-factories (>=1.17.3,<2.0.0)
|
20
|
-
Requires-Dist: pyfixtures (>=1.0.0,<2.0.0)
|
21
|
-
Requires-Dist: sentry-sdk (>=1.5.7,<2.0.0)
|
22
|
-
Requires-Dist: virtool-core (>=11.0.0,<12.0.0)
|
23
|
-
Project-URL: Repository, https://github.com/virtool/virtool-workflow
|
24
|
-
Description-Content-Type: text/markdown
|
25
|
-
|
26
|
-
# Virtool Workflow
|
27
|
-
|
28
|
-

|
29
|
-
[](https://badge.fury.io/py/virtool-workflow)
|
30
|
-
|
31
|
-
A framework for developing bioinformatic workflows in Python.
|
32
|
-
|
33
|
-
```python
|
34
|
-
from virtool_workflow import step
|
35
|
-
|
36
|
-
|
37
|
-
@step
|
38
|
-
def step_function():
|
39
|
-
...
|
40
|
-
|
41
|
-
|
42
|
-
@step
|
43
|
-
def step_function_2():
|
44
|
-
...
|
45
|
-
```
|
46
|
-
|
47
|
-
- [Documentation](https://workflow.virtool.ca)
|
48
|
-
- [Website](https://www.virtool.ca/)
|
49
|
-
|
50
|
-
## Contributing
|
51
|
-
|
52
|
-
### Commits
|
53
|
-
|
54
|
-
All commits must follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) specification.
|
55
|
-
|
56
|
-
These standardized commit messages are used to automatically publish releases using [`semantic-release`](https://semantic-release.gitbook.io/semantic-release)
|
57
|
-
after commits are merged to `main` from successful PRs.
|
58
|
-
|
59
|
-
**Example**
|
60
|
-
|
61
|
-
```text
|
62
|
-
feat: add API support for assigning labels to existing samples
|
63
|
-
```
|
64
|
-
|
65
|
-
Descriptive bodies and footers are required where necessary to describe the impact of the commit. Use bullets where appropriate.
|
66
|
-
|
67
|
-
Additional Requirements
|
68
|
-
|
69
|
-
1. **Write in the imperative**. For example, _"fix bug"_, not _"fixed bug"_ or _"fixes bug"_.
|
70
|
-
2. **Don't refer to issues or code reviews**. For example, don't write something like this: _"make style changes requested in review"_.
|
71
|
-
Instead, _"update styles to improve accessibility"_.
|
72
|
-
3. **Commits are not your personal journal**. For example, don't write something like this: _"got server running again"_
|
73
|
-
or _"oops. fixed my code smell"_.
|
74
|
-
|
75
|
-
From Tim Pope: [A Note About Git Commit Messages](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
76
|
-
|
77
|
-
### Tests
|
78
|
-
|
79
|
-
[Pytest](https://docs.pytest.org/en/7.1.x/ "Pytest") is used to implement unit
|
80
|
-
and integration tests.
|
81
|
-
|
82
|
-
A pytest plugin,
|
83
|
-
[pytest-docker-compose](https://github.com/pytest-docker-compose/pytest-docker-compose)
|
84
|
-
handles starting and stopping any required external services for integration
|
85
|
-
tests. [docker-compose](https://docs.docker.com/compose/) will need to be
|
86
|
-
installed on your system for this to work. It might also be necessary to setup a
|
87
|
-
`docker` user group on your system, so you can [use docker without
|
88
|
-
sudo](https://linoxide.com/use-docker-without-sudo-ubuntu/).
|
89
|
-
|
90
|
-
`virtool-workflow` depends on some external bioinformatics tools such as [Bowtie
|
91
|
-
2](http://bowtie-bio.sourceforge.net/bowtie2/index.shtml),
|
92
|
-
[FastQC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/), and
|
93
|
-
[Skewer](https://github.com/relipmoc/skewer). Installation of these tools can be
|
94
|
-
somewhat involved, so it's best to run the test suite using `docker`. The
|
95
|
-
[virtool/workflow-tools](https://github.com/virtool/workflow-tools) image
|
96
|
-
provides a base with all of the external dependencies pre-installed.
|
97
|
-
|
98
|
-
[./tests/docker-compose.yml](./tests/docker-compose.yml) will run the test suite
|
99
|
-
inside a container based on
|
100
|
-
[virtool/workflow-tools](https://github.com/virtool/workflow-tools) and mount
|
101
|
-
the local docker socket so that `pytest`, running inside the container, can
|
102
|
-
manage the other services required by the integration tests.
|
103
|
-
|
104
|
-
To run the entire test suite:
|
105
|
-
|
106
|
-
```sh
|
107
|
-
cd tests
|
108
|
-
docker-compose up --exit-code-from pytest
|
109
|
-
```
|
110
|
-
|
111
|
-
To run a subset of the tests, `tests/integration` only for example:
|
112
|
-
|
113
|
-
```sh
|
114
|
-
cd tests
|
115
|
-
TEST_PATH=tests/integration docker-compose up --exit-code-from pytest
|
116
|
-
```
|
117
|
-
|
118
|
-
:warning: The `TEST_PATH` is a relative path from the repository root, not the `tests` directory.
|
119
|
-
|
@@ -1,93 +0,0 @@
|
|
1
|
-
# Virtool Workflow
|
2
|
-
|
3
|
-

|
4
|
-
[](https://badge.fury.io/py/virtool-workflow)
|
5
|
-
|
6
|
-
A framework for developing bioinformatic workflows in Python.
|
7
|
-
|
8
|
-
```python
|
9
|
-
from virtool_workflow import step
|
10
|
-
|
11
|
-
|
12
|
-
@step
|
13
|
-
def step_function():
|
14
|
-
...
|
15
|
-
|
16
|
-
|
17
|
-
@step
|
18
|
-
def step_function_2():
|
19
|
-
...
|
20
|
-
```
|
21
|
-
|
22
|
-
- [Documentation](https://workflow.virtool.ca)
|
23
|
-
- [Website](https://www.virtool.ca/)
|
24
|
-
|
25
|
-
## Contributing
|
26
|
-
|
27
|
-
### Commits
|
28
|
-
|
29
|
-
All commits must follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) specification.
|
30
|
-
|
31
|
-
These standardized commit messages are used to automatically publish releases using [`semantic-release`](https://semantic-release.gitbook.io/semantic-release)
|
32
|
-
after commits are merged to `main` from successful PRs.
|
33
|
-
|
34
|
-
**Example**
|
35
|
-
|
36
|
-
```text
|
37
|
-
feat: add API support for assigning labels to existing samples
|
38
|
-
```
|
39
|
-
|
40
|
-
Descriptive bodies and footers are required where necessary to describe the impact of the commit. Use bullets where appropriate.
|
41
|
-
|
42
|
-
Additional Requirements
|
43
|
-
|
44
|
-
1. **Write in the imperative**. For example, _"fix bug"_, not _"fixed bug"_ or _"fixes bug"_.
|
45
|
-
2. **Don't refer to issues or code reviews**. For example, don't write something like this: _"make style changes requested in review"_.
|
46
|
-
Instead, _"update styles to improve accessibility"_.
|
47
|
-
3. **Commits are not your personal journal**. For example, don't write something like this: _"got server running again"_
|
48
|
-
or _"oops. fixed my code smell"_.
|
49
|
-
|
50
|
-
From Tim Pope: [A Note About Git Commit Messages](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
|
51
|
-
|
52
|
-
### Tests
|
53
|
-
|
54
|
-
[Pytest](https://docs.pytest.org/en/7.1.x/ "Pytest") is used to implement unit
|
55
|
-
and integration tests.
|
56
|
-
|
57
|
-
A pytest plugin,
|
58
|
-
[pytest-docker-compose](https://github.com/pytest-docker-compose/pytest-docker-compose)
|
59
|
-
handles starting and stopping any required external services for integration
|
60
|
-
tests. [docker-compose](https://docs.docker.com/compose/) will need to be
|
61
|
-
installed on your system for this to work. It might also be necessary to setup a
|
62
|
-
`docker` user group on your system, so you can [use docker without
|
63
|
-
sudo](https://linoxide.com/use-docker-without-sudo-ubuntu/).
|
64
|
-
|
65
|
-
`virtool-workflow` depends on some external bioinformatics tools such as [Bowtie
|
66
|
-
2](http://bowtie-bio.sourceforge.net/bowtie2/index.shtml),
|
67
|
-
[FastQC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/), and
|
68
|
-
[Skewer](https://github.com/relipmoc/skewer). Installation of these tools can be
|
69
|
-
somewhat involved, so it's best to run the test suite using `docker`. The
|
70
|
-
[virtool/workflow-tools](https://github.com/virtool/workflow-tools) image
|
71
|
-
provides a base with all of the external dependencies pre-installed.
|
72
|
-
|
73
|
-
[./tests/docker-compose.yml](./tests/docker-compose.yml) will run the test suite
|
74
|
-
inside a container based on
|
75
|
-
[virtool/workflow-tools](https://github.com/virtool/workflow-tools) and mount
|
76
|
-
the local docker socket so that `pytest`, running inside the container, can
|
77
|
-
manage the other services required by the integration tests.
|
78
|
-
|
79
|
-
To run the entire test suite:
|
80
|
-
|
81
|
-
```sh
|
82
|
-
cd tests
|
83
|
-
docker-compose up --exit-code-from pytest
|
84
|
-
```
|
85
|
-
|
86
|
-
To run a subset of the tests, `tests/integration` only for example:
|
87
|
-
|
88
|
-
```sh
|
89
|
-
cd tests
|
90
|
-
TEST_PATH=tests/integration docker-compose up --exit-code-from pytest
|
91
|
-
```
|
92
|
-
|
93
|
-
:warning: The `TEST_PATH` is a relative path from the repository root, not the `tests` directory.
|
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
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/pytest_plugin/__init__.py
RENAMED
File without changes
|
File without changes
|
{virtool_workflow-6.0.0a11 → virtool_workflow-7.0.0}/virtool_workflow/pytest_plugin/utils.py
RENAMED
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
|