Skip to content

Commit fc88560

Browse files
authored
feat(server): support jobs without rights field
1 parent 3623a90 commit fc88560

22 files changed

+257
-246
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-22.04
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v3
18+
uses: actions/checkout@v4
1919
- name: Commitlint
2020
uses: wagoid/commitlint-github-action@v5
2121
test:
@@ -34,6 +34,10 @@ jobs:
3434
steps:
3535
- name: Checkout
3636
uses: actions/checkout@v4
37+
- name: Setup Python
38+
uses: actions/setup-python@v5
39+
with:
40+
python-version: 3.12.3
3741
- name: Install Poetry
3842
uses: snok/install-poetry@v1
3943
- name: Poetry Build

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Setup Python
1515
uses: actions/setup-python@v5
1616
with:
17-
python-version: '3.12'
17+
python-version: '3.12.3'
1818
- name: Checkout
1919
uses: actions/checkout@v4
2020
- name: Install Poetry

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM python:3.12-bookworm
1+
FROM python:3.12.3-bookworm
22
WORKDIR /test
33
COPY --from=ghcr.io/virtool/workflow-tools:2.0.1 /opt/fastqc /opt/fastqc
44
COPY --from=ghcr.io/virtool/workflow-tools:2.0.1 /opt/hmmer /opt/hmmer

poetry.lock

Lines changed: 56 additions & 98 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ packages = [
2929
]
3030

3131
[tool.poetry.dependencies]
32-
python = "^3.10,<3.13"
32+
python = "~3.12"
3333
aiofiles = "^0.7.0"
3434
aiohttp = "^3.8.1"
3535
biopython = "^1.81"
@@ -38,7 +38,7 @@ orjson = "^3.9.9"
3838
pydantic-factories = "^1.17.3"
3939
pyfixtures = "^1.0.0"
4040
sentry-sdk = "^2.3.1"
41-
virtool-core = "^12.0.0"
41+
virtool-core = "^14.0.0"
4242

4343
[tool.poetry.scripts]
4444
run-workflow = "virtool_workflow.cli:cli_main"
@@ -71,8 +71,14 @@ exclude = [
7171
".ruff_cache",
7272
"__pypackages__",
7373
]
74+
target-version = "py312"
7475

7576
[tool.ruff.lint]
77+
ignore = [
78+
"ANN101",
79+
"D203",
80+
"D213"
81+
]
7682
select = ["ALL"]
7783

7884
[build-system]

tests/data/__snapshots__/test_jobs.ambr

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,21 @@
1313
'pinged_at': datetime.datetime(2020, 1, 1, 1, 1, 1),
1414
}),
1515
'progress': 6380,
16-
'rights': dict({
17-
}),
1816
'stage': 'iPhGgaTklZTpXCJkWJYU',
1917
'state': <JobState.RUNNING: 'running'>,
2018
'status': list([
2119
dict({
2220
'error': dict({
2321
'details': list([
24-
'VCqTDwYzyKtSiEMpnbXp',
22+
'vhVGiBXJqoyUfQBjWTjz',
2523
]),
2624
'traceback': list([
27-
'WhbIXmchuyDmybzRLozZ',
25+
'ACAdPsEbpDIRnZLXrjSy',
2826
]),
29-
'type': 'ASTUagoKFMbsJQgaCJfJ',
27+
'type': 'OqopAJsorWvViTxsrhYk',
3028
}),
31-
'progress': 3132,
32-
'stage': 'aOwDKGzVuuSkpRdRKwoO',
29+
'progress': 5931,
30+
'stage': 'WyJLLiOEIvGOHLbiwHlJ',
3331
'state': <JobState.ERROR: 'error'>,
3432
'step_description': None,
3533
'step_name': None,

tests/data/test_analyses.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
from pyfixtures import FixtureScope
55

66
from virtool_workflow.data.analyses import WFAnalysis
7-
from virtool_workflow.errors import JobsAPIConflict, JobsAPINotFound
7+
from virtool_workflow.errors import JobsAPIConflictError, JobsAPINotFoundError
88
from virtool_workflow.pytest_plugin.data import Data
99

1010

1111
async def test_ok(data: Data, scope: FixtureScope):
12-
"""Test that the analysis fixture returns an Analysis object with the expected values.
13-
"""
12+
"""Test that the analysis fixture returns an Analysis object with the expected values."""
1413
data.job.args["analysis_id"] = data.analysis.id
1514

1615
analysis = await scope.instantiate_by_key("analysis")
@@ -22,12 +21,15 @@ async def test_not_found(data: Data, scope: FixtureScope):
2221
"""Test that JobsAPINotFound is raised if the analysis does not exist."""
2322
data.job.args["analysis_id"] = "not_found"
2423

25-
with pytest.raises(JobsAPINotFound) as err:
24+
with pytest.raises(JobsAPINotFoundError) as err:
2625
await scope.instantiate_by_key("analysis")
2726

2827

2928
async def test_upload_file(
30-
captured_uploads_path: Path, data: Data, scope: FixtureScope, work_path: Path,
29+
captured_uploads_path: Path,
30+
data: Data,
31+
scope: FixtureScope,
32+
work_path: Path,
3133
):
3234
"""Test that the ``Analysis`` object returned by the fixture can be used to upload an
3335
analysis file.
@@ -67,7 +69,7 @@ async def test_delete_finalized(data: Data, scope: FixtureScope):
6769

6870
analysis: WFAnalysis = await scope.instantiate_by_key("analysis")
6971

70-
with pytest.raises(JobsAPIConflict) as err:
72+
with pytest.raises(JobsAPIConflictError) as err:
7173
await analysis.delete()
7274

7375
assert "Analysis is finalized" in str(err)

tests/data/test_indexes.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
from pyfixtures import FixtureScope
55
from syrupy import SnapshotAssertion
66

7-
from virtool_workflow.pytest_plugin.data import Data
87
from virtool_workflow.data.indexes import WFIndex, WFNewIndex
9-
from virtool_workflow.errors import JobsAPINotFound, JobsAPIConflict
8+
from virtool_workflow.errors import JobsAPIConflictError, JobsAPINotFoundError
9+
from virtool_workflow.pytest_plugin.data import Data
1010

1111

1212
class TestIndex:
@@ -18,8 +18,7 @@ async def test_ok(
1818
snapshot: SnapshotAssertion,
1919
work_path: Path,
2020
):
21-
"""
22-
Test that the index fixture instantiates, contains the expected data, and
21+
"""Test that the index fixture instantiates, contains the expected data, and
2322
downloads the index files to the work path.
2423
"""
2524
data.job.args["analysis_id"] = data.analysis.id
@@ -67,14 +66,12 @@ async def test_ok(
6766
work_path / "test.fa",
6867
)
6968

70-
assert open(work_path / "test.fa", "r").read() == snapshot(name="fasta")
69+
assert open(work_path / "test.fa").read() == snapshot(name="fasta")
7170

7271

7372
class TestNewIndex:
7473
async def test_ok(self, data: Data, scope: FixtureScope, work_path: Path):
75-
"""
76-
Test that the ``new_index`` fixture instantiates and contains the expected data.
77-
"""
74+
"""Test that the ``new_index`` fixture instantiates and contains the expected data."""
7875
data.job.args["index_id"] = data.new_index.id
7976

8077
new_index: WFNewIndex = await scope.instantiate_by_key("new_index")
@@ -129,14 +126,17 @@ async def test_upload_and_finalize(
129126
}
130127

131128
async def test_upload_invalid_filename(
132-
self, data: Data, example_path: Path, scope: FixtureScope
129+
self,
130+
data: Data,
131+
example_path: Path,
132+
scope: FixtureScope,
133133
):
134134
"""Test that an invalid filename raises an error."""
135135
data.job.args["index_id"] = data.new_index.id
136136

137137
new_index: WFNewIndex = await scope.instantiate_by_key("new_index")
138138

139-
with pytest.raises(JobsAPINotFound) as err:
139+
with pytest.raises(JobsAPINotFoundError) as err:
140140
await new_index.upload(
141141
example_path / "hmms/annotations.json.gz",
142142
"unknown",
@@ -164,7 +164,7 @@ async def test_finalize_incomplete(
164164
"unknown",
165165
)
166166

167-
with pytest.raises(JobsAPIConflict) as err:
167+
with pytest.raises(JobsAPIConflictError) as err:
168168
await new_index.finalize()
169169

170170
assert (

0 commit comments

Comments
 (0)