virtool-workflow 5.2.1__tar.gz → 5.3.1__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-5.2.1 → virtool_workflow-5.3.1}/PKG-INFO +1 -3
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/pyproject.toml +1 -4
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/api/client.py +7 -2
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/api/jobs.py +19 -8
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/runtime/run.py +36 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/runtime/sentry.py +2 -2
- virtool_workflow-5.2.1/setup.py +0 -45
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/LICENSE +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/README.md +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/__init__.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/analysis/__init__.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/analysis/analysis.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/analysis/fastqc.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/analysis/fixtures.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/analysis/hmms.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/analysis/indexes.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/analysis/reads.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/analysis/sample.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/analysis/skewer.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/analysis/subtractions.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/analysis/trimming.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/analysis/utils.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/api/__init__.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/api/analysis.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/api/errors.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/api/hmm.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/api/indexes.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/api/samples.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/api/subtractions.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/api/uploads.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/api/utils.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/builtin_fixtures.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/cli.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/data_model/__init__.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/data_model/analysis.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/data_model/files.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/data_model/indexes.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/data_model/jobs.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/data_model/samples.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/data_model/subtractions.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/decorators.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/errors.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/hooks.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/runtime/__init__.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/runtime/discovery.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/runtime/events.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/runtime/executor.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/runtime/hook.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/runtime/providers.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/runtime/redis.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/runtime/run_subprocess.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/runtime/states.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/runtime/step.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/runtime/utils.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/testing/__init__.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/testing/fixtures.py +0 -0
- {virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/workflow.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: virtool-workflow
|
3
|
-
Version: 5.
|
3
|
+
Version: 5.3.1
|
4
4
|
Summary: A framework for developing bioinformatics workflows for Virtool.
|
5
5
|
Home-page: https://github.com/virtool/virtool-workflow
|
6
6
|
License: MIT
|
@@ -10,9 +10,7 @@ Classifier: License :: OSI Approved :: MIT License
|
|
10
10
|
Classifier: Programming Language :: Python :: 3
|
11
11
|
Classifier: Programming Language :: Python :: 3.10
|
12
12
|
Classifier: Programming Language :: Python :: 3.11
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
14
13
|
Classifier: Topic :: Software Development :: Libraries
|
15
|
-
Provides-Extra: test
|
16
14
|
Requires-Dist: aiofiles (>=0.7.0,<0.8.0)
|
17
15
|
Requires-Dist: aiohttp (>=3.8.1,<4.0.0)
|
18
16
|
Requires-Dist: aioredis (==1.3.1)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[tool.poetry]
|
2
2
|
name = "virtool-workflow"
|
3
|
-
version = "5.
|
3
|
+
version = "5.3.1"
|
4
4
|
description = "A framework for developing bioinformatics workflows for Virtool."
|
5
5
|
authors = ["Ian Boyes", "Blake Smith", "Ryan Fang"]
|
6
6
|
license = "MIT"
|
@@ -24,9 +24,6 @@ aioredis = "1.3.1"
|
|
24
24
|
sentry-sdk = "^1.5.7"
|
25
25
|
pyfixtures = "^1.0.0"
|
26
26
|
|
27
|
-
[tool.poetry.extras]
|
28
|
-
test = ["virtool"]
|
29
|
-
|
30
27
|
[tool.poetry.scripts]
|
31
28
|
run-workflow = "virtool_workflow.cli:cli_main"
|
32
29
|
|
@@ -1,12 +1,17 @@
|
|
1
|
+
from functools import wraps
|
2
|
+
|
1
3
|
import aiohttp
|
2
4
|
from pyfixtures import fixture
|
3
|
-
from functools import wraps
|
4
5
|
|
5
6
|
|
6
7
|
@fixture
|
7
8
|
async def http():
|
8
9
|
""":class:`Aiohttp.ClientSession` instance to be used for workflows."""
|
9
|
-
|
10
|
+
connector = aiohttp.TCPConnector(force_close=True, limit=100)
|
11
|
+
|
12
|
+
async with aiohttp.ClientSession(
|
13
|
+
auto_decompress=False, connector=connector
|
14
|
+
) as session:
|
10
15
|
yield JobApiHttpSession(session)
|
11
16
|
|
12
17
|
|
@@ -65,14 +65,23 @@ def acquire_job(http: ClientSession, jobs_api_connection_string: str):
|
|
65
65
|
|
66
66
|
|
67
67
|
async def ping(http: ClientSession, jobs_api_connection_string: str, job_id: str):
|
68
|
-
|
69
|
-
|
70
|
-
) as response:
|
68
|
+
"""
|
69
|
+
Send a ping to the jobs API to indicate that the job is still running.
|
71
70
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
71
|
+
:param http: An :class:`aiohttp.ClientSession` to use to make the request.
|
72
|
+
:param jobs_api_connection_string: The url for the jobs API.
|
73
|
+
:param job_id: The id of the job to ping.
|
74
|
+
:return: The job.
|
75
|
+
"""
|
76
|
+
print(http)
|
77
|
+
|
78
|
+
async with http.put(f"{jobs_api_connection_string}/jobs/{job_id}/ping") as resp:
|
79
|
+
print(resp.status)
|
80
|
+
print(await resp.text())
|
81
|
+
|
82
|
+
print("PING")
|
83
|
+
|
84
|
+
logger.info("Sent ping")
|
76
85
|
|
77
86
|
|
78
87
|
@fixture(scope="function")
|
@@ -109,8 +118,10 @@ async def _push_status(
|
|
109
118
|
state: str,
|
110
119
|
progress: float,
|
111
120
|
error: Optional[Exception] = None,
|
112
|
-
max_tb: int =
|
121
|
+
max_tb: int = 500,
|
113
122
|
):
|
123
|
+
if error:
|
124
|
+
logger.critical("Reporting error to API", exc_info=error)
|
114
125
|
|
115
126
|
payload = {
|
116
127
|
"state": state,
|
@@ -1,16 +1,19 @@
|
|
1
1
|
import asyncio
|
2
2
|
import signal
|
3
3
|
import sys
|
4
|
+
from asyncio import CancelledError
|
4
5
|
from logging import getLogger
|
5
6
|
from pathlib import Path
|
6
7
|
from typing import Any, Dict
|
7
8
|
|
8
9
|
import pkg_resources
|
10
|
+
from aiohttp import ClientOSError, ServerDisconnectedError
|
9
11
|
from pyfixtures import FixtureScope, runs_in_new_fixture_context
|
10
12
|
from virtool_core.logging import configure_logs
|
11
13
|
from virtool_core.redis import configure_redis
|
12
14
|
|
13
15
|
from virtool_workflow import execute
|
16
|
+
from virtool_workflow.api.jobs import ping
|
14
17
|
from virtool_workflow.hooks import (
|
15
18
|
on_failure,
|
16
19
|
on_cancelled,
|
@@ -83,6 +86,33 @@ def cleanup_builtin_status_hooks():
|
|
83
86
|
on_terminated.clear()
|
84
87
|
|
85
88
|
|
89
|
+
async def ping_periodically(http, job, jobs_api_connection_string, job_id):
|
90
|
+
"""
|
91
|
+
Ping the API to keep the job alive.
|
92
|
+
|
93
|
+
"""
|
94
|
+
retries = 0
|
95
|
+
|
96
|
+
try:
|
97
|
+
while True:
|
98
|
+
if retries > 5:
|
99
|
+
logger.warning("Failed to ping server")
|
100
|
+
break
|
101
|
+
|
102
|
+
await asyncio.sleep(0.1)
|
103
|
+
|
104
|
+
try:
|
105
|
+
await ping(http, jobs_api_connection_string, job_id)
|
106
|
+
except (ClientOSError, ServerDisconnectedError):
|
107
|
+
await asyncio.sleep(0.3)
|
108
|
+
retries += 1
|
109
|
+
continue
|
110
|
+
|
111
|
+
await asyncio.sleep(5)
|
112
|
+
except CancelledError:
|
113
|
+
logger.info("Stopped pinging server")
|
114
|
+
|
115
|
+
|
86
116
|
async def run_workflow(
|
87
117
|
config: Dict[str, Any],
|
88
118
|
job_id: str,
|
@@ -96,13 +126,19 @@ async def run_workflow(
|
|
96
126
|
scope["config"] = config
|
97
127
|
scope["job_id"] = job_id
|
98
128
|
|
129
|
+
bound_ping = await scope.bind(ping_periodically)
|
130
|
+
|
99
131
|
execute_task = asyncio.create_task(execute(workflow, scope, events))
|
132
|
+
ping_task = asyncio.create_task(bound_ping())
|
100
133
|
|
101
134
|
try:
|
102
135
|
await execute_task
|
103
136
|
except asyncio.CancelledError:
|
104
137
|
execute_task.cancel()
|
105
138
|
|
139
|
+
ping_task.cancel()
|
140
|
+
|
141
|
+
await ping_task
|
106
142
|
await execute_task
|
107
143
|
|
108
144
|
cleanup_builtin_status_hooks()
|
@@ -9,7 +9,7 @@ from sentry_sdk.integrations.logging import LoggingIntegration
|
|
9
9
|
logger = getLogger("runtime")
|
10
10
|
|
11
11
|
|
12
|
-
def configure_sentry(dsn: Optional[str]
|
12
|
+
def configure_sentry(dsn: Optional[str]):
|
13
13
|
"""
|
14
14
|
Initialize Sentry for log aggregation.
|
15
15
|
"""
|
@@ -22,7 +22,7 @@ def configure_sentry(dsn: Optional[str], event_level: int = logging.ERROR):
|
|
22
22
|
dsn=dsn,
|
23
23
|
integrations=[
|
24
24
|
LoggingIntegration(
|
25
|
-
event_level=
|
25
|
+
event_level=logging.WARNING,
|
26
26
|
)
|
27
27
|
],
|
28
28
|
release=pkg_resources.get_distribution("virtool-workflow").version,
|
virtool_workflow-5.2.1/setup.py
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# -*- coding: utf-8 -*-
|
2
|
-
from setuptools import setup
|
3
|
-
|
4
|
-
packages = \
|
5
|
-
['virtool_workflow',
|
6
|
-
'virtool_workflow.analysis',
|
7
|
-
'virtool_workflow.api',
|
8
|
-
'virtool_workflow.data_model',
|
9
|
-
'virtool_workflow.runtime',
|
10
|
-
'virtool_workflow.testing']
|
11
|
-
|
12
|
-
package_data = \
|
13
|
-
{'': ['*']}
|
14
|
-
|
15
|
-
install_requires = \
|
16
|
-
['aiofiles>=0.7.0,<0.8.0',
|
17
|
-
'aiohttp>=3.8.1,<4.0.0',
|
18
|
-
'aioredis==1.3.1',
|
19
|
-
'click>=8.0.0,<9.0.0',
|
20
|
-
'pyfixtures>=1.0.0,<2.0.0',
|
21
|
-
'sentry-sdk>=1.5.7,<2.0.0',
|
22
|
-
'virtool-core>=3.0.0,<4.0.0']
|
23
|
-
|
24
|
-
entry_points = \
|
25
|
-
{'console_scripts': ['run-workflow = virtool_workflow.cli:cli_main']}
|
26
|
-
|
27
|
-
setup_kwargs = {
|
28
|
-
'name': 'virtool-workflow',
|
29
|
-
'version': '5.2.1',
|
30
|
-
'description': 'A framework for developing bioinformatics workflows for Virtool.',
|
31
|
-
'long_description': '# Virtool Workflow\n\n\n[](https://badge.fury.io/py/virtool-workflow)\n\nA framework for developing bioinformatic workflows in Python.\n\n```python\nfrom virtool_workflow import step\n\n\n@step\ndef step_function():\n ...\n\n\n@step\ndef step_function_2():\n ...\n```\n\n- [Documentation](https://workflow.virtool.ca)\n- [Website](https://www.virtool.ca/)\n\n## Contributing\n\n### Commits\n\nAll commits must follow the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) specification.\n\nThese standardized commit messages are used to automatically publish releases using [`semantic-release`](https://semantic-release.gitbook.io/semantic-release)\nafter commits are merged to `main` from successful PRs.\n\n**Example**\n\n```text\nfeat: add API support for assigning labels to existing samples\n```\n\nDescriptive bodies and footers are required where necessary to describe the impact of the commit. Use bullets where appropriate.\n\nAdditional Requirements\n\n1. **Write in the imperative**. For example, _"fix bug"_, not _"fixed bug"_ or _"fixes bug"_.\n2. **Don\'t refer to issues or code reviews**. For example, don\'t write something like this: _"make style changes requested in review"_.\n Instead, _"update styles to improve accessibility"_.\n3. **Commits are not your personal journal**. For example, don\'t write something like this: _"got server running again"_\n or _"oops. fixed my code smell"_.\n\nFrom Tim Pope: [A Note About Git Commit Messages](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)\n\n### Poetry\n\nDependencies & virtual environments are managed with [Poetry](https://python-poetry.org/ "Poetry")\n\nTo install `poetry`:\n\n```sh\nsudo pip install poetry\n```\n\nTo install dependencies, and the `virtool-workflow` package, into a virtual environment:\n\n```sh\ngit clone https://github.com/virtool/virtool-workflow\ncd virtool-workflow\n\npoetry install\n```\n\nTo run commands in the virtual environment:\n\n```sh\npoetry run <<command>>\n```\n\n### Tests\n\n[Pytest](https://docs.pytest.org/en/7.1.x/ "Pytest") is used to implement unit\nand integration tests.\n\nA pytest plugin,\n[pytest-docker-compose](https://github.com/pytest-docker-compose/pytest-docker-compose)\nhandles starting and stopping any required external services for integration\ntests. [docker-compose](https://docs.docker.com/compose/) will need to be\ninstalled on your system for this to work. It might also be necessary to setup a\n`docker` user group on your system, so you can [use docker without\nsudo](https://linoxide.com/use-docker-without-sudo-ubuntu/).\n\n`virtool-workflow` depends on some external bioinformatics tools such as [Bowtie\n2](http://bowtie-bio.sourceforge.net/bowtie2/index.shtml),\n[FastQC](https://www.bioinformatics.babraham.ac.uk/projects/fastqc/), and\n[Skewer](https://github.com/relipmoc/skewer). Installation of these tools can be\nsomewhat involved, so it\'s best to run the test suite using `docker`. The\n[virtool/workflow-tools](https://github.com/virtool/workflow-tools) image\nprovides a base with all of the external dependencies pre-installed.\n\n[./tests/docker-compose.yml](./tests/docker-compose.yml) will run the test suite\ninside a container based on\n[virtool/workflow-tools](https://github.com/virtool/workflow-tools) and mount\nthe local docker socket so that `pytest`, running inside the container, can\nmanage the other services required by the integration tests.\n\nTo run the entire test suite:\n\n```sh\ncd tests\ndocker-compose up --exit-code-from pytest\n```\n\nTo run a subset of the tests, `tests/integration` only for example:\n\n```sh\ncd tests\nTEST_PATH=tests/integration docker-compose up --exit-code-from pytest\n```\n\n:warning: The `TEST_PATH` is a relative path from the repository root, not the `tests` directory.\n',
|
32
|
-
'author': 'Ian Boyes',
|
33
|
-
'author_email': 'None',
|
34
|
-
'maintainer': 'None',
|
35
|
-
'maintainer_email': 'None',
|
36
|
-
'url': 'https://github.com/virtool/virtool-workflow',
|
37
|
-
'packages': packages,
|
38
|
-
'package_data': package_data,
|
39
|
-
'install_requires': install_requires,
|
40
|
-
'entry_points': entry_points,
|
41
|
-
'python_requires': '>=3.10,<4.0',
|
42
|
-
}
|
43
|
-
|
44
|
-
|
45
|
-
setup(**setup_kwargs)
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/data_model/subtractions.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
|
File without changes
|
File without changes
|
{virtool_workflow-5.2.1 → virtool_workflow-5.3.1}/virtool_workflow/runtime/run_subprocess.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|