Skip to content

Commit 137c66f

Browse files
authored
handle submit_hysds_job payload without on_success parameter (#6)
- add examples for ECMWF
1 parent e0f78c0 commit 137c66f

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

src/unity_initiator/actions/submit_hysds_job.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def execute(self):
2121
job_params = {
2222
"payload": self._payload,
2323
"payload_info": self._payload_info,
24-
"on_success": self._params["on_success"],
24+
"on_success": self._params.get("on_success", None),
2525
}
2626

2727
# setup url and request body

tests/resources/test_router.yaml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ initiator_config:
150150
actions:
151151
- name: submit_hysds_job
152152
params:
153-
mozart_base_api_endpoint: https://example.com/api/v0.1/job/submit
153+
mozart_base_api_endpoint: https://example.com/mozart/api/v0.1/job/submit
154154
job_spec: submit_airs_ingest:v1
155155
queue: ingest_queue
156156
priority: 0
@@ -172,3 +172,44 @@ initiator_config:
172172
- name: submit_ogc_process_execution
173173
params:
174174
process_id: hello_world
175+
176+
# ECMWF A2/A3
177+
- regexes:
178+
- '/(?P<id>(?P<model>ECMWF)_(?P<stream>A2A3)_(?P<init_year>\d{4})(?P<init_mon>\d{2})(?P<init_day>\d{2})(?P<init_hr>\d{2})(?P<init_min>\d{2})_(?P<forecast_year>\d{4})(?P<forecast_mon>\d{2})(?P<forecast_day>\d{2})(?P<forecast_hr>\d{2})(?P<forecast_min>\d{2})_(?P<exp_ver>\d+)\.json)$'
179+
evaluators:
180+
181+
# If the regex matches, the router submits a convert_merge_a2_a3 HySDS job that contains
182+
# the payload and the regex match groupdict() as JSON.
183+
- name: convert_merge_a2_a3
184+
actions:
185+
- name: submit_hysds_job
186+
params:
187+
mozart_base_api_endpoint: https://example.com/mozart/api/v0.1/job/submit
188+
job_spec: job-convert_merge_a2_a3:r4.0.4
189+
queue: factotum-ecmwf-licensed-worker-1
190+
priority: 0
191+
tags:
192+
- ecmwf
193+
- a2
194+
- a3
195+
- hysds
196+
197+
# ECMWF A4
198+
- regexes:
199+
- '/(?P<id>(?P<model>ECMWF)_(?P<stream>A4)_(?P<init_year>\d{4})(?P<init_mon>\d{2})(?P<init_day>\d{2})(?P<init_hr>\d{2})(?P<init_min>\d{2})_(?P<forecast_year>\d{4})(?P<forecast_mon>\d{2})(?P<forecast_day>\d{2})(?P<forecast_hr>\d{2})(?P<forecast_min>\d{2})_(?P<exp_ver>\d+)\.json)$'
200+
evaluators:
201+
202+
# If the regex matches, the router submits a convert_a4 HySDS job that contains
203+
# the payload and the regex match groupdict() as JSON.
204+
- name: convert_a4
205+
actions:
206+
- name: submit_hysds_job
207+
params:
208+
mozart_base_api_endpoint: https://example.com/mozart/api/v0.1/job/submit
209+
job_spec: job-convert_a4:r4.0.4
210+
queue: factotum-ecmwf-licensed-worker-2
211+
priority: 0
212+
tags:
213+
- ecmwf
214+
- a4
215+
- hysds

0 commit comments

Comments
 (0)