Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
MDavidson17 committed Aug 21, 2023
1 parent a939a88 commit 3a8c0ce
Showing 1 changed file with 139 additions and 0 deletions.
139 changes: 139 additions & 0 deletions workflows/topo50&250/create-thumbnails.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
---
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: generate-thumbnails-topo50&250
namespace: argo
spec:
parallelism: 50
nodeSelector:
karpenter.sh/capacity-type: "spot"
entrypoint: main
arguments:
parameters:
# FIXME: Should use camelCase or underscore?
- name: version-argo-tasks
value: "v2"
- name: version-topo-imagery
value: "v3"
- name: source
value: "TODO"
- name: target # TODO - only need if also doing publish copy?
value: "TODO"
- name: group
value: "5" # TODO - how many?
templateDefaults:
container:
imagePullPolicy: Always
templates:
- name: main
dag:
tasks:
- name: aws-list
template: aws-list
arguments:
parameters:
- name: uri
value: "{{workflow.parameters.uri}}"
- name: include
value: ".*.*.tif?$"

- name: create-thumbnails
template: create-thumbnails
arguments:
parameters:
- name: source
value: "{{item}}"
- name: target
value: "{{tasks.get-location.outputs.parameters.location}}intermediate/" #TODO - is this the target
depends: "aws-list & get-location"
withParam: "{{tasks.aws-list.outputs.parameters.files}}"

- name: get-location
template: get-location

outputs:
parameters:
- name: target
valueFrom:
parameter: "{{tasks.get-location.outputs.parameters.location}}"
# END TEMPLATE `main`

- name: aws-list
inputs:
parameters:
- name: uri
- name: include
container:
image: 019359803926.dkr.ecr.ap-southeast-2.amazonaws.com/eks:argo-tasks-{{workflow.parameters.version-argo-tasks}}
command: [node, /app/index.js]
env:
- name: AWS_ROLE_CONFIG_PATH
value: s3://linz-bucket-config/config.json
args: [
"list",
"--verbose",
"--include",
"{{inputs.parameters.include}}",
"--group",
"2", # TODO make a workflow param?
"--output",
"/tmp/file_list.json",
"{{inputs.parameters.uri}}",
]
outputs:
parameters:
- name: files
valueFrom:
path: /tmp/file_list.json

- name: create-thumbnails
retryStrategy:
limit: "2"
nodeSelector:
karpenter.sh/capacity-type: "spot"
inputs:
parameters:
- name: source
- name: target
container:
image: "019359803926.dkr.ecr.ap-southeast-2.amazonaws.com/eks:topo-imagery-{{=sprig.trim(workflow.parameters['version-topo-imagery'])}}"
resources:
requests:
memory: 7.8Gi
cpu: 15000m
ephemeral-storage: 3Gi
volumeMounts:
- name: ephemeral
mountPath: "/tmp"
command:
- python
- "/app/scripts/thumbnails.py"
args:
- "--source"
- "{{inputs.parameters.source}}"
- "--target"
- "{{inputs.parameters.target}}"
outputs:
artifacts:
- name: thumbnails
path: /tmp/ #TODO - is this right?

- name: get-location
script:
image: "019359803926.dkr.ecr.ap-southeast-2.amazonaws.com/eks:argo-tasks-{{=sprig.trim(workflow.parameters['version-argo-tasks'])}}"
command: [node]
source: |
const fs = require('fs');
const loc = JSON.parse(process.env['ARGO_TEMPLATE']).archiveLocation.s3;
const key = loc.key.replace('{{pod.name}}','');
fs.writeFileSync('/tmp/location', `s3://${loc.bucket}/${key}`);
outputs:
parameters:
- name: location
valueFrom:
path: "/tmp/location"

volumes:
- name: ephemeral
emptyDir: {}

0 comments on commit 3a8c0ce

Please sign in to comment.