-
Notifications
You must be signed in to change notification settings - Fork 3
/
run_pipeline.py
69 lines (56 loc) · 1.7 KB
/
run_pipeline.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import os
from codeocean import CodeOcean
from codeocean.computation import RunParams
from codeocean.data_asset import (
DataAssetParams,
DataAssetsRunParam,
PipelineProcessParams,
Source,
ComputationSource,
Target,
AWSS3Target,
)
# Create the client using your domain and API token.
client = CodeOcean(domain=os.environ["CODEOCEAN_URL"], token=os.environ["API_TOKEN"])
# Run a pipeline with ordered parameters.
run_params = RunParams(
pipeline_id=os.environ["PIPELINE_ID"],
data_assets=[
DataAssetsRunParam(
id="eeefcc52-b445-4e3c-80c5-0e65526cd712",
mount="Reference",
),
],
processes=[
PipelineProcessParams(
name="capsule_art_simulation_illumina_1",
parameters=["75", "1", "HS25", "SingleEnded"],
),
PipelineProcessParams(
name="capsule_copy_of_fast_qc_2",
),
],
)
computation = client.computations.run_capsule(run_params)
# Wait for pipeline to finish.
computation = client.computations.wait_until_completed(computation)
# Create an external (S3) data asset from computation results.
data_asset_params = DataAssetParams(
name="My External Result",
description="Computation result",
mount="my-result",
tags=["my", "external", "result"],
source=Source(
computation=ComputationSource(
id=computation.id,
),
),
target=Target(
aws=AWSS3Target(
bucket=os.environ["EXTERNAL_S3_BUCKET"],
prefix=os.environ.get("EXTERNAL_S3_BUCKET_PREFIX"),
),
),
)
data_asset = client.data_assets.create_data_asset(data_asset_params)
data_asset = client.data_assets.wait_until_ready(data_asset)