Hugonweb | CRAB

CRAB is CMS end-user grid analysis system. The main documentation is here:

https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookStartingGrid

Tips for CRAB Usage

To find your own crab output at UF T2:

lcg-ls -l srm://srmb.ihepa.ufl.edu:8443/srm/v2/server?SFN=/cms/data/store/user/

Just take \"/cms/data\" off of the front of the filenames to use them in a CMSSW job.

Example CRAB cfg

[CRAB]
jobtype                  = cmssw    
scheduler                = glidein
use_server      = 1

[CMSSW]
datasetpath=/TTJets_TuneZ2_7TeV-madgraph-tauola/Fall11-PU_Chamonix12_START44_V10-v2/AODSIM
pset                     = copyData_cfg.py
get_edm_output           = 1
#total_number_of_lumis   = -1
#number_of_jobs     = 5
total_number_of_events = -1
events_per_job = 10000

[USER]
eMail = youremail@blarg.com
return_data              = 0

copy_data       = 1
storage_element     = T2_US_Florida
## Won't matter if publishing, will be in <PrimaryDataset>/<publish_data_name>/<randomnumbers>/
user_remote_dir     = dirname/subdirname

#publish_data            =1
#publish_data_name       = mypublisheddatasetname
#dbs_url_for_publication = https://cmsdbsprod.cern.ch:8443/cms_dbs_ph_analysis_02_writer/servlet/DBSServlet

## Do this if you get stupid error during crab -create, but be careful!
#check_user_remote_dir  = 0


[GRID]
se_black_list       =T2_US_Nebraska #My Arch Nemisis (Only the T2!) ;-)
## Will make your jobs exectue quicker at T2's once scheduled
max_cpu_time        =360
max_wall_clock_time =360

Script For Deleting Files From an SE

#!/bin/bash

CRABUSERNAME=myusername
BASEPATH=/cms/data/store/user/$CRABUSERNAME

#######################
### Define Functions
#######################

deleteFile ()
{
  if [ ! -n "$1" ] ; then 
      echo "deleteFile Error: Supply a file to be deleted"
      exit;
  fi;

  echo "Running srmrm srm://srmb.ihepa.ufl.edu:8443/srm/v2/server?SFN=$1"
  srmrm srm://srmb.ihepa.ufl.edu:8443/srm/v2/server?SFN=$1
}

deleteDir ()
{
  if [ ! -n "$1" ] ; then 
      echo "deleteDir Error: Supply a file to be deleted"
      exit;
  fi;

  echo "Running srmrmdir -recursive srm://srmb.ihepa.ufl.edu:8443/srm/v2/server?SFN=$1"
  srmrmdir -recursive srm://srmb.ihepa.ufl.edu:8443/srm/v2/server?SFN=$1
}

deleteAllFiles ()
{
  echo "Running deleteAllFiles($1)"
  for fn in `lcg-ls srm://srmb.ihepa.ufl.edu:8443/srm/v2/server?SFN=$1`
  do
    #echo "fn: $fn"
    if [[ $fn =~ ".*\.root" ]] ; then
        deleteFile $fn
    elif [[ "$fn" = $1 ]] ; then
        echo "Empty Dir: $1"
    else
        deleteAllFiles $fn
    fi
  done
}


################
## Run Stuff
################

deleteAllFiles $BASEPATH$1
deleteDir $BASEPATH$1

MultiCrab

Multi-Crab allows a user to submit the same crab job for multiple datasets. It is basically used in place of crab. A crab.cfg must be used similar to the one above, and then a multicrab.cfg file includes the parameters changed between datasets. Besides the [MULTICRAB]{=html} section that describes the crab.cfg file to use, each section defines another dataset to be processed, with parameters specific to it. If the data is staged out to a T2, the output will be put into a subdirectory of the directory listed in the crab.cfg called the section title in this file.

[MULTICRAB]
cfg=crab.cfg

#[QCDPt0to5]
#CMSSW.datasetpath=/QCD_Pt-0to5_TuneZ2star_8TeV_pythia6/Summer12-PU_S7_START52_V9-v1/AODSIM
#CMSSW.events_per_job=10000
#
#[QCDPt5to15]
#CMSSW.datasetpath=/QCD_Pt-5to15_TuneZ2star_8TeV_pythia6/Summer12-PU_S7_START52_V9-v1/AODSIM
#CMSSW.events_per_job=10000

[QCDPt30to50]
CMSSW.datasetpath=/QCD_Pt-30to50_TuneZ2star_8TeV_pythia6/Summer12-PU_S7_START52_V9-v1/AODSIM
CMSSW.events_per_job=100000

[QCDPt50to80]
CMSSW.datasetpath=/QCD_Pt-50to80_TuneZ2star_8TeV_pythia6/Summer12-PU_S7_START52_V9-v1/AODSIM
CMSSW.events_per_job=100000