ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/crab_help.py
Revision: 1.153
Committed: Thu Sep 30 10:02:23 2010 UTC (14 years, 7 months ago) by belforte
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_7_5_patch1, CRAB_2_7_5, CRAB_2_7_5_pre3
Changes since 1.152: +2 -0 lines
Log Message:
add ~/.cms_crab and ~/.cms_sitedbcache in FILES section

File Contents

# Content
1
2 ###########################################################################
3 #
4 # H E L P F U N C T I O N S
5 #
6 ###########################################################################
7
8 import common
9
10 import sys, os, string
11
12 import tempfile
13
14 ###########################################################################
15 def usage():
16 print 'in usage()'
17 usa_string = common.prog_name + """ [options]
18
19 The most useful general options (use '-h' to get complete help):
20
21 -create -- Create all the jobs.
22 -submit n -- Submit the first n available jobs. Default is all.
23 -status -- check status of all jobs.
24 -getoutput|-get [range] -- get back the output of all jobs: if range is defined, only of selected jobs.
25 -extend -- Extend an existing task to run on new fileblocks if there.
26 -publish -- after the getouput, publish the data user in a local DBS instance.
27 -checkPublication [dbs_url datasetpath] -- checks if a dataset is published in a DBS.
28 -kill [range] -- kill submitted jobs.
29 -resubmit [range] -- resubmit killed/aborted/retrieved jobs.
30 -forceResubmit [range] -- resubmit jobs regardless to their status.
31 -copyData [range [dest_se or dest_endpoint]] -- copy locally (in crab_working_dir/res dir) or on a remote SE your produced output,
32 already stored on remote SE.
33 -renewCredential -- renew credential on the server.
34 -clean -- gracefully cleanup the directory of a task.
35 -match|-testJdl [range] -- check if resources exist which are compatible with jdl.
36 -report -- print a short report about the task
37 -list [range] -- show technical job details.
38 -postMortem [range] -- provide a file with information useful for post-mortem analysis of the jobs.
39 -printId [range] -- print the job SID or Task Unique ID while using the server.
40 -createJdl [range] -- provide files with a complete Job Description (JDL).
41 -validateCfg [fname] -- parse the ParameterSet using the framework's Python API.
42 -cleanCache -- clean SiteDB and CRAB caches.
43 -continue|-c [dir] -- Apply command to task stored in [dir].
44 -h [format] -- Detailed help. Formats: man (default), tex, html, txt.
45 -cfg fname -- Configuration file name. Default is 'crab.cfg'.
46 -debug N -- set the verbosity level to N.
47 -v -- Print version and exit.
48
49 "range" has syntax "n,m,l-p" which correspond to [n,m,l,l+1,...,p-1,p] and all possible combination
50
51 Example:
52 crab -create -submit 1
53 """
54 print usa_string
55 sys.exit(2)
56
57 ###########################################################################
58 def help(option='man'):
59 help_string = """
60 =pod
61
62 =head1 NAME
63
64 B<CRAB>: B<C>ms B<R>emote B<A>nalysis B<B>uilder
65
66 """+common.prog_name+""" version: """+common.prog_version_str+"""
67
68 This tool B<must> be used from an User Interface and the user is supposed to
69 have a valid Grid certificate.
70
71 =head1 SYNOPSIS
72
73 B<"""+common.prog_name+"""> [I<options>] [I<command>]
74
75 =head1 DESCRIPTION
76
77 CRAB is a Python program intended to simplify the process of creation and submission of CMS analysis jobs to the Grid environment .
78
79 Parameters for CRAB usage and configuration are provided by the user changing the configuration file B<crab.cfg>.
80
81 CRAB generates scripts and additional data files for each job. The produced scripts are submitted directly to the Grid. CRAB makes use of BossLite to interface to the Grid scheduler, as well as for logging and bookkeeping.
82
83 CRAB supports any CMSSW based executable, with any modules/libraries, including user provided ones, and deals with the output produced by the executable. CRAB provides an interface to CMS data discovery services (DBS and DLS), which are completely hidden to the final user. It also splits a task (such as analyzing a whole dataset) into smaller jobs, according to user requirements.
84
85 CRAB can be used in two ways: StandAlone and with a Server.
86 The StandAlone mode is suited for small task, of the order of O(100) jobs: it submits the jobs directly to the scheduler, and these jobs are under user responsibility.
87 In the Server mode, suited for larger tasks, the jobs are prepared locally and then passed to a dedicated CRAB server, which then interacts with the scheduler on behalf of the user, including additional services, such as automatic resubmission, status caching, output retrieval, and more.
88 The CRAB commands are exactly the same in both cases.
89
90 CRAB web page is available at
91
92 I<https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCrab>
93
94 =head1 HOW TO RUN CRAB FOR THE IMPATIENT USER
95
96 Please, read all the way through in any case!
97
98 Source B<crab.(c)sh> from the CRAB installation area, which have been setup either by you or by someone else for you.
99
100 Modify the CRAB configuration file B<crab.cfg> according to your need: see below for a complete list. A template and commented B<crab.cfg> can be found on B<$CRABDIR/python/crab.cfg>
101
102 ~>crab -create
103 create all jobs (no submission!)
104
105 ~>crab -submit 2 -continue [ui_working_dir]
106 submit 2 jobs, the ones already created (-continue)
107
108 ~>crab -create -submit 2
109 create _and_ submit 2 jobs
110
111 ~>crab -status
112 check the status of all jobs
113
114 ~>crab -getoutput
115 get back the output of all jobs
116
117 ~>crab -publish
118 publish all user outputs in the DBS specified in the crab.cfg (dbs_url_for_publication) or written as argument of this option
119
120 =head1 RUNNING CMSSW WITH CRAB
121
122 =over 4
123
124 =item B<A)>
125
126 Develop your code in your CMSSW working area. Do anything which is needed to run interactively your executable, including the setup of run time environment (I<eval `scramv1 runtime -sh|csh`>), a suitable I<ParameterSet>, etc. It seems silly, but B<be extra sure that you actually did compile your code> I<scramv1 b>.
127
128 =item B<B)>
129
130 Source B<crab.(c)sh> from the CRAB installation area, which have been setup either by you or by someone else for you. Modify the CRAB configuration file B<crab.cfg> according to your need: see below for a complete list.
131
132 The most important parameters are the following (see below for complete description of each parameter):
133
134 =item B<Mandatory!>
135
136 =over 6
137
138 =item B<[CMSSW]> section: datasetpath, pset, splitting parameters, output_file
139
140 =item B<[USER]> section: output handling parameters, such as return_data, copy_data etc...
141
142 =back
143
144 =item B<Run it!>
145
146 You must have a valid voms-enabled Grid proxy. See CRAB web page for details.
147
148 =back
149
150 =head1 RUNNING MULTICRAB
151
152 MultiCRAB is a CRAB extension to submit the same job to multiple datasets in one go.
153
154 The use case for multicrab is when you have your analysis code that you want to run on several datasets, typically some signals plus some backgrounds (for MC studies)
155 or on different streams/configuration/runs for real data taking. You want to run exactly the same code, and also the crab.cfg are different only for few keys:
156 for sure datasetpath but also other keys, such as eg total_number_of_events, in case you want to run on all signals but only a fraction of background, or anything else.
157 So far, you would have to create a set of crab.cfg, one for each dataset you want to access, and submit several instances of CRAB, saving the output to different locations.
158 Multicrab is meant to automatize this procedure.
159 In addition to the usual crab.cfg, there is a new configuration file called multicrab.cfg. The syntax is very similar to that of crab.cfg, namely
160 [SECTION] <crab.cfg Section>.Key=Value
161
162 Please note that it is mandatory to add explicitly the crab.cfg [SECTION] in front of [KEY].
163 The role of multicrab.cfg is to apply modification to the template crab.cfg, some which are common to all tasks, and some which are task specific.
164
165 =head2 So there are two sections:
166
167 =over 2
168
169 =item B<[COMMON]>
170
171 section: which applies to all task, and which is fully equivalent to modify directly the template crab.cfg
172
173 =item B<[DATASET]>
174
175 section: there could be an arbitrary number of sections, one for each dataset you want to run. The names are free (but COMMON and MULTICRAB), and they will be used as ui_working_dir for the task as well as an appendix to the user_remote_dir in case of output copy to remote SE. So, the task corresponding to section, say [SIGNAL] will be placed in directory SIGNAL, and the output will be put on /SIGNAL/, so SIGNAL will be added as last subdir in the user_remote_dir.
176
177 =back
178
179 For further details please visit
180
181 I<https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideMultiCrab>
182
183 =head1 HOW TO RUN ON CONDOR-G
184
185 The B<Condor-G> mode for B<CRAB> is a special submission mode next to the standard Resource Broker submission. It is designed to submit jobs directly to a site and not using the Resource Broker.
186
187 Due to the nature of B<Condor-G> submission, the B<Condor-G> mode is restricted to OSG sites within the CMS Grid, currently the 7 US T2: Florida(ufl.edu), Nebraska(unl.edu), San Diego(ucsd.edu), Purdue(purdue.edu), Wisconsin(wisc.edu), Caltech(ultralight.org), MIT(mit.edu).
188
189 =head2 B<Requirements:>
190
191 =over 2
192
193 =item installed and running local Condor scheduler
194
195 (either installed by the local Sysadmin or self-installed using the VDT user interface: http://www.uscms.org/SoftwareComputing/UserComputing/Tutorials/vdt.html)
196
197 =item locally available LCG or OSG UI installation
198
199 for authentication via Grid certificate proxies ("voms-proxy-init -voms cms" should result in valid proxy)
200
201 =item set the environment variable GRID_WL_LOCATION to the edg directory of the local LCG or OSG UI installation
202
203 =back
204
205 =head2 B<What the Condor-G mode can do:>
206
207 =over 2
208
209 =item submission directly to multiple OSG sites,
210
211 the requested dataset must be published correctly by the site in the local and global services.
212 Previous restrictions on submitting only to a single site have been removed. SE and CE whitelisting
213 and blacklisting work as in the other modes.
214
215 =back
216
217 =head2 B<What the Condor-G mode cannot do:>
218
219 =over 2
220
221 =item submit jobs if no condor scheduler is running on the submission machine
222
223 =item submit jobs if the local condor installation does not provide Condor-G capabilities
224
225 =item submit jobs to an LCG site
226
227 =item support Grid certificate proxy renewal via the myproxy service
228
229 =back
230
231 =head2 B<CRAB configuration for Condor-G mode:>
232
233 The CRAB configuration for the Condor-G mode only requires one change in crab.cfg:
234
235 =over 2
236
237 =item select condor_g Scheduler:
238
239 scheduler = condor_g
240
241 =back
242
243
244 =head1 HOW TO RUN ON NORDUGRID ARC
245
246 The ARC scheduler can be used to submit jobs to sites running the NorduGrid
247 ARC grid middleware. To use it you'll need to have the ARC client
248 installed.
249
250 =head2 B<CRAB configuration for ARC mode:>
251
252 The ARC scheduler requires some changes to crab.cfg:
253
254 =over 2
255
256 =item B<scheduler:>
257
258 Select the ARC scheduler:
259 scheduler = arc
260
261 =item B<requirements>, B<additional_jdl_parameters:>
262
263 Use xrsl code instead of jdl for these parameters.
264
265 =item B<max_cpu_time>, B<max_wall_clock_time:>
266
267 For parameters max_cpu_time and max_wall_clock_time, you can use
268 units, e.g. "72 hours" or "3 days", just like with the xrsl attributes
269 cpuTime and wallTime. If no unit is given, minutes is assumed by default.
270
271 =back
272
273 =head2 B<CRAB Commands:>
274
275 Most CRAB commands behave approximately the same with the ARC scheduler, with only some minor differences:
276
277 =over 2
278
279 =item B<*> B<-printJdl|-createJdl> will print xrsl code instead of jdl.
280
281 =back
282
283
284
285
286 =head1 COMMANDS
287
288 =head2 B<-create>
289
290 Create the jobs: from version 1_3_0 it is only possible to create all jobs.
291 The maximum number of jobs depends on dataset and splitting directives. This set of identical jobs accessing the same dataset are defined as a task.
292 This command create a directory with default name is I<crab_0_date_time> (can be changed via ui_working_dir parameter, see below). Inside this directory it is placed whatever is needed to submit your jobs. Also the output of your jobs (once finished) will be place there (see after). Do not cancel by hand this directory: rather use -clean (see).
293 See also I<-continue>.
294
295 =head2 B<-submit [range]>
296
297 Submit n jobs: 'n' is either a positive integer or 'all' or a [range]. The default is all.
298 If 'n' is passed as an argument, the first 'n' suitable jobs will be submitted. Please note that this is behaviour is different from other commands, where -command N means act the command to the job N, and not to the first N jobs. If a [range] is passed, the selected jobs will be submitted.
299 This option may be used in conjunction with -create (to create and submit immediately) or with -continue (which is assumed by default) to submit previously created jobs. Failure to do so will stop CRAB and generate an error message. See also I<-continue>.
300
301 =head2 B<-continue [dir] | -c [dir]>
302
303 Apply the action on the task stored in directory [dir]. If the task directory is the standard one (crab_0_date_time), the most recent in time is assumed. Any other directory must be specified.
304 Basically all commands (except -create) need -continue, so it is automatically assumed. Of course, the standard task directory is used in this case.
305
306 =head2 B<-status [v|verbose]>
307
308 Check the status of the jobs, in all states. With the server, the full status, including application and wrapper exit codes, is available as soon as the jobs end. In StandAlone mode it is necessary to retrieve (-get) the job output first. With B<v|verbose> some more information is displayed.
309
310 =head2 B<-getoutput|-get [range]>
311
312 Retrieve the output declared by the user via the output sandbox. By default the output will be put in task working dir under I<res> subdirectory. This can be changed via config parameters. B<Be extra sure that you have enough free space>. From version 2_3_x, the available free space is checked in advance. See I<range> below for syntax.
313
314 =head2 B<-publish>
315
316 Publish user output in a local DBS instance after the retrieval of output. By default publish uses the dbs_url_for_publication specified in the crab.cfg file, otherwise you can supply it as an argument of this option.
317 Warnings about publication:
318
319 CRAB publishes only EDM files (in the FJR they are written in the tag <File>)
320
321 CRAB publishes in the same USER dataset more EDM files if they are produced by a job and written in the tag <File> of FJR.
322
323 It is not possible for the user to select only one file to publish, nor to publish two files in two different USER datasets.
324
325
326 =head2 B<-checkPublication [-USER.dbs_url_for_publication=dbs_url -USER.dataset_to_check=datasetpath -debug]>
327
328 Check if a dataset is published in a DBS. This option is automaticaly called at the end of the publication step, but it can be also used as a standalone command. By default it reads the parameters (USER.dbs_url_for_publication and USER.dataset_to_check) in your crab.cfg. You can overwrite the defaults in crab.cfg by passing these parameters as option. Using the -debug option, you will get detailed info about the files of published blocks.
329
330 =head2 B<-resubmit [range]>
331
332 Resubmit jobs which have been previously submitted and have been either I<killed> or are I<aborted>. See I<range> below for syntax.
333
334 =head2 B<-forceResubmit [range]>
335
336 iSame as -resubmit but without any check about the actual status of the job: please use with caution, you can have problem if both the original job and the resubmitted ones actually run and tries to write the output ona a SE. This command is meant to be used if the killing is not possible or not working but you know that the job failed or will. See I<range> below for syntax.
337
338 =head2 B<-extend>
339
340 Create new jobs for an existing task, checking if new blocks are published for the given dataset.
341
342 =head2 B<-kill [range]>
343
344 Kill (cancel) jobs which have been submitted to the scheduler. A range B<must> be used in all cases, no default value is set.
345
346 =head2 B<-copyData [range -dest_se=the official SE name or -dest_endpoint=the complete endpoint of the remote SE]>
347
348 Option that can be used only if your output have been previously copied by CRAB on a remote SE.
349 By default the copyData copies your output from the remote SE locally on the current CRAB working directory (under res). Otherwise you can copy the output from the remote SE to another one, specifying either -dest_se=<the remote SE official name> or -dest_endpoint=<the complete endpoint of remote SE>. If dest_se is used, CRAB finds the correct path where the output can be stored.
350
351 Example: crab -copyData --> output copied to crab_working_dir/res directory
352 crab -copyData -dest_se=T2_IT_Legnaro --> output copied to the legnaro SE, directory discovered by CRAB
353 crab -copyData -dest_endpoint=srm://<se_name>:8443/xxx/yyyy/zzzz --> output copied to the se <se_name> under
354 /xxx/yyyy/zzzz directory.
355
356 =head2 B<-renewCredential >
357
358 If using the server modality, this command allows to delegate a valid credential (proxy/token) to the server associated with the task.
359
360 =head2 B<-match|-testJdl [range]>
361
362 Check if the job can find compatible resources. It is equivalent of doing I<edg-job-list-match> on edg.
363
364 =head2 B<-printId [range]>
365
366 Just print the job identifier, which can be the SID (Grid job identifier) of the job(s) or the taskId if you are using CRAB with the server or local scheduler Id. If [range] is "full", the the SID of all the jobs are printed, also in the case of submission with server.
367
368 =head2 B<-createJdl [range]>
369
370 Collect the full Job Description in a file located under share directory. The file base name is File- .
371
372 =head2 B<-postMortem [range]>
373
374 Try to collect more information of the job from the scheduler point of view.
375
376 =head2 B<-list [range]>
377
378 Dump technical information about jobs: for developers only.
379
380 =head2 B<-report>
381
382 Print a short report about the task, namely the total number of events and files processed/requested/available, the name of the dataset path, a summary of the status of the jobs, and so on. A summary file of the runs and luminosity sections processed is written to res/. In principle -report should generate all the info needed for an analysis. Work in progress.
383
384 =head2 B<-clean [dir]>
385
386 Clean up (i.e. erase) the task working directory after a check whether there are still running jobs. In case, you are notified and asked to kill them or retrieve their output. B<Warning> this will possibly delete also the output produced by the task (if any)!
387
388 =head2 B<-cleanCache>
389
390 Clean up (i.e. erase) the SiteDb and CRAB cache content.
391
392
393 =head2 B<-validateCfg [fname]>
394
395 Parse the ParameterSet using the framework\'s Python API in order to perform a sanity check of the CMSSW configuration file.
396
397 =head2 B<-help [format] | -h [format]>
398
399 This help. It can be produced in three different I<format>: I<man> (default), I<tex> and I<html>.
400
401 =head2 B<-v>
402
403 Print the version and exit.
404
405 =head2 B<range>
406
407 The range to be used in many of the above commands has the following syntax. It is a comma separated list of jobs ranges, each of which may be a job number, or a job range of the form first-last.
408 Example: 1,3-5,8 = {1,3,4,5,8}
409
410 =head1 OPTIONS
411
412 =head2 B<-cfg [file]>
413
414 Configuration file name. Default is B<crab.cfg>.
415
416 =head2 B<-debug [level]>
417
418 Set the debug level: high number for high verbosity.
419
420 =head1 CONFIGURATION PARAMETERS
421
422 All the parameter describe in this section can be defined in the CRAB configuration file. The configuration file has different sections: [CRAB], [USER], etc. Each parameter must be defined in its proper section. An alternative way to pass a config parameter to CRAB is via command line interface; the syntax is: crab -SECTION.key value . For example I<crab -USER.outputdir MyDirWithFullPath> .
423 The parameters passed to CRAB at the creation step are stored, so they cannot be changed by changing the original crab.cfg . On the other hand the task is protected from any accidental change. If you want to change any parameters, this require the creation of a new task.
424 Mandatory parameters are flagged with a *.
425
426 =head2 B<[CRAB]>
427
428 =head3 B<jobtype *>
429
430 The type of the job to be executed: I<cmssw> jobtypes are supported
431
432 The scheduler to be used: I<glitecoll> is the more efficient grid scheduler and should be used. Other choice are I<glite>, same as I<glitecoll> but without bulk submission (and so slower) or I<condor_g> (see specific paragraph) or I<edg> which is the former Grid scheduler, which will be dismissed in some future. In addition, there's an I<arc> scheduler to be used with the NorduGrid ARC middleware.
433 From version 210, also local scheduler are supported, for the time being only at CERN. I<LSF> is the standard CERN local scheduler or I<CAF> which is LSF dedicated to CERN Analysis Facilities.
434
435 =head3 B<use_server>
436
437 To use the server for job handling (recommended) 0=no (default), 1=true. The server to be used will be found automatically from a list of available ones: it can also be specified explicitly by using I<server_name> (see below)
438
439 =head3 B<server_name>
440
441 To use the CRAB-server support it is needed to fill this key with server name as <Server_DOMAIN> (e.g. cnaf,fnal). If this is set, I<use_server> is set to true automatically.
442 If I<server_name=None> crab works in standalone way, same as using I<use_server=0> and no I<server_name>.
443 The server available to users can be found from CRAB web page.
444
445 =head2 B<[CMSSW]>
446
447 =head3 B<datasetpath *>
448
449 The path of the processed or analysis dataset as defined in DBS. It comes with the format I</PrimaryDataset/DataTier/Process[/OptionalADS]>. If no input is needed I<None> must be specified. When running on an analysis dataset, the job splitting must be specified by luminosity block rather than event. Analysis datasets are only treated accurately on a lumi-by-lumi level with CMSSW 3_1_x and later.
450
451 =head3 B<runselection *>
452
453 Within a dataset you can restrict to run on a specific run number or run number range. For example runselection=XYZ or runselection=XYZ1-XYZ2 . Run number range will include both run XYZ1 and XYZ2. Combining runselection with a lumi_mask runs on the intersection of the two lists.
454
455 =head3 B<use_parent>
456
457 Within a dataset you can ask to run over the related parent files too. E.g., this will give you access to the RAW data while running over a RECO sample. Setting use_parent=1 CRAB determines the parent files from DBS and will add secondaryFileNames = cms.untracked.vstring( <LIST of parent FIles> ) to the pool source section of your parameter set.
458 This setting is supposed to works both with Splitting by Lumis and Splitting by Events.
459
460 =head3 B<pset *>
461
462 The python ParameterSet to be used.
463
464 =head3 B<pycfg_params *>
465
466 These parameters are passed to the python config file, as explained in https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideAboutPythonConfigFile#Passing_Command_Line_Arguments_T
467
468 =head3 B<lumi_mask>
469
470 The filename of a JSON file that describes which runs and lumis to process. CRAB will skip luminosity blocks not listed in the file. When using this setting, you must also use the split by lumi settings rather than split by event as described below. Combining runselection with a lumi_mask runs on the intersection of the two lists.
471
472 =head3 B<Splitting jobs by Lumi>
473
474 =over 4
475
476 =item B<NOTE: Exactly two of these three parameters must be used: total_number_of_lumis, lumis_per_job, number_of_jobs.> Split by lumi (or by run, explained below) is required for real data. Because jobs in split by lumi mode process entire rather than partial files, you will often end up with fewer jobs processing more lumis than you are expecting. Additionally, a single job cannot analyze files from multiple blocks in DBS. All job splitting parameters in split by lumi mode are "advice" to CRAB rather than determinative.
477
478 =back
479
480 =head4 B<total_number_of_lumis *>
481
482 The number of luminosity blocks to be processed. -1 for processing a whole dataset. Your task will process this many lumis regardless of how the jobs are actually split up. If you do not specify this, the total number of lumis processed will be number_of_jobs x lumis_per_job.
483
484 =head4 B<lumis_per_job *>
485
486 The number of luminosity blocks to be accessed by each job. Since a job cannot access less than a whole file, it may be that the actual number of lumis per job is more than you asked for.
487
488 =head4 B<number_of_jobs *>
489
490 Define the number of jobs to be run for the task. This parameter is common between split by lumi and split by event modes. In split by lumi mode, the number of jobs will only approximately match this value.
491
492 =head3 B<Splitting jobs by Event>
493
494 =over 4
495
496 =item B<NOTE: Exactly two of these three parameters must be used: total_number_of_events, events_per_job, number_of_jobs.> Otherwise CRAB will complain. Only MC data can be split by event.
497
498 =back
499
500 =head4 B<total_number_of_events *>
501
502 The number of events to be processed. To access all available events, use I<-1>. Of course, the latter option is not viable in case of no input. In this case, the total number of events will be used to split the task in jobs, together with I<events_per_job>.
503
504 =head4 B<events_per_job*>
505
506 The number of events to be accessed by each job. Since a job cannot cross the boundary of a fileblock it might be that the actual number of events per job is not exactly what you asked for. It can be used also with no input.
507
508 =head4 B<number_of_jobs *>
509
510 Define the number of jobs to be run for the task. The number of events for each job is computed taking into account the total number of events required as well as the granularity of EventCollections. Can be used also with No input.
511
512 =head4 B<split_by_event *>
513
514 This setting is for experts only. If you don't know why you want to use it, you don't want to use it. Set the value to 1 to enabe split by event on data. CRAB then behaves like old versions of CRAB which did not enforce split by lumi for data.
515
516 =head3 B<split_by_run>
517
518 To activate the split run based (each job will access a different run) use I<split_by_run>=1. You can also define I<number_of_jobs> and/or I<runselection>. NOTE: the Run Based combined with Event Based split is not available.
519
520 =head3 B<output_file *>
521
522 The output files produced by your application (comma separated list). From CRAB 2_2_2 onward, if TFileService is defined in user Pset, the corresponding output file is automatically added to the list of output files. User can avoid this by setting B<skip_TFileService_output> = 1 (default is 0 == file included). The Edm output produced via PoolOutputModule can be automatically added by setting B<get_edm_output> = 1 (default is 0 == no). B<warning> it is not allowed to have a PoolOutputSource and not save it somewhere, since it is a waste of resource on the WN. In case you really want to do that, and if you really know what you are doing (hint: you dont!) you can user I<ignore_edm_output=1>.
523
524 =head3 B<skip_TFileService_output>
525
526 Force CRAB to skip the inclusion of file produced by TFileService to list of output files. Default is I<0>, namely the file is included.
527
528 =head3 B<get_edm_output>
529
530 Force CRAB to add the EDM output file, as defined in PSET in PoolOutputModule (if any) to be added to the list of output files. Default is 0 (== no inclusion)
531
532 =head3 B<increment_seeds>
533
534 Specifies a comma separated list of seeds to increment from job to job. The initial value is taken
535 from the CMSSW config file. I<increment_seeds=sourceSeed,g4SimHits> will set sourceSeed=11,12,13 and g4SimHits=21,22,23 on
536 subsequent jobs if the values of the two seeds are 10 and 20 in the CMSSW config file.
537
538 See also I<preserve_seeds>. Seeds not listed in I<increment_seeds> or I<preserve_seeds> are randomly set for each job.
539
540 =head3 B<preserve_seeds>
541
542 Specifies a comma separated list of seeds to which CRAB will not change from their values in the user
543 CMSSW config file. I<preserve_seeds=sourceSeed,g4SimHits> will leave the Pythia and GEANT seeds the same for every job.
544
545 See also I<increment_seeds>. Seeds not listed in I<increment_seeds> or I<preserve_seeds> are randomly set for each job.
546
547 =head3 B<first_lumi>
548
549 Relevant only for Monte Carlo production for which it defaults to 1. The first job will generate events with this lumi block number, subsequent jobs will
550 increment the lumi block number. Setting this number to 0 (not recommend) means CMSSW will not be able to read multiple such files as they
551 will all have the same run, lumi and event numbers. This check in CMSSW can be bypassed by setting
552 I<process.source.duplicateCheckMode = cms.untracked.string('noDuplicateCheck')> in the input source, should you need to
553 read files produced without setting first_run (in old versions of CRAB) or first_lumi.
554
555 =head3 B<generator>
556
557 Name of the generator your MC job is using. Some generators require CRAB to skip events, others do not.
558 Possible values are pythia (default), comphep, lhe, and madgraph. This will skip events in your generator input file.
559
560 =head3 B<executable>
561
562 The name of the executable to be run on remote WN. The default is cmsrun. The executable is either to be found on the release area of the WN, or has been built on user working area on the UI and is (automatically) shipped to WN. If you want to run a script (which might internally call I<cmsrun>, use B<USER.script_exe> instead.
563
564 =head3 I<DBS and DLS parameters:>
565
566 =head3 B<dbs_url>
567
568 The URL of the DBS query page. For expert only.
569
570 =head3 B<show_prod>
571
572 To enable CRAB to show data hosted on Tier1s sites specify I<show_prod> = 1. By default those data are masked.
573
574 =head3 B<subscribed>
575
576 By setting the flag I<subscribed> = 1 only the replicas that are subscribed to its site are considered.The default is to return all replicas. The intended use of this flag is to avoid sending jobs to sites based on data that is being moved or deleted (and thus not subscribed).
577
578 =head3 B<no_block_boundary>
579
580 To remove fileblock boundaries in job splitting specify I<no_block_boundary> = 1.
581
582 =head2 B<[USER]>
583
584 =head3 B<additional_input_files>
585
586 Any additional input file you want to ship to WN: comma separated list. IMPORTANT NOTE: they will be placed in the WN working dir, and not in ${CMS_SEARCH_PATH}. Specific files required by CMSSW application must be placed in the local data directory, which will be automatically shipped by CRAB itself. You do not need to specify the I<ParameterSet> you are using, which will be included automatically. Wildcards are allowed.
587
588 =head3 B<script_exe>
589
590 A user script that will be run on WN (instead of default cmsRun). It is up to the user to setup properly the script itself to run on WN enviroment. CRAB guarantees that the CMSSW environment is setup (e.g. scram is in the path) and that the modified pset.py will be placed in the working directory, with name pset.py . The user must ensure that a properly name job report will be written, this can be done e.g. by calling cmsRun within the script as "cmsRun -j $RUNTIME_AREA/crab_fjr_$NJob.xml -p pset.py". The script itself will be added automatically to the input sandbox so user MUST NOT add it within the B<USER.additional_input_files>.
591
592 =head3 B<script_arguments>
593
594 Any arguments you want to pass to the B<USER.script_exe>: comma separated list.
595
596 =head3 B<ui_working_dir>
597
598 Name of the working directory for the current task. By default, a name I<crab_0_(date)_(time)> will be used. If this card is set, any CRAB command which require I<-continue> need to specify also the name of the working directory. A special syntax is also possible, to reuse the name of the dataset provided before: I<ui_working_dir : %(dataset)s> . In this case, if e.g. the dataset is SingleMuon, the ui_working_dir will be set to SingleMuon as well.
599
600 =head3 B<thresholdLevel>
601
602 This has to be a value between 0 and 100, that indicates the percentage of task completeness (jobs in a ended state are complete, even if failed). The server will notify the user by e-mail (look at the field: B<eMail>) when the task will reach the specified threshold. Works just when using the server.
603
604 =head3 B<eMail>
605
606 The server will notify the specified e-mail when the task will reaches the specified B<thresholdLevel>. A notification is also sent when the task will reach the 100\% of completeness. This field can also be a list of e-mail: "B<eMail = user1@cern.ch, user2@cern.ch>". Works just when using the server.
607
608 =head3 B<client>
609
610 Specify the client that can be used to interact with the server in B<CRAB.server_name>. The default is the value in the server configuration.
611
612 =head3 B<return_data *>
613
614 The output produced by the executable on WN is returned (via output sandbox) to the UI, by issuing the I<-getoutput> command. B<Warning>: this option should be used only for I<small> output, say less than 10MB, since the sandbox cannot accommodate big files. Depending on Resource Broker used, a size limit on output sandbox can be applied: bigger files will be truncated. To be used in alternative to I<copy_data>.
615
616 =head3 B<outputdir>
617
618 To be used together with I<return_data>. Directory on user interface where to store the output. Full path is mandatory, "~/" is not allowed: the default location of returned output is ui_working_dir/res .
619
620 =head3 B<logdir>
621
622 To be used together with I<return_data>. Directory on user interface where to store the standard output and error. Full path is mandatory, "~/" is not allowed: the default location of returned output is ui_working_dir/res .
623
624 =head3 B<copy_data *>
625
626 The output (only that produced by the executable, not the std-out and err) is copied to a Storage Element of your choice (see below). To be used as an alternative to I<return_data> and recommended in case of large output.
627
628 =head3 B<storage_element>
629
630 To be used with <copy_data>=1
631 If you want to copy the output of your analysis in a official CMS Tier2 or Tier3, you have to write the CMS Site Name of the site, as written in the SiteDB https://cmsweb.cern.ch/sitedb/reports/showReport?reportid=se_cmsname_map.ini (i.e T2_IT_legnaro). You have also to specify the <remote_dir>(see below)
632
633 If you want to copy the output in a not_official_CMS remote site you have to specify the complete storage element name (i.e se.xxx.infn.it).You have also to specify the <storage_path> and the <storage_port> if you do not use the default one(see below).
634
635 =head3 B<user_remote_dir>
636
637 To be used with <copy_data>=1 and <storage_element> official CMS sites.
638 This is the directory or tree of directories where your output will be stored. This directory will be created under the mountpoint ( which will be discover by CRAB if an official CMS storage Element has been used, or taken from the crab.cfg as specified by the user). B<NOTE> This part of the path will be used as logical file name of your files in the case of publication without using an official CMS storage Element. Generally it should start with "/store".
639
640 =head3 B<storage_path>
641
642 To be used with <copy_data>=1 and <storage_element> not official CMS sites.
643 This is the full path of the Storage Element writeable by all, the mountpoint of SE (i.e /srm/managerv2?SFN=/pnfs/se.xxx.infn.it/yyy/zzz/)
644
645
646 =head3 B<storage_pool>
647
648 If you are using CAF scheduler, you can specify the storage pool where to write your output.
649 The default is cmscafuser. If you do not want to use the default, you can overwrite it specifing None
650
651 =head3 B<storage_port>
652
653 To choose the storage port specify I<storage_port> = N (default is 8443) .
654
655 =head3 B<local_stage_out *>
656
657 This option enables the local stage out of produced output to the "close storage element" where the job is running, in case of failure of the remote copy to the Storage element decided by the user in che crab.cfg. It has to be used with the copy_data option. In the case of backup copy, the publication of data is forbidden. Set I<local_stage_out> = 1
658
659 =head3 B<publish_data*>
660
661 To be used with <copy_data>=1
662 To publish your produced output in a local istance of DBS set publish_data = 1
663 All the details about how to use this functionality are written in https://twiki.cern.ch/twiki/bin/view/CMS/SWGuideCrabForPublication
664 N.B 1) if you are using an official CMS site to stored data, the remote dir will be not considered. The directory where data will be stored is decided by CRAB, following the CMS policy in order to be able to re-read published data.
665 2) if you are using a not official CMS site to store data, you have to check the <lfn>, that will be part of the logical file name of you published files, in order to be able to re-read the data.
666
667 =head3 B<publish_data_name>
668
669 You produced output will be published in your local DBS with dataset name <primarydataset>/<publish_data_name>/USER
670
671 =head3 B<dbs_url_for_publication>
672
673 Specify the URL of your local DBS istance where CRAB has to publish the output files
674
675
676 =head3 B<srm_version>
677
678 To choose the srm version specify I<srm_version> = (srmv1 or srmv2).
679
680 =head3 B<xml_report>
681
682 To be used to switch off the screen report during the status query, enabling the db serialization in a file. Specifying I<xml_report> = FileName CRAB will serialize the DB into CRAB_WORKING_DIR/share/FileName.
683
684 =head3 B<usenamespace>
685
686 To use the automate namespace definition (perfomed by CRAB) it is possible to set I<usenamespace>=1. The same policy used for the stage out in case of data publication will be applied.
687
688 =head3 B<debug_wrapper>
689
690 To enable the higer verbose level on wrapper specify I<debug_wrapper> = 1. The Pset contents before and after the CRAB maipulation will be written together with other useful infos.
691
692 =head3 B<deep_debug>
693
694 To be used in case of unexpected job crash when the sdtout and stderr files are lost. Submitting again the same jobs specifying I<deep_debug> = 1 these files will be reported back. NOTE: it works only on standalone mode for debugging purpose.
695
696 =head3 B<dontCheckSpaceLeft>
697
698 Set it to 1 to skip the check of free space left on your working directory before attempting to get the output back. Default is 0 (=False)
699
700 =head3 B<check_user_remote_dir>
701
702 To avoid stage out failures CRAB checks the remote location content at the creation time. By setting I<check_user_remote_dir>=0 crab will skip the check.
703
704 =head2 B<[GRID]>
705
706 =head3 B<RB>
707
708 Which RB you want to use instead of the default one, as defined in the configuration of your UI. The ones available for CMS are I<CERN> and I<CNAF>. They are actually identical, being a collection of all WMSes available for CMS: the configuration files needed to change the broker will be automatically downloaded from CRAB web page and used.
709 You can use any other RB which is available, if you provide the proper configuration files. E.g., for gLite WMS XYZ, you should provide I<glite.conf.CMS_XYZ>. These files are searched for in the current working directory, and, if not found, on crab web page. So, if you put your private configuration files in the working directory, they will be used, even if they are not available on crab web page.
710 Please get in contact with crab team if you wish to provide your RB or WMS as a service to the CMS community.
711
712 =head3 B<role>
713
714 The role to be set in the VOMS. See VOMS documentation for more info.
715
716 =head3 B<group>
717
718 The group to be set in the VOMS, See VOMS documentation for more info.
719
720 =head3 B<dont_check_proxy>
721
722 If you do not want CRAB to check your proxy. The creation of the proxy (with proper length), its delegation to a myproxyserver is your responsibility.
723
724 =head3 B<dont_check_myproxy>
725
726 If you want to to switch off only the proxy renewal set I<dont_check_myproxy>=1. The proxy delegation to a myproxyserver is your responsibility.
727
728 =head3 B<requirements>
729
730 Any other requirements to be add to JDL. Must be written in compliance with JDL syntax (see LCG user manual for further info). No requirement on Computing element must be set.
731
732 =head3 B<additional_jdl_parameters:>
733
734 Any other parameters you want to add to jdl file:semicolon separated list, each
735 head3 B<must> be complete, including the closing ";".
736
737 =head3 B<wms_service>
738
739 With this field it is also possible to specify which WMS you want to use (https://hostname:port/pathcode) where "hostname" is WMS name, the "port" generally is 7443 and the "pathcode" should be something like "glite_wms_wmproxy_server".
740
741 =head3 B<max_cpu_time>
742
743 Maximum CPU time needed to finish one job. It will be used to select a suitable queue on the CE. Time in minutes.
744
745 =head3 B<max_wall_clock_time>
746
747 Same as previous, but with real time, and not CPU one.
748
749 =head3 B<ce_black_list>
750
751 All the CE (Computing Element) whose name contains the following strings (comma separated list) will not be considered for submission. Use the dns domain (e.g. fnal, cern, ifae, fzk, cnaf, lnl,....). You may use hostnames or CMS Site names (T2_DE_DESY) or substrings.
752
753 =head3 B<ce_white_list>
754
755 Only the CE (Computing Element) whose name contains the following strings (comma separated list) will be considered for submission. Use the dns domain (e.g. fnal, cern, ifae, fzk, cnaf, lnl,....). You may use hostnames or CMS Site names (T2_DE_DESY) or substrings. Please note that if the selected CE(s) does not contain the data you want to access, no submission can take place.
756
757 =head3 B<se_black_list>
758
759 All the SE (Storage Element) whose name contains the following strings (comma separated list) will not be considered for submission.It works only if a datasetpath is specified. You may use hostnames or CMS Site names (T2_DE_DESY) or substrings.
760
761 =head3 B<se_white_list>
762
763 Only the SE (Storage Element) whose name contains the following strings (comma separated list) will be considered for submission.It works only if a datasetpath is specified. Please note that if the selected CE(s) does not contain the data you want to access, no submission can take place. You may use hostnames or CMS Site names (T2_DE_DESY) or substrings.
764
765 =head3 B<remove_default_blacklist>
766
767 CRAB enforce the T1s Computing Eelements Black List. By default it is appended to the user defined I<CE_black_list>. To remove the enforced T1 black lists set I<remove_default_blacklist>=1.
768
769 =head3 B<virtual_organization>
770
771 You do not want to change this: it is cms!
772
773 =head3 B<maxtarballsize>
774
775 Maximum size of tar-ball in Mb. If bigger, an error will be generated. The actual limit is that on the RB input sandbox. Default is 9.5 Mb (sandbox limit is 10 Mb)
776
777 =head3 B<skipwmsauth>
778
779 Temporary useful parameter to allow the WMSAuthorisation handling. Specifying I<skipwmsauth> = 1 the pyopenssl problmes will disappear. It is needed working on gLite UI outside of CERN.
780
781 =head2 B<[LSF]> or B<[CAF]> or B<[PBS]> or B<[SGE]>
782
783 =head3 B<queue>
784
785 The LSF/PBS queue you want to use: if none, the default one will be used. For CAF, the proper queue will be automatically selected.
786
787 =head3 B<resource>
788
789 The resources to be used within a LSF/PBS queue. Again, for CAF, the right one is selected.
790
791 =head3 B<group>
792
793 The physics GROUP which the user belong to ( it is for example PHYS_SUSY etc...). By specifying that the LSF accounting and fair share per sub-group is done properly.
794
795 =head1 FILES
796
797 I<crab> uses a configuration file I<crab.cfg> which contains configuration parameters. This file is written in the INI-style. The default filename can be changed by the I<-cfg> option.
798
799 I<crab> creates by default a working directory 'crab_0_E<lt>dateE<gt>_E<lt>timeE<gt>'
800
801 I<crab> saves all command lines in the file I<crab.history>.
802
803 I<crab> downloads some configuration files from internet and keeps cached copies in ~/.cms_crab and ~/.cms_sitedbcache directories. The location of those caches can be redirected using the enviromental variables CMS_SITEDB_CACHE_DIR and CMS_CRAB_CACHE_DIR
804
805 =head1 HISTORY
806
807 B<CRAB> is a tool for the CMS analysis on the Grid environment. It is based on the ideas from CMSprod, a production tool originally implemented by Nikolai Smirnov.
808
809 =head1 AUTHORS
810
811 """
812 author_string = '\n'
813 for auth in common.prog_authors:
814 #author = auth[0] + ' (' + auth[2] + ')' + ' E<lt>'+auth[1]+'E<gt>,\n'
815 author = auth[0] + ' E<lt>' + auth[1] +'E<gt>,\n'
816 author_string = author_string + author
817 pass
818 help_string = help_string + author_string[:-2] + '.'\
819 """
820
821 =cut
822 """
823
824 pod = tempfile.mktemp()+'.pod'
825 pod_file = open(pod, 'w')
826 pod_file.write(help_string)
827 pod_file.close()
828
829 if option == 'man':
830 man = tempfile.mktemp()
831 pod2man = 'pod2man --center=" " --release=" " '+pod+' >'+man
832 os.system(pod2man)
833 os.system('man '+man)
834 pass
835 elif option == 'tex':
836 fname = common.prog_name+'-v'+common.prog_version_str
837 tex0 = tempfile.mktemp()+'.tex'
838 pod2tex = 'pod2latex -full -out '+tex0+' '+pod
839 os.system(pod2tex)
840 tex = fname+'.tex'
841 tex_old = open(tex0, 'r')
842 tex_new = open(tex, 'w')
843 for s in tex_old.readlines():
844 if string.find(s, '\\begin{document}') >= 0:
845 tex_new.write('\\title{'+common.prog_name+'\\\\'+
846 '(Version '+common.prog_version_str+')}\n')
847 tex_new.write('\\author{\n')
848 for auth in common.prog_authors:
849 tex_new.write(' '+auth[0]+
850 '\\thanks{'+auth[1]+'} \\\\\n')
851 tex_new.write('}\n')
852 tex_new.write('\\date{}\n')
853 elif string.find(s, '\\tableofcontents') >= 0:
854 tex_new.write('\\maketitle\n')
855 continue
856 elif string.find(s, '\\clearpage') >= 0:
857 continue
858 tex_new.write(s)
859 tex_old.close()
860 tex_new.close()
861 print 'See '+tex
862 pass
863 elif option == 'html':
864 fname = common.prog_name+'-v'+common.prog_version_str+'.html'
865 pod2html = 'pod2html --title='+common.prog_name+\
866 ' --infile='+pod+' --outfile='+fname
867 os.system(pod2html)
868 print 'See '+fname
869 pass
870 elif option == 'txt':
871 fname = common.prog_name+'-v'+common.prog_version_str+'.txt'
872 pod2text = 'pod2text '+pod+' '+fname
873 os.system(pod2text)
874 print 'See '+fname
875 pass
876
877 sys.exit(0)