-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
108 additions
and
68 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import asyncio | ||
|
||
from _pytest._py.path import LocalPath | ||
from aioredis import Redis | ||
|
||
from tests.fixtures.data import Data | ||
from virtool_workflow.runtime.run_subprocess import watch_pipe | ||
|
||
|
||
async def test_cmd( | ||
data: Data, | ||
jobs_api_connection_string: str, | ||
redis: Redis, | ||
redis_connection_string: str, | ||
tmp_path: LocalPath, | ||
): | ||
data.job.args.update( | ||
{ | ||
"files": [ | ||
{ | ||
"id": 1, | ||
"name": "reads_1.fq.gz", | ||
"size": 100, | ||
}, | ||
{ | ||
"id": 2, | ||
"name": "reads_2.fq.gz", | ||
"size": 100, | ||
}, | ||
], | ||
"sample_id": data.new_sample.id, | ||
} | ||
) | ||
|
||
await redis.rpush("job_test", "test_job") | ||
|
||
p = await asyncio.create_subprocess_exec( | ||
"poetry", | ||
"run", | ||
"run-workflow", | ||
"--jobs-api-connection-string", | ||
jobs_api_connection_string, | ||
"--redis-connection-string", | ||
redis_connection_string, | ||
"--redis-list-name", | ||
"job_test", | ||
"--work-path", | ||
str(tmp_path), | ||
limit=1024 * 1024 * 128, | ||
stderr=asyncio.subprocess.PIPE, | ||
stdout=asyncio.subprocess.PIPE, | ||
) | ||
|
||
async def handler(line): | ||
print(line.decode().rstrip()) | ||
|
||
g = asyncio.gather( | ||
watch_pipe(p.stderr, handler), | ||
watch_pipe(p.stdout, handler), | ||
) | ||
|
||
await p.wait() | ||
await p.communicate() | ||
await g |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""An example workflow.""" | ||
import asyncio | ||
from pathlib import Path | ||
|
||
from virtool_workflow import step | ||
from virtool_workflow.analysis.fastqc import FastQCRunner | ||
from virtool_workflow.data.samples import WFNewSample | ||
|
||
|
||
@step | ||
async def step_1(): | ||
"""A basic step that doesn't actually do anything.""" | ||
await asyncio.sleep(1) | ||
|
||
|
||
@step | ||
async def try_fastqc(fastqc: FastQCRunner, new_sample: WFNewSample, work_path: Path): | ||
"""Make sure the FastQC fixture works in a real workflow run.""" | ||
paths = [u.path for u in new_sample.uploads] | ||
await fastqc(paths, work_path / "reads") |