Skip to content

Commit

Permalink
Merge pull request #4608 from mmascher/master
Browse files Browse the repository at this point in the history
Add init-light script for lightweight client; fixed few bugs; updated…
  • Loading branch information
mmascher committed Apr 7, 2016
2 parents 2d0da53 + be0733a commit 1c11135
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
*.pyc
.project
.pydevproject
tags
28 changes: 28 additions & 0 deletions etc/init-light.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
if [ -z "$CRAB_SOURCE_SCRIPT" ]; then
CRAB_SOURCE_SCRIPT="/cvmfs/cms.cern.ch/crab3/crab.sh"
fi

function getVariableValue {
VARNAME=$1
SUBDIR=$2
sh -c "source $CRAB_SOURCE_SCRIPT >/dev/null 2>/dev/null; if [ \$? -eq 0 ] && [ -d $VARNAME ]; \
then echo $VARNAME/$SUBDIR; else exit 1; fi"
}

CRAB3_BIN_ROOT=$(getVariableValue \$CRABCLIENT_ROOT bin)
CRAB3_ETC_ROOT=$(getVariableValue \$CRABCLIENT_ROOT etc)
CRAB3_PY_ROOT=$(getVariableValue \$CRABCLIENT_ROOT \$PYTHON_LIB_SITE_PACKAGES)
DBS3_PY_ROOT=$(getVariableValue \$DBS3_CLIENT_ROOT \$PYTHON_LIB_SITE_PACKAGES)
DBS3_PYCURL_ROOT=$(getVariableValue \$DBS3_PYCURL_CLIENT_ROOT \$PYTHON_LIB_SITE_PACKAGES)

export PYTHONPATH=$PYTHONPATH:$CRAB3_PY_ROOT:$DBS3_PY_ROOT:$DBS3_PYCURL_ROOT
export PATH=$PATH:$CRAB3_BIN_ROOT
if [ -n "$BASH" ]; then
echo bash is set
source $CRAB3_ETC_ROOT/crab-bash-completion.sh
fi

#[mmascher@lxplus007 ~]$ export CRAB_SOURCE_SCRIPT=/cvmfs/cms.cern.ch/crab3/crab_pre.sh
#[mmascher@lxplus007 ~]$ source ~/repos/CRABClient/init-light.sh
#[mmascher@lxplus007 ~]$ crab
2 changes: 1 addition & 1 deletion src/python/CRABClient/Commands/purge.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __call__(self):
except HTTPException as re:
if 'X-Error-Info' in re.headers and 'Not such file' in re.headers['X-Error-Info']:
self.logger.info('%sError%s: Failed to find task file in crab server cache; the file might have been already purged' % (colors.RED,colors.NORMAL))
raise HTTPException(re)
raise

if ufcresult == '':
self.logger.info('%sSuccess%s: Successfully removed task files from crab server cache' % (colors.GREEN, colors.NORMAL))
Expand Down
2 changes: 1 addition & 1 deletion src/python/CRABClient/Commands/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def executeTestRun(self, filecacheurl):
Runs a trial to obtain the performance report. Repeats trial with successively larger input events
until a job length of maxSeconds is reached (this improves accuracy for fast-running CMSSW parameter sets.)
"""
ufc = CRABClient.Emulator.getEmulator('ufc')({'endpoint' : filecacheurl})
ufc = CRABClient.Emulator.getEmulator('ufc')({'endpoint' : filecacheurl, "pycurl": True})
cwd = os.getcwd()
try:
tmpDir = tempfile.mkdtemp()
Expand Down
2 changes: 1 addition & 1 deletion src/python/CRABClient/JobType/UserTarball.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def upload(self, filecacheurl=None):
self.close()
archiveName = self.tarfile.name
self.logger.debug("Uploading archive %s to the CRAB cache. Using URI %s" % (archiveName, filecacheurl))
ufc = CRABClient.Emulator.getEmulator('ufc')({'endpoint' : filecacheurl})
ufc = CRABClient.Emulator.getEmulator('ufc')({'endpoint' : filecacheurl, "pycurl": True})
result = ufc.upload(archiveName, excludeList = USER_SANDBOX_EXCLUSIONS)
if 'hashkey' not in result:
self.logger.error("Failed to upload source files: %s" % str(result))
Expand Down

0 comments on commit 1c11135

Please sign in to comment.