Skip to content

Commit

Permalink
crab jobs updated
Browse files Browse the repository at this point in the history
  • Loading branch information
smuzaffar committed Dec 10, 2024
1 parent f015a66 commit 03f42b1
Show file tree
Hide file tree
Showing 24 changed files with 651 additions and 48 deletions.
17 changes: 17 additions & 0 deletions crab/FrameworkJobReport.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<FrameworkJobReport>
<ReadBranches>
</ReadBranches>
<PerformanceReport>
<PerformanceSummary Metric="StorageStatistics">
<Metric Name="Parameter-untracked-bool-enabled" Value="true"/>
<Metric Name="Parameter-untracked-bool-stats" Value="true"/>
<Metric Name="Parameter-untracked-string-cacheHint" Value="application-only"/>
<Metric Name="Parameter-untracked-string-readHint" Value="auto-detect"/>
<Metric Name="ROOT-tfile-read-totalMegabytes" Value="0"/>
<Metric Name="ROOT-tfile-write-totalMegabytes" Value="0"/>
</PerformanceSummary>
</PerformanceReport>

<GeneratorInfo>
</GeneratorInfo>
</FrameworkJobReport>
130 changes: 130 additions & 0 deletions crab/crab-test/pset.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Auto generated configuration file
# using:
# Revision: 1.19
# Source: /local/reps/CMSSW/CMSSW/Configuration/Applications/python/ConfigBuilder.py,v
# with command line options: MinBias_8TeV_cfi --conditions auto:startup -s GEN,SIM --datatier GEN-SIM -n 10
# --relval 9000,300 --eventcontent RAWSIM --io MinBias.io --python MinBias.py --no_exec --fileout minbias.root

import FWCore.ParameterSet.Config as cms

process = cms.Process("SIM")

# Import of standard configurations
process.load("Configuration.StandardSequences.Services_cff")
process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
process.load("FWCore.MessageService.MessageLogger_cfi")
process.load("Configuration.EventContent.EventContent_cff")
process.load("SimGeneral.MixingModule.mixNoPU_cfi")
process.load("Configuration.StandardSequences.GeometryRecoDB_cff")
process.load("Configuration.Geometry.GeometrySimDB_cff")
process.load("Configuration.StandardSequences.MagneticField_38T_cff")
process.load("Configuration.StandardSequences.Generator_cff")
process.load("IOMC.EventVertexGenerators.VtxSmearedRealistic8TeVCollision_cfi")
process.load("GeneratorInterface.Core.genFilterSummary_cff")
process.load("Configuration.StandardSequences.SimIdeal_cff")
process.load("Configuration.StandardSequences.EndOfProcess_cff")
process.load("Configuration.StandardSequences.FrontierConditions_GlobalTag_cff")

process.maxEvents = cms.untracked.PSet(input=cms.untracked.int32(10))

# Input source
process.source = cms.Source("EmptySource")

process.options = cms.untracked.PSet()
process.options.numberOfThreads = cms.untracked.uint32(1)

# Production Info
process.configurationMetadata = cms.untracked.PSet(
version=cms.untracked.string("$Revision: 1.19 $"),
annotation=cms.untracked.string("MinBias_8TeV_cfi nevts:10"),
name=cms.untracked.string("Applications"),
)

# Output definition
process.RAWSIMoutput = cms.OutputModule(
"PoolOutputModule",
splitLevel=cms.untracked.int32(0),
eventAutoFlushCompressedSize=cms.untracked.int32(5242880),
outputCommands=process.RAWSIMEventContent.outputCommands,
fileName=cms.untracked.string("minbias.root"),
dataset=cms.untracked.PSet(
filterName=cms.untracked.string(""), dataTier=cms.untracked.string("GEN-SIM")
),
SelectEvents=cms.untracked.PSet(SelectEvents=cms.vstring("generation_step")),
)

# Additional output definition

# Other statements
process.genstepfilter.triggerConditions = cms.vstring("generation_step")
from Configuration.AlCa.GlobalTag import GlobalTag

process.GlobalTag = GlobalTag(process.GlobalTag, "auto:startup", "")

process.generator = cms.EDFilter(
"Pythia6GeneratorFilter",
pythiaPylistVerbosity=cms.untracked.int32(0),
filterEfficiency=cms.untracked.double(1.0),
pythiaHepMCVerbosity=cms.untracked.bool(False),
comEnergy=cms.double(8000.0),
maxEventsToPrint=cms.untracked.int32(0),
PythiaParameters=cms.PSet(
pythiaUESettings=cms.vstring(
"MSTU(21)=1 ! Check on possible errors during program execution",
"MSTJ(22)=2 ! Decay those unstable particles",
"PARJ(71)=10 . ! for which ctau 10 mm",
"MSTP(33)=0 ! no K factors in hard cross sections",
"MSTP(2)=1 ! which order running alphaS",
"MSTP(51)=10042 ! structure function chosen (external PDF CTEQ6L1)",
"MSTP(52)=2 ! work with LHAPDF",
"PARP(82)=1.921 ! pt cutoff for multiparton interactions",
"PARP(89)=1800. ! sqrts for which PARP82 is set",
"PARP(90)=0.227 ! Multiple interactions: rescaling power",
"MSTP(95)=6 ! CR (color reconnection parameters)",
"PARP(77)=1.016 ! CR",
"PARP(78)=0.538 ! CR",
"PARP(80)=0.1 ! Prob. colored parton from BBR",
"PARP(83)=0.356 ! Multiple interactions: matter distribution parameter",
"PARP(84)=0.651 ! Multiple interactions: matter distribution parameter",
"PARP(62)=1.025 ! ISR cutoff",
"MSTP(91)=1 ! Gaussian primordial kT",
"PARP(93)=10.0 ! primordial kT-max",
"MSTP(81)=21 ! multiple parton interactions 1 is Pythia default",
"MSTP(82)=4 ! Defines the multi-parton model",
),
processParameters=cms.vstring(
"MSEL=0 ! User defined processes",
"MSUB(11)=1 ! Min bias process",
"MSUB(12)=1 ! Min bias process",
"MSUB(13)=1 ! Min bias process",
"MSUB(28)=1 ! Min bias process",
"MSUB(53)=1 ! Min bias process",
"MSUB(68)=1 ! Min bias process",
"MSUB(92)=1 ! Min bias process, single diffractive",
"MSUB(93)=1 ! Min bias process, single diffractive",
"MSUB(94)=1 ! Min bias process, double diffractive",
"MSUB(95)=1 ! Min bias process",
),
parameterSets=cms.vstring("pythiaUESettings", "processParameters"),
),
)

# Path and EndPath definitions
process.generation_step = cms.Path(process.pgen)
process.simulation_step = cms.Path(process.psim)
process.genfiltersummary_step = cms.EndPath(process.genFilterSummary)
process.endjob_step = cms.EndPath(process.endOfProcess)
process.RAWSIMoutput_step = cms.EndPath(process.RAWSIMoutput)

# Schedule definition
process.schedule = cms.Schedule(
process.generation_step,
process.genfiltersummary_step,
process.simulation_step,
process.endjob_step,
process.RAWSIMoutput_step,
)

# Filter all path with the production filter sequence
for path in process.paths:
getattr(process, path)._seq = process.generator * getattr(process, path)._seq
69 changes: 69 additions & 0 deletions crab/crab-test/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#!/bin/bash -e
JENKINS_ID=$(echo ${CRAB_ReqName} | sed 's|.*_||')
if [ "${JENKINS_ID}" = "" ] ; then JENKINS_ID="$$" ; fi
req=$(date +%s)
rm -rf cmdrun
mkdir -p cmdrun
xstart=$(echo "START" | base64)
xend=$(echo "END" | base64)
pushd cmdrun
touch run.log
curl -s -L "https://muzaffar.web.cern.ch/cgi-bin/test-v2?START=1&req=${req}&uid=${JENKINS_ID}" >>run.log 2>&1
req=$(date +%s)
LRUN=${req}
PRECMD=""
RUN_GAP=0
while [ $RUN_GAP -lt 3600 ] ; do
req=$(date +%s)
curl -s -L -o cmd.txt "https://muzaffar.web.cern.ch/crab-test/cmd.txt?req=${req}&uid=${JENKINS_ID}"
cmd=$(grep "^cmd=${JENKINS_ID}=" cmd.txt || true)
if [ "${cmd}" = "" ] ; then
cmd=$(grep "^cmd=0=" cmd.txt || true)
fi
rm -f cmd.txt
cmd=$(echo "$cmd" | sed 's|^.*=|cmd=|')
if [ "$cmd" = "cmd=0" ] ; then
break
fi
if [ "${PRECMD}" = "$cmd" -o "${cmd}" = "" ] ; then
xt=$(date +%s)
xd=0
while [ $xd -lt 9 ] ; do
for i in 0 1 2 3 4 5 6 7 8 9 ; do
for i in 0 1 2 3 4 5 6 7 8 9 ; do
for i in 0 1 2 3 4 5 6 7 8 9 ; do
true
done
done
done
let xd=$(date +%s)-${xt} || true
done
let RUN_GAP=$(date +%s)-${LRUN}
b64=$(echo "previous_${cmd}" | base64)
curl -s -L -X POST -d "$b64" "https://muzaffar.web.cern.ch/cgi-bin/test-v2?WAITING=1&${cmd}&req=${req}&uid=${JENKINS_ID}" >>run.log 2>&1
else
curl -s -L -o run.sh "https://muzaffar.web.cern.ch/crab-test/run.sh?req=${req}&uid=${JENKINS_ID}"
curl -s -L -X POST -d "${xstart}" "https://muzaffar.web.cern.ch/cgi-bin/test-v2?RUN=START&req=${req}&${cmd}&uid=${JENKINS_ID}" >>run.log 2>&1
chmod +x run.sh
./run.sh > run.log 2>&1 || true
total_lines=$(cat run.log | wc -l)
sline=1
xline=20
while [ $sline -le $total_lines ] ; do
sed -n "${sline},+${xline}p" run.log | base64 > run.base64
curl -s -L -X POST -d @run.base64 "https://muzaffar.web.cern.ch/cgi-bin/test-v2?result=${sline}of${total_lines}&${cmd}&req=${req}&uid=${JENKINS_ID}" >>run.log 2>&1
sleep 1
let sline=$sline+$xline+1
done
curl -s -L -X POST -d "${xend}" "https://muzaffar.web.cern.ch/cgi-bin/test-v2?RUN=END&req=${req}&${cmd}&uid=${JENKINS_ID}" >>run.log 2>&1
rm -f run.sh run.log run.base64
PRECMD="${cmd}"
LRUN=$(date +%s)
RUN_GAP=0
fi
done
popd
req=$(date +%s)
mv cmdrun/run.log .
rm -rf cmdrun
curl -s -L "https://muzaffar.web.cern.ch/cgi-bin/test-v2?END=1&req=${req}&uid=${JENKINS_ID}" >>run.log 2>&1
4 changes: 4 additions & 0 deletions crab/crab-test/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash -ex
scram build enable-multi-targets
cp $(dirname $0)/../FrameworkJobReport.xml $WORKSPACE/
cp $(dirname $0)/../minbias.root $WORKSPACE/
44 changes: 44 additions & 0 deletions crab/crab-test/task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
from CRABClient.UserUtilities import config
import os, re, time

archs = os.environ["SCRAM_ARCH"].split("_")
osMajorVer = int(re.sub("[a-z]", "", archs[0]))

config = config()
config.General.instance = os.getenv("CRABCONFIGINSTANCE", "prod")
config.General.requestName = os.getenv("CRAB_REQUEST", str(int(time.time())))
config.General.transferOutputs = True
config.General.transferLogs = False

config.Data.unitsPerJob = 10
config.Data.totalUnits = 10
config.Data.splitting = "EventBased"
config.Data.publication = False

config.JobType.psetName = "pset.py"
config.JobType.pluginName = "PrivateMC"
config.JobType.maxJobRuntimeMin = int(os.getenv("CRAB_MAX_TIME", "600"))
config.JobType.maxMemoryMB = 2000
config.JobType.numCores = 1
config.JobType.allowUndistributedCMSSW = True
config.JobType.scriptExe = "run.sh"
config.JobType.disableAutomaticOutputCollection = True
config.JobType.outputFiles = ["run.log"]
config.JobType.inputFiles = ["FrameworkJobReport.xml", "minbias.root"]

config.Site.storageSite = "T2_CH_CERN"

if "CRAB_SCHEDD_NAME" in os.environ and os.environ["CRAB_SCHEDD_NAME"] != "":
config.Debug.scheddName = os.environ["CRAB_SCHEDD_NAME"]
if "CRAB_COLLECTOR" in os.environ and os.environ["CRAB_COLLECTOR"] != "":
config.Debug.collector = os.environ["CRAB_COLLECTOR"]

config.Debug.extraJDL = ['+REQUIRED_OS="rhel%s"' % osMajorVer]
if "amd64" == archs[1]:
config.Debug.extraJDL.append(
'+DESIRED_Archs="%s"' % "X86_64" if ("amd64" == archs[1]) else archs[1]
)
if "SINGULARITY_IMAGE" in os.environ and os.environ["SINGULARITY_IMAGE"] != "":
config.Debug.extraJDL.append('+SingularityImage="%s"' % os.environ["SINGULARITY_IMAGE"])
if "CRAB_SITE" in os.environ and os.environ["CRAB_SITE"] != "":
config.Debug.extraJDL.append('+DESIRED_Sites="%s"' % os.environ["CRAB_SITE"])
29 changes: 19 additions & 10 deletions crab/ib-run-crab.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,16 @@ report() {
fi
}

thisdir=$(dirname $0)
[ "${CRABCLIENT_TYPE}" != "" ] || export CRABCLIENT_TYPE="prod"
[ "${BUILD_ID}" != "" ] || export BUILD_ID=$(date +%s)
[ "${WORKSPACE}" != "" ] || export WORKSPACE=$(pwd)
[ "${CRABCONFIGINSTANCE}" != "" ]|| export CRABCONFIGINSTANCE="prod"
[ "${JOB_DIR}" != "" ] || JOB_DIR="."

#Checkout a package
git cms-addpkg FWCore/Version
[ -x ${thisdir}/${JOB_DIR}/setup.sh ] && ${thisdir}/${JOB_DIR}/setup.sh
#Added test python module and script to make sure it is part of card sandbox
mkdir -p ${CMSSW_BASE}/src/FWCore/Version/python ${CMSSW_BASE}/src/FWCore/Version/scripts
echo 'CMSBOT_CRAB_TEST="OK"' > ${CMSSW_BASE}/src/FWCore/Version/python/cmsbot_crab_test.py
Expand All @@ -23,11 +31,6 @@ if [ -d ${CMSSW_BASE}/biglib/${SCRAM_ARCH} ] ; then
[ -e $l ] || rm -f $l
done
fi
[ "${CRABCLIENT_TYPE}" != "" ] || export CRABCLIENT_TYPE="prod"
[ "${BUILD_ID}" != "" ] || export BUILD_ID=$(date +%s)
[ "${WORKSPACE}" != "" ] || export WORKSPACE=$(pwd) && cd $WORKSPACE
[ "${CRABCONFIGINSTANCE}" != "" ]|| export CRABCONFIGINSTANCE="prod"
[ "${JOB_DIR}" != "" ] || JOB_DIR="."

if [ "${SINGULARITY_IMAGE}" = "" ] ; then
osver=$(echo ${SCRAM_ARCH} | tr '_' '\n' | head -1 | sed 's|^[a-z][a-z]*||')
Expand All @@ -41,20 +44,26 @@ fi

export CRAB_REQUEST="Jenkins_${CMSSW_VERSION}_${SCRAM_ARCH}_${BUILD_ID}"
cmssw_queue=$(echo ${CMSSW_VERSION} | cut -d_ -f1-3)_X
thisdir=$(dirname $0)
cp ${thisdir}/${JOB_DIR}/run.sh .
cd $WORKSPACE
for f in run.sh task.py pset.py ; do
if [ -e ${thisdir}/${JOB_DIR}/$f ] ; then
cp ${thisdir}/${JOB_DIR}/$f .
else
cp ${thisdir}/$f .
fi
done
if [ -e ${thisdir}/${cmssw_queue}/pset.py ] ; then
rm -f pset.py
cp ${thisdir}/${cmssw_queue}/pset.py .
else
cp ${thisdir}/${JOB_DIR}/pset.py .
fi
if [ "${X509_USER_PROXY}" = "" ] ; then
voms-proxy-init -voms cms
export X509_USER_PROXY=$(voms-proxy-info -path)
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 --proxy ${X509_USER_PROXY} -c ${thisdir}/${JOB_DIR}/task.py
ls
crab submit --proxy ${X509_USER_PROXY} -c ./task.py
rm -rf ${WORKSPACE}/crab
mv crab_${CRAB_REQUEST} ${WORKSPACE}/crab
echo "INPROGRESS" > $WORKSPACE/crab/statusfile
Expand Down
Binary file added crab/minbias.root
Binary file not shown.
1 change: 0 additions & 1 deletion crab/multiarch/pset.py

This file was deleted.

26 changes: 0 additions & 26 deletions crab/multiarch/run.sh

This file was deleted.

2 changes: 2 additions & 0 deletions crab/multiarch/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash
scram build enable-multi-targets
1 change: 0 additions & 1 deletion crab/multiarch/task.py

This file was deleted.

5 changes: 1 addition & 4 deletions crab/run.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash -ex
pwd
ls
env > run.log
ld.so --help | grep supported | grep x86-64-v
which cmsRun
cmsRun --help
cmsRun -j FrameworkJobReport.xml PSet.py
cmsRun -j FrameworkJobReport.xml PSet.py >>run.log 2>&1
6 changes: 1 addition & 5 deletions crab/scram-build/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ pushd $CMSSW_BASE
scram build enable-multi-targets
rm -rf src
mkdir src
git clone https://github.com/cms-sw/cmssw-config
cd cmssw-config; git checkout V09-06-02 ; cd ..
rm -rf config/SCRAM; mv cmssw-config/SCRAM config/SCRAM
git cms-addpkg '*' > $log
scram b -v -k -j $(nproc) >$log 2>&1 || true
eval `scram run -sh`
Expand All @@ -17,5 +14,4 @@ pushd $CMSSW_BASE
which cmsRun
cmsRun --help >>$log || true
popd
[ -f $log ] || mv $CMSSW_BASE/$log $log
cmsRun -j FrameworkJobReport.xml PSet.py || true
cmsRun -j FrameworkJobReport.xml PSet.py >run.log 2>&1 || true
Loading

0 comments on commit 03f42b1

Please sign in to comment.