6 from WMCore.Configuration
import Configuration
7 from CRABClient.UserUtilities
import getUsernameFromSiteDB
20 print (R+
"You need to provide the CMSSW python config, the samples list file and optionally the json in this order"+W)
28 CAMPAIGN =
'Run2016/80x_triggerstudies17_run2016hv1_raw_userv35' 37 psetname, pset_ext = os.path.splitext(PSET)
38 samplename, sample_ext = os.path.splitext(SAMPLE)
40 if not ( os.path.isfile(PSET)
and pset_ext ==
'.py' ):
41 print (R+
"The given python config does not exist or it is not a python file"+W)
44 if not ( os.path.isfile(SAMPLE)
and sample_ext ==
'.txt' ):
45 print (R+
"The given sample list file does not exist or it is not a txt file"+W)
49 PROCESS = samplename.split(
'/')[-1]
50 MYPATH =
'/store/user/%s/' % (getUsernameFromSiteDB())
51 BASEOUTDIR = MYPATH+
'Analysis/Ntuples/' + TYPE +
'/' + CAMPAIGN
53 dataset_list =
'samples/data/' + PROCESS +
'.txt' 54 f_datasets = open(dataset_list,
'r') 55 datasets = f_datasets.readlines() 67 if __name__ ==
'__main__':
69 from CRABAPI.RawCommand
import crabCommand
70 from CRABClient.ClientExceptions
import ClientException
71 from httplib
import HTTPException
73 from Analysis.Ntuplizer.crabConfig
import crabConfig
77 config.General.workArea +=
'_' + PROCESS
78 config.General.transferLogs =
False 81 config.Data.splitting =
'LumiBased' 82 config.Data.unitsPerJob = UNITS_PER_JOB
83 config.Data.totalUnits = -1
84 config.Data.outLFNDirBase = BASEOUTDIR +
'/' 86 config.Data.lumiMask = JSON
90 config.Data.runRange = RUN_RANGE
94 config.JobType.psetName = PSET
96 config.JobType.numCores = 4
98 for dataset
in datasets:
99 dataset = dataset.split(
'\n')[0]
100 dataset_name = dataset.split(
'/')[1]
101 dataset_cond = dataset.split(
'/')[2]
102 dataset_tier = dataset.split(
'/')[3]
104 config.Data.inputDataset = dataset
105 config.Data.outputDatasetTag = dataset_cond
107 config.General.requestName = dataset_name
108 config.General.requestName +=
'_'+dataset_cond
110 config.General.requestName +=
'_'+RUN_RANGE
112 outtext =
"Submitting dataset " + dataset +
"..." 113 print (O+str(outtext)+W)
115 crabCommand(
'submit', config = config)
116 print (O+
"--------------------------------"+W)