From 21cab6a2ff3bef1510b8957d1a7775eab7d5eb9f Mon Sep 17 00:00:00 2001 From: Victor Engmark Date: Mon, 27 May 2024 20:40:23 +0000 Subject: [PATCH] fix: Don't override topo-imagery Docker entrypoint for Python TDE-1179 (#604) #### Motivation We use the Docker `ENTRYPOINT` (Argo `command`) to activate the virtualenv before running Python. We've [verified that this change is backwards compatible by running it with topo-imagery v4.7.1](https://argo.linzaccess.com/workflows/argo/test-is-docker-args-w9p88?tab=workflow&nodeId=test-is-docker-args-w9p88-2719834120&nodePanelView=containers&uid=e8af157e-77c5-403c-bbaa-12525efdf7db). #### Modification Use `args` rather than `command` for specifying the interpreter and file to run. #### Checklist - [ ] Tests updated (N/A) - [x] Docs updated - [x] Issue linked in Title --- workflows/raster/standardising.yaml | 8 +++----- workflows/raster/tests.yaml | 7 +------ workflows/test/env.yaml | 2 ++ workflows/util/create-thumbnails.yaml | 3 +-- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/workflows/raster/standardising.yaml b/workflows/raster/standardising.yaml index 8f95dfe3e..bcc993237 100644 --- a/workflows/raster/standardising.yaml +++ b/workflows/raster/standardising.yaml @@ -436,7 +436,7 @@ spec: - name: collection-id-setup script: image: '019359803926.dkr.ecr.ap-southeast-2.amazonaws.com/topo-imagery:{{=sprig.trim(workflow.parameters.version_topo_imagery)}}' - command: [python] + args: [python] source: | import ulid collection_id = "{{workflow.parameters.collection_id}}" @@ -472,10 +472,9 @@ spec: volumeMounts: - name: ephemeral mountPath: '/tmp' - command: + args: - python - '/app/scripts/standardise_validate.py' - args: - '--from-file' - '/tmp/input/{{inputs.parameters.group_id}}.json' - '--target' @@ -519,10 +518,9 @@ spec: requests: memory: 7.8Gi cpu: 15000m - command: + args: - python - '/app/scripts/collection_from_items.py' - args: - '--uri' - '{{inputs.parameters.location}}flat/' - '--collection-id' diff --git a/workflows/raster/tests.yaml b/workflows/raster/tests.yaml index 5408d0b29..9167e0fa6 100644 --- a/workflows/raster/tests.yaml +++ b/workflows/raster/tests.yaml @@ -24,11 +24,6 @@ spec: - name: test-script script: image: 019359803926.dkr.ecr.ap-southeast-2.amazonaws.com/topo-imagery:{{workflow.parameters.version_topo_imagery}} - command: [python] + args: [python] source: | - import sys - - # Because Argo Workflow executes the script under "/argo/staging/script" - sys.path.append("/app/scripts/") - # Put your code below diff --git a/workflows/test/env.yaml b/workflows/test/env.yaml index c4709d1d6..9ac57aa62 100644 --- a/workflows/test/env.yaml +++ b/workflows/test/env.yaml @@ -12,4 +12,6 @@ spec: - name: env container: image: 019359803926.dkr.ecr.ap-southeast-2.amazonaws.com/topo-imagery:latest + # Use `command` if you want to print the environment variables outside the virtualenv, or `args` if you want + # to print the variables inside the virtualenv. command: [env] diff --git a/workflows/util/create-thumbnails.yaml b/workflows/util/create-thumbnails.yaml index 09ab9c24e..3f8cc5166 100644 --- a/workflows/util/create-thumbnails.yaml +++ b/workflows/util/create-thumbnails.yaml @@ -92,10 +92,9 @@ spec: volumeMounts: - name: ephemeral mountPath: '/tmp' - command: + args: - python - '/app/scripts/thumbnails.py' - args: - '--from-file' - '/tmp/file_list.json' - '--target'