-
Notifications
You must be signed in to change notification settings - Fork 0
117 lines (115 loc) · 3.78 KB
/
batch-run.yaml
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: 'Create batch run'
on:
workflow_dispatch:
inputs:
project:
description: Project identifier (core or arbimon) or url slug (e.g. puerto-rico-island-wide)
required: true
sites:
description: Comma-separated list of site names including wildcards (e.g. AB2,AB3,CD*) - empty for all sites
year:
description: Single year (e.g. 2022) - empty for all years
soundscape_aggregation:
description: Time aggregration
type: choice
default: 'time_of_day'
options:
- 'time_of_day'
- 'day_of_month'
- 'day_of_year'
- 'month_in_year'
- 'day_of_week'
- 'year'
required: true
soundscape_bin_size:
description: Bin size/bandwidth (Hz)
type: choice
default: '344'
options:
- '344'
- '172'
- '86'
- '43'
- '21'
required: true
soundscape_normalize:
description: Normalize results
type: choice
default: '1'
options:
- '1'
- '0'
required: true
soundscape_threshold:
description: Peak filtering amplitude threshold
default: '0.05'
required: true
environment:
description: Environment (namespace)
type: choice
default: 'production'
options:
- 'production'
- 'staging'
- 'testing'
required: true
jobs:
create-job:
runs-on: deployment-runner
env:
ECR_REGISTRY: '887044485231.dkr.ecr.eu-west-1.amazonaws.com'
ECR_REPO: 'arbimon-soundscapes'
JOB_NAME: 'arbimon-soundscape'
steps:
- name: 'Setup: Generate job unique number'
run: echo "JOB_NUMBER=$(date +%s)" >> $GITHUB_ENV
- name: 'Deploy: Generate job definition file'
run: |
cat <<EOF > job.yaml
apiVersion: batch/v1
kind: Job
metadata:
name: ${{ env.JOB_NAME }}-${{ env.JOB_NUMBER }}
spec:
ttlSecondsAfterFinished: 86400
template:
spec:
containers:
- name: ${{ env.JOB_NAME }}
image: ${{ env.ECR_REGISTRY }}/${{ env.ECR_REPO }}:latest
imagePullPolicy: Always
args: ["batch_legacy"]
envFrom:
- secretRef:
name: arbimon-soundscapes-secret
- configMapRef:
name: arbimon-soundscapes-config
env:
- name: PROJECT
value: '${{ inputs.project }}'
- name: SITES
value: '${{ inputs.sites }}'
- name: YEAR
value: '${{ inputs.year }}'
- name: SOUNDSCAPE_AGGREGATION
value: '${{ inputs.soundscape_aggregation }}'
- name: SOUNDSCAPE_BIN_SIZE
value: '${{ inputs.soundscape_bin_size }}'
- name: SOUNDSCAPE_NORMALIZE
value: '${{ inputs.soundscape_normalize }}'
- name: SOUNDSCAPE_THRESHOLD
value: '${{ inputs.soundscape_threshold }}'
resources:
requests:
cpu: '1'
restartPolicy: Never
backoffLimit: 10
EOF
cat job.yaml
- name: 'Deploy: Create job'
# v1 (1.21.2) @ 03 Nov 2021 https://github.com/actions-hub/kubectl/tags
uses: actions-hub/kubectl@365773786ebd92c7b36b6ab80e17d4a213ab0cd1
env:
KUBE_CONFIG: ${{ secrets.KUBE_CONFIG_SUPER }}
with:
args: apply -f job.yaml -n ${{ inputs.environment }}