Skip to content

Commit

Permalink
Copy logs for build failures to CWD so they are copied to S3. (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjkw31 authored Sep 11, 2024
1 parent ccc828e commit 394c3a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion wr/wr.tmpl
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"cmd": "echo doing build with hash {{ .Hash }}; if sudo singularity build --bind $TMPDIR:/tmp $TMPDIR/singularity.sif singularity.def &> $TMPDIR/builder.out; then sudo singularity run $TMPDIR/singularity.sif cat /opt/spack-environment/executables > $TMPDIR/executables && sudo singularity run $TMPDIR/singularity.sif cat /opt/spack-environment/spack.lock > $TMPDIR/spack.lock && mv $TMPDIR/singularity.sif $TMPDIR/builder.out $TMPDIR/executables $TMPDIR/spack.lock .; else mv $TMPDIR/builder.out . && false; fi", "retries": 0, "rep_grp": "singularity_build-{{ .S3Path }}", "limit_grps": ["s3cache"], "mounts": [{"Targets": [{"Path":"{{ .S3Path }}","Write":true,"Cache":true}]}]}
{"cmd": "echo doing build with hash {{ .Hash }}; if sudo singularity build --bind $TMPDIR:/tmp $TMPDIR/singularity.sif singularity.def &> $TMPDIR/builder.out; then sudo singularity run $TMPDIR/singularity.sif cat /opt/spack-environment/executables > $TMPDIR/executables && sudo singularity run $TMPDIR/singularity.sif cat /opt/spack-environment/spack.lock > $TMPDIR/spack.lock && mv $TMPDIR/singularity.sif $TMPDIR/builder.out $TMPDIR/executables $TMPDIR/spack.lock .; else mv $TMPDIR/builder.out .; mkdir logs; sudo find $TMPDIR/root/spack-stage/ -maxdepth 2 -iname \"*.txt\" -exec cp {} logs/ \\; ; false; fi", "retries": 0, "rep_grp": "singularity_build-{{ .S3Path }}", "limit_grps": ["s3cache"], "mounts": [{"Targets": [{"Path":"{{ .S3Path }}","Write":true,"Cache":true}]}]}
6 changes: 4 additions & 2 deletions wr/wr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ func TestWR(t *testing.T) {
`&> $TMPDIR/builder.out; then `+
`sudo singularity run $TMPDIR/singularity.sif cat /opt/spack-environment/executables > $TMPDIR/executables && `+
`sudo singularity run $TMPDIR/singularity.sif cat /opt/spack-environment/spack.lock > $TMPDIR/spack.lock && `+
`mv $TMPDIR/singularity.sif $TMPDIR/builder.out $TMPDIR/executables $TMPDIR/spack.lock .; else `+
`mv $TMPDIR/builder.out . && false; fi", `+
`mv $TMPDIR/singularity.sif $TMPDIR/builder.out $TMPDIR/executables $TMPDIR/spack.lock .; `+
`else mv $TMPDIR/builder.out .; mkdir logs; `+
`sudo find $TMPDIR/root/spack-stage/ -maxdepth 2 -iname \"*.txt\" -exec cp {} logs/ \\; ; `+
`false; fi", `+
`"retries": 0, "rep_grp": "singularity_build-spack/builds/users/user/myenv", "limit_grps": ["s3cache"], `+
`"mounts": [{"Targets": [{"Path":"spack/builds/users/user/myenv","Write":true,"Cache":true}]}]}`)

Expand Down

0 comments on commit 394c3a2

Please sign in to comment.