Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added alessio/shellescape and changed prepareEnvs to use envfile #29

Merged
merged 1 commit into from
Oct 14, 2024

Conversation

antoinetran
Copy link
Contributor

@antoinetran antoinetran commented Oct 7, 2024

Fixes #27

STATUS: READY for code review and merge

Summary

Fixes #27 by moving all env variables to inside a envfile.properties, which fixes the file command limit of 4096 characters, and bash-quoting it, which fixes all quote issues.
This does not fix the missing prefix docker:/docker.io/

This has not been tested yet. The CI/CD gives some error: https://github.com/antoinetran/interlink-slurm-plugin/actions for lint and build. This is my first time programming in GO, and I don't understand why the branch has issue with lint (clone , which has nothing to do with the modifications I did).

The docker builds fails too, https://github.com/antoinetran/interlink-slurm-plugin/actions/runs/11219763886 , because I did not modify the go.sum . Will do it now.


Related issue :
#27

@antoinetran
Copy link
Contributor Author

Status: the build docker is OK (https://github.com/antoinetran/interlink-slurm-plugin/actions/runs/11274890712) . The release binary https://github.com/antoinetran/interlink-slurm-plugin/releases/tag/0.3.4 has been tested by me. It works.

The results (some name has been anonymized):
For InterLink slurm plugin log:

time="2024-10-10T13:30:33Z" level=debug msg="---- Written envfile file /home/username/.interlink/argo-workflows-61d92d8b-2052-47c0-84c9-aba0efcb949a/envfile.properties key ARGO_PROGRESS_FILE value /var/run/argo/progress"
time="2024-10-10T13:30:33Z" level=debug msg="---- Written envfile file /home/username/.interlink/argo-workflows-61d92d8b-2052-47c0-84c9-aba0efcb949a/envfile.properties key ARGO_PROGRESS_PATCH_TICK_DURATION value 1m0s"
time="2024-10-10T13:30:33Z" level=debug msg="---- Written envfile file /home/username/.interlink/argo-workflows-61d92d8b-2052-47c0-84c9-aba0efcb949a/envfile.properties key ARGO_POD_NAME value appname-lsdsharedfs-template-gnj4q
-group-block-1706385343"
time="2024-10-10T13:30:33Z" level=debug msg="---- Written envfile file /home/username/.interlink/argo-workflows-61d92d8b-2052-47c0-84c9-aba0efcb949a/envfile.properties key ARGO_POD_UID value 61d92d8b-2052-47c0-84c9-aba0efcb949a"
time="2024-10-10T13:30:33Z" level=debug msg="---- Written envfile file /home/username/.interlink/argo-workflows-61d92d8b-2052-47c0-84c9-aba0efcb949a/envfile.properties key GODEBUG value x509ignoreCN=0"
time="2024-10-10T13:30:33Z" level=debug msg="---- Written envfile file /home/username/.interlink/argo-workflows-61d92d8b-2052-47c0-84c9-aba0efcb949a/envfile.properties key ARGO_WORKFLOW_NAME value appname-lsdsharedfs-template-
gnj4q"
time="2024-10-10T13:30:33Z" level=debug msg="---- Written envfile file /home/username/.interlink/argo-workflows-61d92d8b-2052-47c0-84c9-aba0efcb949a/envfile.properties key ARGO_CONTAINER_NAME value wait"
time="2024-10-10T13:30:33Z" level=debug msg="---- Written envfile file /home/username/.interlink/argo-workflows-61d92d8b-2052-47c0-84c9-aba0efcb949a/envfile.properties key ARGO_DEADLINE value 0001-01-01T00:00:00Z"
time="2024-10-10T13:30:33Z" level=debug msg="---- Written envfile file /home/username/.interlink/argo-workflows-61d92d8b-2052-47c0-84c9-aba0efcb949a/envfile.properties key ARGO_WORKFLOW_UID value dc412cb8-3f0a-4a1a-b2d3-a9677c935173
"
time="2024-10-10T13:30:33Z" level=debug msg="---- Written envfile file /home/username/.interlink/argo-workflows-61d92d8b-2052-47c0-84c9-aba0efcb949a/envfile.properties key ARGO_TEMPLATE value '{\"name\":\"group-block\",\"inputs\":{\
"parameters\":[{\"name\":\"input_data\",\"value\":\"stub2_output_preprocessed_signal.h5\"},{\"name\":\"pipeline_run_id\",\"value\":\"appname-lsdsharedfs-template-gnj4q\"},{\"name\":\"block_label\",\"value\":\"282\"},{\"name\":
\"group_label\",\"value\":\"stub2\"},{\"name\":\"block_static_configuration_reference\",\"value\":\"dummy_config.json\"},{\"name\":\"workdir\",\"value\":\"/work\"},{\"name\":\"bus_uri\",\"value\":\"nats://my-nats.nats:4222\"},{\"nam
e\":\"n_steps_per_iteration\",\"value\":\"1000\"},{\"name\":\"current_iteration\",\"value\":\"0\"}]},\"outputs\":{},\"affinity\":{\"nodeAffinity\":{\"preferredDuringSchedulingIgnoredDuringExecution\":[{\"weight\":1,\"preference\":{\
"matchExpressions\":[{\"key\":\"kubernetes.io/hostname\",\"operator\":\"In\",\"values\":[\"interlink-slurm\"]}]}}]}},\"metadata\":{},\"container\":{\"name\":\"\",\"image\":\"gitlabaddress/projectname-sgs/componentName/framework:0.4.0\",\
"command\":[\"appcmd\"],\"args\":[\"--workdir=/work\",\"--pipeline-run-id=appname-lsdsharedfs-template-gnj4q\",\"--servers=nats://my-nats.nats:4222\",\"start-block\",\"--input-data=stub2_output_preprocessed_signal.h5\",\"--i
nput-group-configuration-path=/work/stub2_group_configuration.json\",\"--block-label=282\",\"--group-label=stub2\",\"--n-steps=1000\",\"--current-iteration=0\",\"--output-checkpoint=/work/stub2_282_mcmc.dump\"],\"resources\":{\"limi
ts\":{\"cpu\":\"500m\",\"memory\":\"256Mi\"},\"requests\":{\"cpu\":\"500m\",\"memory\":\"256Mi\"}},\"volumeMounts\":[{\"name\":\"working-volume\",\"mountPath\":\"/work\"}]},\"tolerations\":[{\"key\":\"virtual-node.interlink/no-sched
ule\",\"operator\":\"Exists\"}]}'"
time

The created envfile.properties

ARGO_NODE_ID=appname-lsdsharedfs-template-gnj4q-2986436489
ARGO_INCLUDE_SCRIPT_OUTPUT=false
ARGO_DEADLINE=0001-01-01T00:00:00Z
ARGO_PROGRESS_FILE=/var/run/argo/progress
ARGO_PROGRESS_PATCH_TICK_DURATION=1m0s
ARGO_PROGRESS_FILE_TICK_DURATION=3s
ARGO_CONTAINER_NAME=main
ARGO_TEMPLATE='{"name":"group-block","inputs":{"parameters":[{"name":"input_data","value":"stub2_output_preprocessed_signal.h5"},{"name":"pipeline_run_id","value":"appname-lsdsharedfs-template-gnj4q"},{"name":"block_label","value":"160"},{"name":"group_label","value":"stub2"},{"name":"block_static_configuration_reference","value":"dummy_config.json"},{"name":"workdir","value":"/work"},{"name":"bus_uri","value":"nats://my-nats.nats:4222"},{"name":"n_steps_per_iteration","value":"1000"},{"name":"current_iteration","value":"0"}]},"outputs":{},"affinity":{"nodeAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"weight":1,"preference":{"matchExpressions":[{"key":"kubernetes.io/hostname","operator":"In","values":["interlink-slurm"]}]}}]}},"metadata":{},"container":{"name":"","image":"gitlabaddress/projectname-sgs/componentName/framework:0.4.0","command":["appcmd"],"args":["--workdir=/work","--pipeline-run-id=appname-lsdsharedfs-template-gnj4q","--servers=nats://my-nats.nats:4222","start-block","--input-data=stub2_output_preprocessed_signal.h5","--input-group-configuration-path=/work/stub2_group_configuration.json","--block-label=160","--group-label=stub2","--n-steps=1000","--current-iteration=0","--output-checkpoint=/work/stub2_160_mcmc.dump"],"resources":{"limits":{"cpu":"500m","memory":"256Mi"},"requests":{"cpu":"500m","memory":"256Mi"}},"volumeMounts":[{"name":"working-volume","mountPath":"/work"}]},"tolerations":[{"key":"virtual-node.interlink/no-schedule","operator":"Exists"}]}'

@antoinetran
Copy link
Contributor Author

ping @dciangot for review and merge

@dciangot dciangot self-requested a review October 14, 2024 07:23
Copy link
Collaborator

@dciangot dciangot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dciangot dciangot merged commit 4484461 into interTwin-eu:main Oct 14, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Long Json passed in env variable breaks singularity call
2 participants