Skip to content

Commit

Permalink
Merge pull request #3725 from celia-lo/fix_condor
Browse files Browse the repository at this point in the history
Fixing MadGraph5_aMCatNLO condor gridpack generation
  • Loading branch information
menglu21 authored Jun 24, 2024
2 parents 7809665 + 5b1696b commit dc049ac
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
8 changes: 7 additions & 1 deletion bin/MadGraph5_aMCatNLO/PLUGIN/CMS_CLUSTER/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@
multiple_try = misc.multiple_try
pjoin = os.path.join

import socket
hostname = socket.gethostname()

def singularityWraper():
if "lxplus" in hostname:
return f'\nMY.WantOS = \"{hostname.split(".")[0].replace("lxplus","el")}\"\n' # Following https://batchdocs.web.cern.ch/local/submit.html#os-selection-via-containers and simply using hostname

def cleansubproc(subproc):
subproc.terminate()
Expand Down Expand Up @@ -230,7 +236,7 @@ def submit2(self, prog, argument=[], cwd=None, stdout=None, stderr=None,
queue 1
"""

text += singularityWraper()
if self.cluster_queue not in ['None', None]:
requirement = 'Requirements = %s=?=True' % self.cluster_queue
else:
Expand Down
12 changes: 9 additions & 3 deletions bin/MadGraph5_aMCatNLO/Utilities/source_condor.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
#!/bin/bash

# HTCondor python bindings are lost after cmsenv/scram
PYTHON_BINDINGS="$(python3 -c 'import htcondor; import os; print(os.path.dirname(htcondor.__path__[0]))' 2>/dev/null)"
if [ -z "$PYTHON_BINDINGS" ]; then
pip3 install htcondor --user #FIXME need better way to interface HTCondor Python API for Python3.9
#PYTHON_BINDINGS="$(python3 -c 'import htcondor; import os; print(os.path.dirname(htcondor.__path__[0]))' 2>/dev/null)"
#if [ -z "$PYTHON_BINDINGS" ]; then
if [ -d $CMSSW_BASE/venv ];
then
echo "venv exists"
else
scram-venv
cmsenv
pip3 install htcondor --upgrade #FIXME need better way to interface HTCondor Python API for Python3.9
fi

0 comments on commit dc049ac

Please sign in to comment.