Saving LAMMPS Results
This example LAMMPS CPU workflow uses
StageoutScript to save results to a persistent volume. To save results to AWS S3 instead, copy
and edit the preinstalled template as described in the
workflow catalog documentation, then change the template
as follows:
version: v4
volumes:
scratch:
use: {{ .ScratchVolume }}
size: 1GB
ingress:
- destination:
uri: file://stagein.sh
source:
uri: {{ .ExperimentUrl }}/{{ .StageinScript }}
{{- if .StageoutScript }}
- destination:
uri: file://stageout.sh
source:
uri: {{ .ExperimentUrl }}/{{ .StageoutScript }}
egress:
- source:
uri: file://{{ .RunName }}.tar.gz
destination:
uri: s3://{{.OutputPath}}/{{ .RunName }}.tar.gz
secret: {{ .S3Secret }}
{{- end }}
...snip...
{{- if .StageoutScript }}
stageout:
script: |
#!/bin/sh
sh stageout.sh {{.RunName}}
cwd: /scratch
image:
uri: docker://alpine:latest
mounts:
/scratch: scratch
name: stageout
depends-on:
- name: run-lammps
status: FINISHED
resource:
cpu:
cores: 1
memory:
size: 512MiB
{{- end }}
Note that we added an egress section, which requires a new S3Secret parameter, and removed the
persistent data volume.
Then you would provide a different stageout script like so to create the tar archive used in egress:
#!/bin/sh
set -ex
run="${1}"
if [ -d "${run}" ] ; then
tar -czf "${run}.tar.gz" "${run}"
else
echo "did not save results to persistent store"
fi