Skip to content

Commit

Permalink
job template
Browse files Browse the repository at this point in the history
  • Loading branch information
brettedw committed Nov 5, 2024
1 parent 90d0582 commit d7ad1fb
Show file tree
Hide file tree
Showing 2 changed files with 110 additions and 0 deletions.
16 changes: 16 additions & 0 deletions openshift/sfms-calculate/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# SFMS Raster Calculation job

Creates a one off job to run SFMS raster calculations for a specific date and hour

## Create job

### Apply template to build the job on Openshift

Example:

```bash
oc process -p DATE="2024-10-10" -p HOUR=5 -p IMAGE_NAME=pr-4042 -f sfms-job.yaml | oc apply -f -
```

DATE is the start date of the calculations
HOUR is the hour for the start date. This determines which model run of data will be used [defaults to 20]
94 changes: 94 additions & 0 deletions openshift/sfms-calculate/openshift/sfms-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: template.openshift.io/v1
kind: Template
metadata:
name: sfms-fwi-calc-job
annotations:
description: "Template for SFMS FWI Calculation Job"
parameters:
- name: DATE
description: "Date argument for the Python script - YYYY-MM-DD"
required: true
- name: HOUR
description: "Hour argument for the Python script - HH"
required: true
value: "20"
- name: IMAGE_NAME
description: "Docker image to use for the job"
required: true
objects:
- kind: Job
apiVersion: batch/v1
metadata:
name: sfms-fwi-calc-job-${DATE}-${HOUR}
spec:
parallelism: 1
completions: 1
backoffLimit: 6
template:
spec:
containers:
- name: sfms-fwi-calc-container
image: image-registry.openshift-image-registry.svc:5000/e1e498-tools/wps-api-${IMAGE_NAME}:${IMAGE_NAME}
command:
- poetry
- run
- python
- "-m"
- app.jobs.sfms_calculations
- "${DATE} ${HOUR}"
env:
- name: ROCKET_URL_POST_MESSAGE
valueFrom:
configMapKeyRef:
name: wps-global
key: rocket.chat-url-post-message
- name: ROCKET_CHANNEL
valueFrom:
configMapKeyRef:
name: wps-global
key: rocket.chat-channel
- name: ROCKET_USER_ID
valueFrom:
secretKeyRef:
name: wps-global
key: rocket.chat-user-id-secret
- name: ROCKET_AUTH_TOKEN
valueFrom:
secretKeyRef:
name: wps-global
key: rocket.chat-auth-token-secret
- name: OBJECT_STORE_SERVER
valueFrom:
secretKeyRef:
name: wps-global
key: object-store-server
- name: OBJECT_STORE_USER_ID
valueFrom:
secretKeyRef:
name: wps-global
key: object-store-user-id
- name: OBJECT_STORE_SECRET
valueFrom:
secretKeyRef:
name: wps-global
key: object-store-secret
- name: OBJECT_STORE_BUCKET
valueFrom:
secretKeyRef:
name: wps-global
key: object-store-bucket
resources:
limits:
cpu: "1"
memory: 1Gi
requests:
cpu: 500m
memory: 512Mi
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
imagePullPolicy: Always
restartPolicy: OnFailure
terminationGracePeriodSeconds: 30
dnsPolicy: ClusterFirst
securityContext: {}
schedulerName: default-scheduler

0 comments on commit d7ad1fb

Please sign in to comment.