Skip to content

Instantly share code, notes, and snippets.

@LincolnBryant
Last active August 29, 2015 14:16
Show Gist options
  • Save LincolnBryant/e8ce76a84be1e4559abf to your computer and use it in GitHub Desktop.
Save LincolnBryant/e8ce76a84be1e4559abf to your computer and use it in GitHub Desktop.
StashCache=(`grep ^WantsStashCache $_CONDOR_JOB_AD`)
PosixStashCache=(`grep ^WantsPosixStashCache $_CONDOR_JOB_AD`)
function setup_stashcp {
module load xrootd
module load stashcp
# Determine XRootD plugin directory.
# in lieu of a MODULE_<name>_BASE from lmod, this will do:
export MODULE_XROOTD_BASE=$(which xrdcp | sed -e 's,/bin/.*,,')
export XRD_PLUGINCONFDIR=$MODULE_XROOTD_BASE/etc/xrootd/client.plugins.d
}
# Check for PosixStashCache first
if [[ ${PosixStashCache[2]} == 'true' || "${PosixStashcache[2]}" == '1' ]]; then
setup_stashcp
# Add the LD_PRELOAD hook
export LD_PRELOAD=$MODULE_XROOTD_BASE/lib64/libXrdPosixPreload.so:$LD_PRELOAD
# Set proxy for virtual mount point
# Format: cache.domain.edu/local_mount_point=/storage_path
# E.g.: export XROOTD_VMP=data.ci-connect.net:/stash=/
# Currently this points _ONLY_ to the OSG Connect source server
export XROOTD_VMP=$(stashcp --closest | cut -d'/' -f3):/stash=/
elif [[ "${StashCache[2]}" == 'true' || "${StashCache[2]}" == '1' ]]; then
setup_stashcp
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment