From f1d20ea26d3f2d233f29b0ecb879f7e06d5b828d Mon Sep 17 00:00:00 2001 From: Theodore Kisner Date: Sun, 3 Mar 2024 13:42:58 -0800 Subject: [PATCH] Update high-level desimodel sync scripts used by cron jobs. - Add missing '-f' module swap option - Change import test to use import from fiberassign which will properly fail if exclusion polygons are not found. - Update the "force" version of the sync script which calls the desi_sync_focalplane with the --reset option. This script now has all the matching improvements in the cron version of the script. --- etc/desimodel_sync_kpno_cron.sh | 24 ++++++++++----------- etc/desimodel_sync_kpno_force.sh | 37 ++++++++++++++++++++++++++------ 2 files changed, 43 insertions(+), 18 deletions(-) diff --git a/etc/desimodel_sync_kpno_cron.sh b/etc/desimodel_sync_kpno_cron.sh index b2773d8..b147740 100755 --- a/etc/desimodel_sync_kpno_cron.sh +++ b/etc/desimodel_sync_kpno_cron.sh @@ -44,7 +44,7 @@ export DESIMODEL_CENTRAL_REPO=${DESI_ROOT}/survey/ops/desimodel/trunk module use ${DESI_PRODUCT_ROOT}/modulefiles module load desiconda module load desimodules/${desimodules} -module swap desimodel/0.17.0 +module swap -f desimodel/0.17.0 echo "Using desimodel data svn trunk at ${svntrunk}" >> "${logfile}" export DESIMODEL="${svntrunk}" @@ -73,9 +73,9 @@ else # Make sure we can load the resulting hardware model echo "Try loading focalplane model at ${DESIMODEL}... " >> "${logfile}" PYTHON_CODE=$(cat <> "${logfile}" - # Now commit result - mesg="Appending DB sync ${calfile} to current focalplane model" - svn commit -m "${mesg}" "${svntrunk}/data" >> "${logfile}" - svn up "${svntrunk}/data" >> "${logfile}" - echo "Updating $DESIMODEL_CENTRAL_REPO." >> "${logfile}" - svn up "${DESIMODEL_CENTRAL_REPO}" >> "${logfile}" + echo "SUCCESS" >> "${logfile}" + # Now commit result + mesg="Appending DB sync ${calfile} to current focalplane model" + svn commit -m "${mesg}" "${svntrunk}/data" >> "${logfile}" + svn up "${svntrunk}/data" >> "${logfile}" + echo "Updating $DESIMODEL_CENTRAL_REPO." >> "${logfile}" + svn up "${DESIMODEL_CENTRAL_REPO}" >> "${logfile}" else - echo "FAIL" >> "${logfile}" - echo "Refusing to commit broken update. Restore the *.previous files." >> "${logfile}" + echo "FAIL" >> "${logfile}" + echo "Refusing to commit broken update. Restore the *.previous files." >> "${logfile}" fi fi diff --git a/etc/desimodel_sync_kpno_force.sh b/etc/desimodel_sync_kpno_force.sh index 8a47bbb..2a18ca3 100755 --- a/etc/desimodel_sync_kpno_force.sh +++ b/etc/desimodel_sync_kpno_force.sh @@ -1,7 +1,10 @@ #!/bin/bash # IMPORTANT: If you update this script, remember to copy it to -# ~datasystems/desimodel_sync/ at KPNO. +# ~datasystems/desimodel_sync/ at KPNO. This copy is needed so that +# cron can find it in a fixed location independent of particular +# versions of the software stack (this script loads the software +# stack). # Ensure that we are running this as the datasystems user if [ $(whoami) != "datasystems" ]; then @@ -41,7 +44,7 @@ export DESIMODEL_CENTRAL_REPO=${DESI_ROOT}/survey/ops/desimodel/trunk module use ${DESI_PRODUCT_ROOT}/modulefiles module load desiconda module load desimodules/${desimodules} -module swap desimodel/0.17.0 +module swap -f desimodel/0.17.0 echo "Using desimodel data svn trunk at ${svntrunk}" >> "${logfile}" export DESIMODEL="${svntrunk}" @@ -61,16 +64,38 @@ echo "Ensuring clean svn tree at ${DESIMODEL}" >> "${logfile}" svn revert -R "${svntrunk}/data" >> "${logfile}" svn up "${svntrunk}/data" >> "${logfile}" -# Run it. +# Run it, without committing result. echo "Forcing creation of new focalplane model!" >> "${logfile}" eval ${fpsync} --calib_file ${calpath} --commit --reset >> "${logfile}" 2>&1 if [ $? -ne 0 ]; then - echo "Focalplane creation failed" >> "${logfile}" + echo "Focalplane sync failed" >> "${logfile}" else echo "Focalplane sync completed" >> "${logfile}" - echo "Updating $DESIMODEL_CENTRAL_REPO." >> "${logfile}" - svn up $DESIMODEL_CENTRAL_REPO >> "${logfile}" + # Make sure we can load the resulting hardware model + echo "Try loading focalplane model at ${DESIMODEL}... " >> "${logfile}" + PYTHON_CODE=$(cat <> "${logfile}" + # Now commit result + mesg="Appending DB sync ${calfile} to current focalplane model" + svn commit -m "${mesg}" "${svntrunk}/data" >> "${logfile}" + svn up "${svntrunk}/data" >> "${logfile}" + echo "Updating $DESIMODEL_CENTRAL_REPO." >> "${logfile}" + svn up "${DESIMODEL_CENTRAL_REPO}" >> "${logfile}" + else + echo "FAIL" >> "${logfile}" + echo "Refusing to commit broken update. Restore the *.previous files." >> "${logfile}" + fi fi # Send notifications.