Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bind all files/paths needed for host condor config #36

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
16 changes: 12 additions & 4 deletions bootstrap.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash

LPC_CONDOR_CONFIG=/etc/condor/config.d/01_cmslpc_interactive
LPC_CONDOR_LOCAL=/usr/local/bin/cmslpc-local-conf.py

cat <<EOF > shell
#!/usr/bin/env bash

Expand All @@ -18,15 +21,18 @@ else
export COFFEA_IMAGE=\$1
fi

grep -v '^include' /etc/condor/config.d/01_cmslpc_interactive > .condor_config

export APPTAINER_BINDPATH=/uscmst1b_scratch,/cvmfs,/cvmfs/grid.cern.ch/etc/grid-security:/etc/grid-security
export APPTAINER_BINDPATH=${APPTAINER_BINDPATH}${APPTAINER_BINDPATH:+,}/uscmst1b_scratch,/cvmfs,/cvmfs/grid.cern.ch/etc/grid-security:/etc/grid-security,${LPC_CONDOR_CONFIG},${LPC_CONDOR_LOCAL}:${LPC_CONDOR_LOCAL}.orig,.cmslpc-local-conf:${LPC_CONDOR_LOCAL}

APPTAINER_SHELL=\$(which bash) apptainer exec -B \${PWD}:/srv --pwd /srv \\
/cvmfs/unpacked.cern.ch/registry.hub.docker.com/\${COFFEA_IMAGE} \\
/bin/bash --rcfile /srv/.bashrc
EOF

cat <<EOF > .cmslpc-local-conf
#!/bin/bash
python3 ${LPC_CONDOR_LOCAL}.orig | grep -v "LOCAL_CONFIG_FILE"
EOF

cat <<EOF > .bashrc
LPCJQ_VERSION="0.3.1"
install_env() {
Expand All @@ -40,8 +46,10 @@ install_env() {
rm -rf \$TMPDIR && unset TMPDIR
.env/bin/python -m pip install -q git+https://github.com/CoffeaTeam/lpcjobqueue.git@v\${LPCJQ_VERSION}
echo "done."
set +e
}

export CONDOR_CONFIG=${LPC_CONDOR_CONFIG}
export JUPYTER_PATH=/srv/.jupyter
export JUPYTER_RUNTIME_DIR=/srv/.local/share/jupyter/runtime
export JUPYTER_DATA_DIR=/srv/.local/share/jupyter
Expand All @@ -54,5 +62,5 @@ alias pip="python -m pip"
pip show lpcjobqueue 2>/dev/null | grep -q "Version: \${LPCJQ_VERSION}" || pip install -q git+https://github.com/CoffeaTeam/lpcjobqueue.git@v\${LPCJQ_VERSION}
EOF

chmod u+x shell .bashrc
chmod u+x shell .bashrc .cmslpc-local-conf
echo "Wrote shell and .bashrc to current directory. You can delete this file. Run ./shell to start the apptainer shell"
4 changes: 1 addition & 3 deletions src/lpcjobqueue/schedd.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
import re

logger = logging.getLogger(__name__)
os.environ["CONDOR_CONFIG"] = os.path.join("/srv/.condor_config")
if not os.path.isfile(os.environ['CONDOR_CONFIG']):
logger.warn(f"Condor configuration not found! run the following command outside the apptainer instance")
logger.warn(f"grep -v '^include' /etc/condor/config.d/01_cmslpc_interactive > .condor_config")
logger.warn(f"Condor configuration {os.environ['CONDOR_CONFIG']} not found! rerun bootstrap.sh to update shell")
import htcondor # noqa: E402


Expand Down