Skip to content

Commit

Permalink
Show how to pin container version in jobs, add security when getting …
Browse files Browse the repository at this point in the history
…SQLite file (#73)

Co-authored-by: Jean-Philippe Lenain <jlenain@in2p3.fr>
  • Loading branch information
jlenain and jlenain authored Jul 26, 2023
1 parent a714ae5 commit d7734a8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ if [ -z $runnb ]; then
fi

WRAPPER="singularity_wrapper.sh"
# We can instantiate a particular container version:
# CONTAINER="oras://ghcr.io/cta-observatory/nectarchain@sha256:cf5a812bdb1113d027facceec30009759535a8579eb4caf38f56143e65cb35e7"
# or just use the latest available:
CONTAINER="oras://ghcr.io/cta-observatory/nectarchain:latest"
OUTDIR=NectarCAM_DQM_Run${runnb}
DIRAC_OUTDIR=/vo.cta.in2p3.fr/user/j/jlenain/nectarcam/dqm
Expand Down Expand Up @@ -110,6 +113,6 @@ chmod u+x $WRAPPER || exit_script $?

# Archive the output directory and push it on DIRAC before leaving the job:
tar zcf ${OUTDIR}.tar.gz ${OUTDIR}/ || exit_script $?
dirac-dms-add-file ${DIRAC_OUTDIR}/${OUTDIR}.tar.gz ${OUTDIR}.tar.gz LPNHE-USER || exit_script $?
dirac-dms-add-file ${DIRAC_OUTDIR}/${OUTDIR}.tar.gz ${OUTDIR}.tar.gz || exit_script $?

exit_script 0
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,10 @@
if not infosTomorrow['OK'] or not infosTomorrow['Value']['Successful']:
logger.warning(f"Could not properly retrieve the file metadata for {dfcDirTomorrow} ... Continuing !")
meta = infos['Value']['Successful'][dfcDir]
metaTomorrow = infosTomorrow['Value']['Successful'][dfcDirTomorrow]
try:
metaTomorrow = infosTomorrow['Value']['Successful'][dfcDirTomorrow]
except KeyError:
metaTomorrow = None

runlist = []

Expand All @@ -99,9 +102,10 @@
runlist.append(run)
if f.endswith('.sqlite'):
sqlfilelist.append(f)
for f in metaTomorrow['Files']:
if f.endswith('.sqlite'):
sqlfilelist.append(f)
if metaTomorrow:
for f in metaTomorrow['Files']:
if f.endswith('.sqlite'):
sqlfilelist.append(f)
if args.run is not None:
if args.run not in runlist:
logger.critical(f'Your specified run {args.run} was not found in {dfcDir}, aborting...')
Expand Down

0 comments on commit d7734a8

Please sign in to comment.