CRAB (Cms Remote Analysis Builder) on LXPLUS (or LXSLC3)
This Twiki refers to CRAB_1_5_2, which is fine for CMSSW_1_3_X and lower. CMSSW_1_4_X or higher requires using a later version (1_5_3_pre3 perhaps).
Contents
Setup Environment
First login to CERN. For CMSSW_1_3_X or lower
ssh <username>@lxslc3.cern.ch
For CMSSW_1_4_X and higher
ssh <username>@lxplus.cern.ch
Set up the UI environment.
source /afs/cern.ch/cms/LCG/LCG-2/UI/cms_ui_env.(c)sh
Then go to your project area src directory and setup your CMSSW runtime environment
eval `scramv1 runtime -(c)sh`
Next setup the crab environment.
source /afs/cern.ch/cms/ccs/wm/scripts/Crab/CRAB_1_5_2/crab.(c)sh
If you are using CMSSW_1_4_X or higher, replace CRAB_1_5_2 with a later version.
Now, if you have your
crab.cfg file, you can run the
crab commands.
The crab.cfg File
You will need a CRAB configuration file named crab.cfg in the directory where you run the
crab commands. An example crab.cfg file is below. There is a more complete list of parameters
here.
#crab.cfg
[CRAB]
jobtype = cmssw
scheduler = edg
[CMSSW]
#find datasets on http://cmsdbs.cern.ch/DBS2_discovery/
datasetpath = /RelVal131Higgs-ZZ-4Mu/CMSSW_1_3_1-1176118250/GEN-SIM-DIGI-RECO
pset = /afs/cern.ch/user/s/ssimon/CMSSW_1_3_1/src/higgs.cfg
total_number_of_events = 100
number_of_jobs =10
output_file = histograms.root
[USER]
return_data =1
use_central_bossDB = 0
use_boss_rt = 0
[EDG]
rb = CERN
proxy_server = myproxy.cern.ch
virtual_organization = cms
retry_count = 0
lcg_catalog_type = lfc
lfc_host = lfc-cms-test.cern.ch
lfc_home = /grid/cms
Crab Commands
In the directory where your crab.cfg file, run the following commands:
crab -create
Enter your Grid certificate passphrase when prompted.
Crab will create your jobs and find compatible sites for your jobs. Crab also creates the directory crab_0_date_time in your workarea.
Next you submit your job(s).
crab -submit
Check the status of your jobs with
crab -status
One your jobs are done, get the output with the command
crab -getoutput
The above three commands can run for a specific project ( say crab_0_071231_235959 ) with the option -c
crab -command -c crab_0_071231_235959
Crab Script
You can source the following script to create your crab job(s). Note this script is for csh, not bash.
You will need to create the direcctory crab_output on CASTOR by the command
rfmkdir /castor/cern.ch/user/s/ssimon/castor_output
rfchmod +775 /castor/cern.ch/user/s/ssimon/castor_output
You can look at directories in CASTOR with
nsls /castor/cern.ch/user/s/ssimon/
Note: you cannot use
to auto-complete on CASTOR.
################################################################################
## EDIT THE FOLLOWING PARAMETERS TO RUN YOUR JOB
################################################################################
set project_area=cmssw_projects/13X/cmssw131hlt6
set cfg_file=/afs/cern.ch/user/s/ssimon/$project_area/src/cfgs/minbias.cfg
set dataset=None
set output_file="500minbias.root"
# Only 2 of the following 3 parameters are allowed in the .cfg file
set number_of_events=100000
set number_of_jobs=200
set events_per_job=500
set crab_version=CRAB_1_5_2
#return_data=1 puts job output in your local work area
set return_data=0
#copy_data=1 puts job output in output_path
set copy_data=1
set ouput_path=/srm/managerv1?SFN=/castor/cern.ch/user/s/ssimon/crab_output
################################################################################
cd ~/
set TOP=$PWD
source /afs/cern.ch/cms/LCG/LCG-2/UI/cms_ui_env.csh
cd $TOP/$project_area/src
eval `scramv1 runtime -csh`
cd $TOP/crab_jobs/
source /afs/cern.ch/cms/ccs/wm/scripts/Crab/$crab_version/crab.csh
# make a crab.cfg file
cat > crab.cfg << EOF
[CRAB]
jobtype = cmssw
scheduler = edg
[CMSSW]
datasetpath=$dataset
pset=$cfg_file
total_number_of_events=$number_of_events
#events_per_job=$events_per_job
number_of_jobs = $number_of_jobs
output_file = $output_file
[USER]
return_data = $return_data
copy_data = $copy_data
storage_element = srm.cern.ch
storage_path = $output_path
use_central_bossDB = 0
use_boss_rt = 0
[EDG]
rb=CERN
proxy_server = myproxy.cern.ch
virtual_organization = cms
retry_count = 1
lcg_catalog_type = lfc
lfc_host = lfc-cms-test.cern.ch
lfc_home = /grid/cms
EOF
echo "crab -create"
echo "Creating ${number_of_jobs} jobs to run ove ${number_of_events} events"
echo "Next run: crab -submit"
crab -create
Links