Skip to content

Commit

Permalink
feat: add exit handler tasks TDE-1230 (#752)
Browse files Browse the repository at this point in the history
#### Motivation

The exit handler logs some useful information about a workflow when it's
done. These can be helpful for logging and alerting.

#### Modification

- call exit-handler task `onExit`

#### Checklist

- [ ] Tests updated
- [ ] Docs updated
- [x] Issue linked in Title
  • Loading branch information
paulfouquet authored Sep 13, 2024
1 parent 6dc612f commit fa32e84
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 0 deletions.
16 changes: 16 additions & 0 deletions workflows/basemaps/imagery-import-cogify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ metadata:
spec:
parallelism: 100
entrypoint: main
onExit: exit-handler
synchronization:
semaphore:
configMapKeyRef:
Expand Down Expand Up @@ -452,3 +453,18 @@ spec:
- '--config-type={{workflow.parameters.config_type}}'
- "--individual={{= workflow.parameters.individual == 'individual'? 'true' : 'false' }}"
- '--category={{workflow.parameters.category}}'

- name: exit-handler
retryStrategy:
limit: '0' # `tpl-exit-handler` retries itself
steps:
- - name: exit
templateRef:
name: tpl-exit-handler
template: main
arguments:
parameters:
- name: workflow_status
value: '{{workflow.status}}'
- name: workflow_parameters
value: '{{workflow.parameters}}'
16 changes: 16 additions & 0 deletions workflows/basemaps/vector-etl.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
linz.govt.nz/data-type: vector
spec:
entrypoint: main
onExit: exit-handler
podMetadata:
labels:
linz.govt.nz/category: basemaps
Expand Down Expand Up @@ -160,3 +161,18 @@ spec:
- '--target={{ inputs.parameters.target }}'
- '--config-type=vector'
- "--individual={{= workflow.parameters.individual == 'individual'? 'true' : 'false' }}"

- name: exit-handler
retryStrategy:
limit: '0' # `tpl-exit-handler` retries itself
steps:
- - name: exit
templateRef:
name: tpl-exit-handler
template: main
arguments:
parameters:
- name: workflow_status
value: '{{workflow.status}}'
- name: workflow_parameters
value: '{{workflow.parameters}}'
15 changes: 15 additions & 0 deletions workflows/cron/cron-stac-validate-fast.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ spec:
suspend: false
workflowSpec:
entrypoint: main
onExit: exit-handler
podMetadata:
labels:
linz.govt.nz/category: stac
Expand Down Expand Up @@ -53,3 +54,17 @@ spec:
value: '{{workflow.parameters.checksum_assets}}'
- name: 'checksum_links'
value: '{{workflow.parameters.checksum_links}}'
- name: exit-handler
retryStrategy:
limit: '0' # `tpl-exit-handler` retries itself
steps:
- - name: exit
templateRef:
name: tpl-exit-handler
template: main
arguments:
parameters:
- name: workflow_status
value: '{{workflow.status}}'
- name: workflow_parameters
value: '{{workflow.parameters}}'
15 changes: 15 additions & 0 deletions workflows/cron/cron-stac-validate-full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ spec:
suspend: false
workflowSpec:
entrypoint: main
onExit: exit-handler
podMetadata:
labels:
linz.govt.nz/category: stac
Expand Down Expand Up @@ -65,3 +66,17 @@ spec:
value: '{{workflow.parameters.checksum_assets}}'
- name: 'checksum_links'
value: '{{workflow.parameters.checksum_links}}'
- name: exit-handler
retryStrategy:
limit: '0' # `tpl-exit-handler` retries itself
steps:
- - name: exit
templateRef:
name: tpl-exit-handler
template: main
arguments:
parameters:
- name: workflow_status
value: '{{workflow.status}}'
- name: workflow_parameters
value: '{{workflow.parameters}}'
16 changes: 16 additions & 0 deletions workflows/raster/copy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ spec:
nodeSelector:
karpenter.sh/capacity-type: 'spot'
entrypoint: main
onExit: exit-handler
synchronization:
semaphore:
configMapKeyRef:
Expand Down Expand Up @@ -158,3 +159,18 @@ spec:
value: '{{workflow.parameters.aws_role_config_path}}'
depends: 'create-manifest'
withParam: '{{tasks.create-manifest.outputs.parameters.files}}'

- name: exit-handler
retryStrategy:
limit: '0' # `tpl-exit-handler` retries itself
steps:
- - name: exit
templateRef:
name: tpl-exit-handler
template: main
arguments:
parameters:
- name: workflow_status
value: '{{workflow.status}}'
- name: workflow_parameters
value: '{{workflow.parameters}}'
16 changes: 16 additions & 0 deletions workflows/raster/publish-odr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ spec:
nodeSelector:
karpenter.sh/capacity-type: 'spot'
entrypoint: main
onExit: exit-handler
synchronization:
semaphore:
configMapKeyRef:
Expand Down Expand Up @@ -126,3 +127,18 @@ spec:
- name: copy_option
value: '{{inputs.parameters.copy_option}}'
depends: 'generate-path'

- name: exit-handler
retryStrategy:
limit: '0' # `tpl-exit-handler` retries itself
steps:
- - name: exit
templateRef:
name: tpl-exit-handler
template: main
arguments:
parameters:
- name: workflow_status
value: '{{workflow.status}}'
- name: workflow_parameters
value: '{{workflow.parameters}}'

0 comments on commit fa32e84

Please sign in to comment.