Skip to content

bug fix: handle submit_hysds_job payload without on_success parameter #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/unity_initiator/actions/submit_hysds_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def execute(self):
job_params = {
"payload": self._payload,
"payload_info": self._payload_info,
"on_success": self._params["on_success"],
"on_success": self._params.get("on_success", None),
}

# setup url and request body
Expand Down
43 changes: 42 additions & 1 deletion tests/resources/test_router.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ initiator_config:
actions:
- name: submit_hysds_job
params:
mozart_base_api_endpoint: https://example.com/api/v0.1/job/submit
mozart_base_api_endpoint: https://example.com/mozart/api/v0.1/job/submit
job_spec: submit_airs_ingest:v1
queue: ingest_queue
priority: 0
Expand All @@ -172,3 +172,44 @@ initiator_config:
- name: submit_ogc_process_execution
params:
process_id: hello_world

# ECMWF A2/A3
- regexes:
- '/(?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)$'
evaluators:

# If the regex matches, the router submits a convert_merge_a2_a3 HySDS job that contains
# the payload and the regex match groupdict() as JSON.
- name: convert_merge_a2_a3
actions:
- name: submit_hysds_job
params:
mozart_base_api_endpoint: https://example.com/mozart/api/v0.1/job/submit
job_spec: job-convert_merge_a2_a3:r4.0.4
queue: factotum-ecmwf-licensed-worker-1
priority: 0
tags:
- ecmwf
- a2
- a3
- hysds

# ECMWF A4
- regexes:
- '/(?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)$'
evaluators:

# If the regex matches, the router submits a convert_a4 HySDS job that contains
# the payload and the regex match groupdict() as JSON.
- name: convert_a4
actions:
- name: submit_hysds_job
params:
mozart_base_api_endpoint: https://example.com/mozart/api/v0.1/job/submit
job_spec: job-convert_a4:r4.0.4
queue: factotum-ecmwf-licensed-worker-2
priority: 0
tags:
- ecmwf
- a4
- hysds