Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream'
Browse files Browse the repository at this point in the history
  • Loading branch information
gartung committed Nov 4, 2024
2 parents bcc8f68 + ae91153 commit d45d605
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 21 deletions.
12 changes: 0 additions & 12 deletions crab/CMSSW_5_3_X/pset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,6 @@
# Source: /local/reps/CMSSW/CMSSW/Configuration/PyReleaseValidation/python/ConfigBuilder.py,v
# with command line options: MinBias_8TeV_cfi --conditions auto:startup -s GEN,SIM --datatier GEN-SIM -n 10 --relval 25000,250 --eventcontent RAWSIM --fileout file:step1.root
# Testing cmsbot crab setup
def cmsbot_crab_test():
import sys
from subprocess import getstatusoutput
from FWCore.Version.cmsbot_crab_test import CMSBOT_CRAB_TEST

cmsbot_exit, cmsbot_out = getstatusoutput("cmsbot_crab_test.sh")
print("CMSBOT Crab Test:", CMSBOT_CRAB_TEST, cmsbot_exit, cmsbot_out)
if cmsbot_exit or (cmsbot_out != "OK") or (CMSBOT_CRAB_TEST != "OK"):
sys.exit(1)

cmsbot_crab_test()

import FWCore.ParameterSet.Config as cms

process = cms.Process('SIM')
Expand Down
1 change: 1 addition & 0 deletions crab/CMSSW_9_4_X
6 changes: 5 additions & 1 deletion crab/ib-run-crab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ if [ -e ${thisdir}/${cmssw_queue}/pset.py ] ; then
else
export CMSRUN_PSET=${thisdir}/pset.py
fi
voms-proxy-init -voms cms || voms-proxy-init
if [ "${X509_USER_PROXY}" = "" ] ; then
voms-proxy-init -voms cms
fi
pyver=$(${CMSBOT_PYTHON_CMD} -c 'import sys;print("python%s%s" % (sys.version_info[0],sys.version_info[1]))')
if [ -e ${thisdir}/${pyver} ] ; then export PYTHONPATH="${thisdir}/${pyver}:${PYTHONPATH}"; fi
crab submit -c ${thisdir}/task.py
rm -rf ${WORKSPACE}/crab
mv crab_${CRAB_REQUEST} ${WORKSPACE}/crab
Expand Down
100 changes: 100 additions & 0 deletions crab/python26/functools.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
"""functools.py - Tools for working with functions and callable objects
"""
# Python module wrapper for _functools C module
# to allow utilities written in Python to be added
# to the functools module.
# Written by Nick Coghlan <ncoghlan at gmail.com>
# Copyright (C) 2006 Python Software Foundation.
# See C source code for _functools credits/copyright

from _functools import partial, reduce

# update_wrapper() and wraps() are tools to help write
# wrapper functions that can handle naive introspection

WRAPPER_ASSIGNMENTS = ('__module__', '__name__', '__doc__')
WRAPPER_UPDATES = ('__dict__',)
def update_wrapper(wrapper,
wrapped,
assigned = WRAPPER_ASSIGNMENTS,
updated = WRAPPER_UPDATES):
"""Update a wrapper function to look like the wrapped function
wrapper is the function to be updated
wrapped is the original function
assigned is a tuple naming the attributes assigned directly
from the wrapped function to the wrapper function (defaults to
functools.WRAPPER_ASSIGNMENTS)
updated is a tuple naming the attributes of the wrapper that
are updated with the corresponding attribute from the wrapped
function (defaults to functools.WRAPPER_UPDATES)
"""
for attr in assigned:
setattr(wrapper, attr, getattr(wrapped, attr))
for attr in updated:
getattr(wrapper, attr).update(getattr(wrapped, attr, {}))
# Return the wrapper so this can be used as a decorator via partial()
return wrapper

def wraps(wrapped,
assigned = WRAPPER_ASSIGNMENTS,
updated = WRAPPER_UPDATES):
"""Decorator factory to apply update_wrapper() to a wrapper function
Returns a decorator that invokes update_wrapper() with the decorated
function as the wrapper argument and the arguments to wraps() as the
remaining arguments. Default arguments are as for update_wrapper().
This is a convenience function to simplify applying partial() to
update_wrapper().
"""
return partial(update_wrapper, wrapped=wrapped,
assigned=assigned, updated=updated)

def total_ordering(cls):
"""Class decorator that fills in missing ordering methods"""
convert = {
'__lt__': [('__gt__', lambda self, other: not (self < other or self == other)),
('__le__', lambda self, other: self < other or self == other),
('__ge__', lambda self, other: not self < other)],
'__le__': [('__ge__', lambda self, other: not self <= other or self == other),
('__lt__', lambda self, other: self <= other and not self == other),
('__gt__', lambda self, other: not self <= other)],
'__gt__': [('__lt__', lambda self, other: not (self > other or self == other)),
('__ge__', lambda self, other: self > other or self == other),
('__le__', lambda self, other: not self > other)],
'__ge__': [('__le__', lambda self, other: (not self >= other) or self == other),
('__gt__', lambda self, other: self >= other and not self == other),
('__lt__', lambda self, other: not self >= other)]
}
roots = set(dir(cls)) & set(convert)
if not roots:
raise ValueError('must define at least one ordering operation: < > <= >=')
root = max(roots) # prefer __lt__ to __le__ to __gt__ to __ge__
for opname, opfunc in convert[root]:
if opname not in roots:
opfunc.__name__ = opname
opfunc.__doc__ = getattr(int, opname).__doc__
setattr(cls, opname, opfunc)
return cls

def cmp_to_key(mycmp):
"""Convert a cmp= function into a key= function"""
class K(object):
__slots__ = ['obj']
def __init__(self, obj, *args):
self.obj = obj
def __lt__(self, other):
return mycmp(self.obj, other.obj) < 0
def __gt__(self, other):
return mycmp(self.obj, other.obj) > 0
def __eq__(self, other):
return mycmp(self.obj, other.obj) == 0
def __le__(self, other):
return mycmp(self.obj, other.obj) <= 0
def __ge__(self, other):
return mycmp(self.obj, other.obj) >= 0
def __ne__(self, other):
return mycmp(self.obj, other.obj) != 0
def __hash__(self):
raise TypeError('hash not implemented')
return K
17 changes: 11 additions & 6 deletions docker_launcher.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@ fi
export DBS_URL=https://cmsweb.cern.ch:8443/dbs/prod/global/DBSReader
export GIT_CONFIG_NOSYSTEM=1
if [ "X$WORKSPACE" = "X" ] ; then export WORKSPACE=$(/bin/pwd) ; fi
x509_proxyfile=x509up_u`id -u`
export X509_USER_PROXY=$WORKSPACE/${x509_proxyfile}
#Make sure to delete /tmp/${x509_proxyfile} as dasgoclient prefer to read it instead of $X509_USER_PROXY
#See https://github.com/dmwm/dasgoclient/issues/37
[ ! -e /tmp/${x509_proxyfile} ] || rm -f /tmp/${x509_proxyfile}
if [ "${X509_USER_PROXY}" = "" ] ; then
x509_proxyfile=x509up_u`id -u`
export X509_USER_PROXY=$WORKSPACE/${x509_proxyfile}
#Make sure to delete /tmp/${x509_proxyfile} as dasgoclient prefer to read it instead of $X509_USER_PROXY
#See https://github.com/dmwm/dasgoclient/issues/37
[ ! -e /tmp/${x509_proxyfile} ] || rm -f /tmp/${x509_proxyfile}
fi
XPATH=""
py3or2_dir="$HOME/bin"
if [ ! -e ${py3or2_dir} ] ; then
Expand Down Expand Up @@ -93,7 +95,10 @@ if [ "X$DOCKER_IMG" != X -a "X$RUN_NATIVE" = "X" ]; then
if [ -d $HOME/bin ] ; then
CMD2RUN="${CMD2RUN}export PATH=\$HOME/bin:\$PATH; "
fi
CMD2RUN="${CMD2RUN}voms-proxy-init -voms cms -rfc -valid 24:00 || true ; voms-proxy-info || true; echo \$HOME; cd $WORKSPACE; echo \$PATH; $@"
if [ "$X509_USER_PROXY" = "" ] ; then
CMD2RUN="${CMD2RUN}voms-proxy-init -voms cms -rfc -valid 24:00 || true ; voms-proxy-info || true; "
fi
CMD2RUN="${CMD2RUN}echo \$HOME; cd $WORKSPACE; echo \$PATH; $@"
if $HAS_DOCKER ; then
docker pull $DOCKER_IMG
set +x
Expand Down
6 changes: 4 additions & 2 deletions run-ib-testbase.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ cvmfs_config probe || true
for cvmfs_dir in cms-ci.cern.ch \$(grep CVMFS_REPOSITORIES= /etc/cvmfs/default.local | sed "s|.*=||;s|'||g" | sed 's|"||g' | tr ',' '\n' | grep cern.ch) ; do
ls -l /cvmfs/\${cvmfs_dir} >/dev/null 2>&1 || true
done
voms-proxy-init -voms cms || true
voms-proxy-info || true
if [ "${X509_USER_PROXY}" = "" ] ; then
voms-proxy-init -voms cms || true
voms-proxy-info || true
fi
if [ "\$(systemctl is-system-running 2>/dev/null || true)" = "offline" ] ; then
if [ "\${DBUS_SESSION_BUS_ADDRESS}" != "" ] ; then
unset DBUS_SESSION_BUS_ADDRESS
Expand Down

0 comments on commit d45d605

Please sign in to comment.