Skip to content

Commit

Permalink
fix: declare arguments before reference
Browse files Browse the repository at this point in the history
  • Loading branch information
toicca authored Jan 9, 2025
1 parent 2740c92 commit 8d56a77
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions condor/execute.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,34 @@ env

WORKDIR=`pwd`

# Get arguments
declare -A ARGS
for key in workflow output samplejson year campaign isSyst isArray noHist overwrite voms chunk skipbadfiles outputDir remoteRepo; do
ARGS[$key]=$(jq -r ".$key" $WORKDIR/arguments.json)
done

# Set up mamba environment
## Interactive bash script with fallback pointing to $HOME, hence setting $PWD of worker node as $HOME
export HOME=`pwd`

if ${ARGS[remoteRepo]}!="":
wget -L micro.mamba.pm/install.sh
chmod +x install.sh
## FIXME parsing arguments does not work. will use defaults in install.sh instead, see https://github.com/mamba-org/micromamba-releases/blob/main/install.sh
## Tried solutions listed in https://stackoverflow.com/questions/14392525/passing-arguments-to-an-interactive-program-non-interactively
./install.sh <<< $'bin\nY\nY\nmicromamba\n'
source .bashrc
echo "Setting up mamba environment"
if [[ ${ARGS[remoteRepo]} != "" ]]; then
echo "remoteRepo is set to ${ARGS[remoteRepo]}"
wget -L micro.mamba.pm/install.sh
chmod +x install.sh
## FIXME parsing arguments does not work. will use defaults in install.sh instead, see https://github.com/mamba-org/micromamba-releases/blob/main/install.sh
## Tried solutions listed in https://stackoverflow.com/questions/14392525/passing-arguments-to-an-interactive-program-non-interactively
./install.sh <<< $'bin\nY\nY\nmicromamba\n'
source .bashrc
fi

export PATH=$WORKDIR:$PATH


if [ ! -d /afs/cern.ch/user/${USER:0:1}/$USER ]; then
## install necessary packages if on cmsconnect
micromamba install -c conda-forge jq --yes
fi

# Get arguments
declare -A ARGS
for key in workflow output samplejson year campaign isSyst isArray noHist overwrite voms chunk skipbadfiles outputDir remoteRepo; do
ARGS[$key]=$(jq -r ".$key" $WORKDIR/arguments.json)
done

# Create base env with python=3.10 and setuptools<=70.1.1
micromamba activate
micromamba install python=3.10 -c conda-forge xrootd --yes
Expand Down

0 comments on commit 8d56a77

Please sign in to comment.