Skip to content

Commit

Permalink
Merge pull request #59 from desihub/utah-transfer
Browse files Browse the repository at this point in the history
[WIP] Utah transfers
  • Loading branch information
weaverba137 committed May 1, 2024
2 parents 1c0d80e + 99da3fe commit d4216f2
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 47 deletions.
58 changes: 11 additions & 47 deletions bin/desi_tucson_transfer_catchup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,28 @@ if [[ -z "${DESI_ROOT}" ]]; then
echo "ERROR: DESI_ROOT is undefined!"
exit 1
fi
#
# Do not expand globs, pass them on to rsync.
#
set -o noglob
#
# Configuration.
#
syn="/usr/bin/rsync --archive --verbose --delete --delete-after --no-motd --password-file ${HOME}/.desi"
src=rsync://${DESISYNC_HOSTNAME}/desi
dst=${DESI_ROOT}
log_root=${HOME}/Documents/Logfiles

#
# Execute rsync commands.
#
for d in engineering/focalplane engineering/focalplane/hwtables \
spectro/data \
spectro/redux/daily spectro/redux/daily/exposures spectro/redux/daily/preproc spectro/redux/daily/tiles \
spectro/nightwatch/kpno spectro/staging/lost+found; do
case ${d} in
engineering/focalplane) priority='nice'; exclude='--exclude archive --exclude hwtables --exclude *.ipynb --exclude .ipynb_checkpoints' ;;
engineering/focalplane/hwtables) priority='nice'; exclude='--include *.csv --exclude *' ;;
spectro/data) priority=''; exclude='--exclude 2018* --exclude 2019* --exclude 2020* --exclude 2021* --exclude 2022*' ;;
spectro/data) priority=''; exclude='--exclude 2018* --exclude 2019* --exclude 2020* --exclude 2021* --exclude 2022* --exclude 2023*' ;;
spectro/redux/daily) priority=''; exclude='--exclude *.tmp --exclude attic --exclude exposures --exclude preproc --exclude temp --exclude tiles' ;;
spectro/redux/daily/exposures) priority=''; exclude='--exclude *.tmp' ;;
spectro/redux/daily/preproc) priority=''; exclude='--exclude *.tmp --exclude preproc-*.fits --exclude preproc-*.fits.gz' ;;
Expand All @@ -34,48 +43,3 @@ for d in engineering/focalplane engineering/focalplane/hwtables \
echo "${priority} ${syn} ${exclude} ${src}/${d}/ ${dst}/${d}/ &>> ${log} &"
${priority} ${syn} ${exclude} ${src}/${d}/ ${dst}/${d}/ &>> ${log} &
done

# log=${log_root}/catchup_engineering_focalplane.log
# [[ -f ${log} ]] || touch ${log}
# nice ${syn} --exclude archive --exclude hwtables --exclude \*.ipynb --exclude .ipynb_checkpoints \
# ${src}/engineering/focalplane/ ${dst}/engineering/focalplane/ &>> ${log} &

# log=${log_root}/catchup_engineering_focalplane_hwtables.log
# [[ -f ${log} ]] || touch ${log}
# nice ${syn} --include \*.csv --exclude \* \
# ${src}/engineering/focalplane/hwtables/ ${dst}/engineering/focalplane/hwtables/ &>> ${log} &

# log=${log_root}/catchup_spectro_data.log
# [[ -f ${log} ]] || touch ${log}
# ${syn} --exclude 2018\* --exclude 2019\* --exclude 2020\* --exclude 2021\* --exclude 2022\* \
# ${src}/spectro/data/ ${dst}/spectro/data/ &>> ${log} &

# log=${log_root}/catchup_spectro_redux_daily.log
# [[ -f ${log} ]] || touch ${log}
# ${syn} --exclude \*.tmp --exclude attic --exclude exposures --exclude preproc --exclude temp --exclude tiles \
# ${src}/spectro/redux/daily/ ${dst}/spectro/redux/daily/ &>> ${log} &

# log=${log_root}/catchup_spectro_redux_daily_exposures.log
# [[ -f ${log} ]] || touch ${log}
# ${syn} --exclude \*.tmp \
# ${src}/spectro/redux/daily/exposures/ ${dst}/spectro/redux/daily/exposures/ &>> ${log} &

# log=${log_root}/catchup_spectro_redux_daily_preproc.log
# [[ -f ${log} ]] || touch ${log}
# ${syn} --exclude \*.tmp --exclude preproc-\*.fits --exclude preproc-\*.fits.gz \
# ${src}/spectro/redux/daily/preproc/ ${dst}/spectro/redux/daily/preproc/ &>> ${log} &

# log=${log_root}/catchup_spectro_redux_daily_tiles.log
# [[ -f ${log} ]] || touch ${log}
# ${syn} --exclude \*.tmp --exclude temp \
# ${src}/spectro/redux/daily/tiles/ ${dst}/spectro/redux/daily/tiles/ &>> ${log} &

# log=${log_root}/catchup_spectro_nightwatch_kpno.log
# [[ -f ${log} ]] || touch ${log}
# nice ${syn} \
# ${src}/spectro/nightwatch/kpno/ ${dst}/spectro/nightwatch/kpno/ &>> ${log} &

# log=${log_root}/catchup_spectro_staging_lost+found.log
# [[ -f ${log} ]] || touch ${log}
# nice ${syn} \
# ${src}/spectro/staging/lost+found/ ${dst}/spectro/staging/lost+found/ &>> ${log} &
91 changes: 91 additions & 0 deletions bin/desi_utah_transfer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/bin/bash
#
# Parallel copy DESI mirror data to Utah.
#
#
# Help!
#
function usage() {
local execName=$(basename $0)
(
echo "${execName} [-h] [-t] [-v]"
echo ""
echo "Parallel copy DESI mirror data to Utah."
echo ""
echo " -h = Print this message and exit."
echo " -t = Test mode. Do not make any changes. Implies -v."
echo " -v = Verbose mode. Print extra information."
echo ""
) >&2
}
#
# Do not expand globs, pass them on to rsync.
#
set -o noglob
#
# Environment variables.
#
if [[ -z "${DESITRANSFER}" ]]; then
echo "ERROR: DESITRANSFER is undefined!"
exit 1
fi
if [[ -z "${DESISYNC_HOSTNAME}" ]]; then
echo "ERROR: DESISYNC_HOSTNAME is undefined!"
exit 1
fi
if [[ -z "${DESI_ROOT}" ]]; then
echo "ERROR: DESI_ROOT is undefined!"
exit 1
fi
if [[ -z "${DAILY_TILES_CUMULATIVE_OUTPUT}" ]]; then
echo "ERROR: DAILY_TILES_CUMULATIVE_OUTPUT is undefined!"
exit 1
fi
#
# Configuration.
#
syn="/usr/bin/rsync --archive --verbose --delete --delete-after --no-motd --password-file ${HOME}/.desi"
src=rsync://${DESISYNC_HOSTNAME}/desi
dst=${DESI_ROOT}
log_root=${HOME}/Documents/Logfiles
verbose=/usr/bin/false
test=/usr/bin/false
while getopts htv argname; do
case ${argname} in
h) usage; exit 0 ;;
t) test=/usr/bin/true; verbose=/usr/bin/true ;;
v) verbose=/usr/bin/true ;;
*) usage; exit 1 ;;
esac
done
shift $((OPTIND - 1))
#
# Set user-write on some files.
#
${verbose} && echo "chmod -R u+w ${dst}/spectro/redux/daily/tiles/cumulative"
${test} || chmod -R u+w ${dst}/spectro/redux/daily/tiles/cumulative
#
# Copy the daily/tiles/cumulative description file from NERSC.
#
wget --quiet --unlink --output-document=${DESI_ROOT}/spectro/redux/daily_tiles_cumulative.txt ${DAILY_TILES_CUMULATIVE_OUTPUT}
#
# Execute rsync commands.
#
for d in spectro/redux/daily spectro/redux/daily/calibnight \
spectro/redux/daily/exposure_tables spectro/redux/daily/exposures \
spectro/redux/daily/preproc spectro/redux/daily/processing_tables \
spectro/redux/daily/tiles/archive spectro/redux/daily/tiles/cumulative \
survey/GFA; do
case ${d} in
spectro/redux/daily) priority='nice'; exclude="--include-from ${DESITRANSFER}/py/desitransfer/data/desi_utah_daily.txt --exclude *" ;;
spectro/redux/daily/calibnight) priority='nice'; exclude='--include 202403?? --include *.fits --include *.fits.gz --include *.csv --include tmp --include old --exclude *' ;;
spectro/redux/daily/exposures) priority='nice'; exclude='--include 202403?? --include 202403??/???????? --include *.fits --include *.fits.gz --include *.csv --exclude *' ;;
spectro/redux/daily/preproc) priority='nice'; exclude='--include 202403?? --include 202403??/???????? --include fibermap-*.fits --include preproc-*.fits.gz --include tilepix-*.json --exclude *' ;;
spectro/redux/daily/tiles/cumulative) priority='nice'; exclude="--files-from ${DESI_ROOT}/spectro/redux/daily_tiles_cumulative.txt" ;;
*) priority=''; exclude='' ;;
esac
log=${log_root}/utah_$(tr '/' '_' <<<${d}).log
[[ -f ${log} ]] || touch ${log}
${verbose} && echo "${priority} ${syn} ${exclude} ${src}/${d}/ ${dst}/${d}/ &>> ${log} &"
${test} || ${priority} ${syn} ${exclude} ${src}/${d}/ ${dst}/${d}/ &>> ${log} &
done
15 changes: 15 additions & 0 deletions py/desitransfer/data/desi_utah_daily.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# tiles/cumulative has a lot of symlinks into tiles/archive.
# * Save all symlinks
# * Save only last 30 days of non-symlinks.
#
# find . -type l > ~/daily_tiles_cumulative.txt
# find . -type f | grep -E '^\./[0-9]+/202403../' >> ~/daily_tiles_cumulative.txt
# rsync -rlvtO --files-from $HOME/daily_tiles_cumulative.txt rsync://${DESISYNC_HOSTNAME}/desi/spectro/redux/daily/tiles/cumulative/ tiles/cumulative/
#
dashboard
dashboard.html
exposures-daily.*
tiles.*
tiles-daily.*
tsnr-exposures.*

0 comments on commit d4216f2

Please sign in to comment.