5
5
# and it is invoked via the OGC API.
6
6
# The CWL task is executed via a KubernetesPodOperator on a worker node
7
7
# that is dynamically provisioned by Karpenter.
8
+ import json
8
9
from pathlib import Path
9
10
10
11
import backoff
18
19
FEATURE_FILE : Path = FEATURES_DIR / "cwl_workflows_with_ogc_api.feature"
19
20
20
21
# DAG parameters are venue specific
21
- DAG_ID = "cwl_dag"
22
- DATA = {
22
+ CWL_DAG_ID = "cwl_dag"
23
+ CWL_DAG_MODULAR_ID = "cwl_dag_modular"
24
+ CWL_DAG_DATA = {
23
25
"EMIT" : {
24
26
"inputs" : {
25
27
"cwl_workflow" : "http://awslbdockstorestack-lb-1429770210.us-west-2.elb.amazonaws.com:9998/api/ga4gh/trs/v2/tools/%23workflow%2Fdockstore.org%2FGodwinShen%2Femit-ghg/versions/9/plain-CWL/descriptor/workflow.cwl" ,
68
70
},
69
71
}
70
72
73
+ CWL_DAG_MODULAR_DATA = {
74
+ "EMIT" : {
75
+ "inputs" : {
76
+ "cwl_workflow_stage_in" : "https://raw.githubusercontent.com/unity-sds/unity-data-services/refs/heads/cwl-examples/cwl/stage-in-daac/stage-in.cwl" ,
77
+ "stac_json" : "https://raw.githubusercontent.com/unity-sds/unity-tutorial-application/refs/heads/main/test/stage_in/stage_in_results.json" ,
78
+ "cwl_workflow_process" : "https://raw.githubusercontent.com/mike-gangl/unity-OGC-example-application/refs/heads/main/process.cwl" ,
79
+ "job_args_process" : json .dumps ({"example_argument_empty" : "" }),
80
+ "cwl_workflow_stage_out" : "https://raw.githubusercontent.com/unity-sds/unity-data-services/refs/heads/cwl-examples/cwl/stage-out-stac-catalog/stage-out.cwl" ,
81
+ "job_args_stage_out" : {
82
+ "dev" : json .dumps (
83
+ {"project" : "unity" , "venue" : "dev" , "staging_bucket" : "unity-dev-unity-storage" }
84
+ )
85
+ },
86
+ "request_storage" : "10Gi" ,
87
+ "request_instance_type" : "t3.medium" ,
88
+ "use_ecr" : False ,
89
+ },
90
+ "outputs" : {"result" : {"transmissionMode" : "reference" }},
91
+ },
92
+ }
93
+
71
94
72
95
@scenario (FEATURE_FILE , "Successful execution of a CWL workflow with the OGC API" )
73
96
def test_successful_execution_of_a_cwl_workflow_with_the_ogc_api ():
@@ -79,24 +102,35 @@ def api_up_and_running(ogc_processes):
79
102
assert ogc_processes is not None and len (ogc_processes ) > 0
80
103
81
104
82
- @when (parsers .parse ("I trigger an OGC job for the {test_case } OGC process" ), target_fixture = "job" )
83
- def trigger_process (cwl_dag_process , venue , test_case ):
105
+ @when (parsers .parse ("I trigger a {test_case} OGC job for the {test_dag } OGC process" ), target_fixture = "job" )
106
+ def trigger_process (cwl_dag_process , cwl_dag_modular_process , venue , test_case , test_dag ):
84
107
85
- print (cwl_dag_process )
86
- assert cwl_dag_process is not None
108
+ # check that this test_case and test_dag are enabled for the specified venue
109
+ ogc_process = None
110
+ payload = None
111
+ try :
87
112
88
- # check that this test_case is enabled for the specified venue
89
- if venue in DATA [test_case ]["inputs" ]["cwl_args" ]:
90
- payload = DATA [test_case ]
91
- # choose the "cwl_args" specific to the current venue
92
- payload ["inputs" ]["cwl_args" ] = payload ["inputs" ]["cwl_args" ][venue ]
113
+ if test_dag == CWL_DAG_ID :
114
+ ogc_process = cwl_dag_process
115
+ payload = CWL_DAG_DATA [test_case ]
116
+ payload ["inputs" ]["cwl_args" ] = payload ["inputs" ]["cwl_args" ][venue ]
117
+ elif test_dag == CWL_DAG_MODULAR_ID :
118
+ ogc_process = cwl_dag_modular_process
119
+ payload = CWL_DAG_MODULAR_DATA [test_case ]
120
+ payload ["inputs" ]["job_args_stage_out" ] = payload ["inputs" ]["job_args_stage_out" ][venue ]
121
+
122
+ print (ogc_process )
123
+ assert ogc_process is not None
93
124
print (payload )
94
- job = cwl_dag_process .execute (payload )
125
+ assert payload is not None
126
+
127
+ # submit job
128
+ job = ogc_process .execute (payload )
95
129
assert job is not None
96
130
return job
97
131
98
- else :
99
- print (f"Test case: { test_case } is NOT enabled for venue: { venue } , skipping " )
132
+ except KeyError :
133
+ print (f"Test case: { test_case } and Test DAG: { test_dag } are NOT enabled for venue: { venue } " )
100
134
return None
101
135
102
136
0 commit comments