ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/crab_help.py
Revision: 1.49
Committed: Wed Mar 26 14:04:05 2008 UTC (17 years, 1 month ago) by spiga
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_2_2_0_pre4, CRAB_2_2_0_pre2
Changes since 1.48: +5 -5 lines
Log Message:
update

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 [range] -- 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 -publish [dbs_url] -- after the getouput, publish the data user in a local DBS instance
26 -kill [range] -- kill submitted jobs
27 -clean -- gracefully cleanup the idrectory of a task
28 -testJdl [range] -- check if resources exist which are compatible with jdl
29 -list [range] -- show technical job details
30 -postMortem [range] -- provide a file with information useful for post-mortem analysis of the jobs
31 -printId [range] -- print the job SID or Task Unique ID while using the server
32 -continue|-c [dir] -- Apply command to task stored in [dir].
33 -h [format] -- Detailed help. Formats: man (default), tex, html, txt
34 -cfg fname -- Configuration file name. Default is 'crab.cfg'
35 -debug N -- set the verbosity level to N
36 -v -- Print version and exit
37
38 "range" has syntax "n,m,l-p" which correspond to [n,m,l,l+1,...,p-1,p] and all possible combination
39
40 Example:
41 crab -create -submit 1
42 """
43 print usa_string
44 sys.exit(2)
45
46 ###########################################################################
47 def help(option='man'):
48 help_string = """
49 =pod
50
51 =head1 NAME
52
53 B<CRAB>: B<C>ms B<R>emote B<A>nalysis B<B>uilder
54
55 """+common.prog_name+""" version: """+common.prog_version_str+"""
56
57 This tool B<must> be used from an User Interface and the user is supposed to
58 have a valid Grid certificate.
59
60 =head1 SYNOPSIS
61
62 B<"""+common.prog_name+"""> [I<options>] [I<command>]
63
64 =head1 DESCRIPTION
65
66 CRAB is a Python program intended to simplify the process of creation and submission into Grid environment of CMS analysis jobs.
67
68 Parameters for CRAB usage and configuration are provided by the user changing the configuration file B<crab.cfg>.
69
70 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.
71
72 CRAB support any CMSSW based executable, with any modules/libraries, including the user provided one, and deals with the output produced by the executable. Up to version 1_2_1, also ORCA (and FAMOS) based executable were supported. CRAB provides an interface with 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 with user requirements.
73
74 CRAB can be used in two ways: StandAlone and with a Server.
75 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.
76 Instead, in the Server mode, suited for larger task, the jobs are prepared locally and then passed to a dedicated CRAB server, which then interact with the scheduler on behalf of the user, including additional services, such as automatic resubmission, status caching, output retrival, and more.
77 The CRAB commands are exactly the same in both cases.
78
79 CRAB web page is available at
80
81 I<http://cmsdoc.cern.ch/cms/ccs/wm/www/Crab/>
82
83 =head1 HOW TO RUN CRAB FOR THE IMPATIENT USER
84
85 Please, read all anyway!
86
87 Source B<crab.(c)sh> from the CRAB installation area, which have been setup either by you or by someone else for you.
88
89 Modify the CRAB configuration file B<crab.cfg> according to your need: see below for a complete list: in particular set your jobtype (orca or famos) and fill the corresponding section. A template and commented B<crab.cfg> can be found on B<$CRABDIR/python/crab.cfg>
90
91 ~>crab -create
92 create all jobs (no submission!)
93
94 ~>crab -submit 2 -continue [ui_working_dir]
95 submit 2 jobs, the ones already created (-continue)
96
97 ~>crab -create -submit 2
98 create _and_ submit 2 jobs
99
100 ~>crab -status
101 check the status of all jobs
102
103 ~>crab -getoutput
104 get back the output of all jobs
105
106 ~>crab -publish
107 publish all user outputs in the DBS specified in the crab.cfg (dbs_url_for_publication) or written as argument of this option
108
109 =head1 RUNNING CMSSW WITH CRAB
110
111 =over 4
112
113 =item B<A)>
114
115 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 actaully did compile your code> I<scramv1 b>.
116
117 =item B<B)>
118
119 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.
120
121 The most important parameters are the following (see below for complete description of each parameter):
122
123 =item B<Mandatory!>
124
125 =over 6
126
127 =item B<[CMSSW]> section: datasetpath, pset, splitting parameters, output_file
128
129 =item B<[USER]> section: output handling parameters, such as return_data, copy_data etc...
130
131 =back
132
133 =item B<Run it!>
134
135 You must have a valid voms-enabled Grid proxy. See CRAB web page for details.
136
137 =back
138
139 =head1 HOW TO RUN ON CONDOR-G
140
141 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.
142
143 Due to the nature of this submission possibility, 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).
144
145 =head2 B<Requirements:>
146
147 =over 2
148
149 =item installed and running local Condor scheduler
150
151 (either installed by the local Sysadmin or self-installed using the VDT user interface: http://www.uscms.org/SoftwareComputing/UserComputing/Tutorials/vdt.html)
152
153 =item locally available LCG or OSG UI installation
154
155 for authentication via Grid certificate proxies ("voms-proxy-init -voms cms" should result in valid proxy)
156
157 =item set of the environment variable EDG_WL_LOCATION to the edg directory of the local LCG or OSG UI installation
158
159 =back
160
161 =head2 B<What the Condor-G mode can do:>
162
163 =over 2
164
165 =item submission directly to a single OSG site,
166
167 the requested dataset has to be published correctly by the site in the local and global services
168
169 =back
170
171 =head2 B<What the Condor-G mode cannot do:>
172
173 =over 2
174
175 =item submit jobs if no condor scheduler is running on the submission machine
176
177 =item submit jobs if the local condor installation does not provide Condor-G capabilities
178
179 =item submit jobs to more than one site in parallel
180
181 =item submit jobs to a LCG site
182
183 =item support Grid certificate proxy renewal via the myproxy service
184
185 =back
186
187 =head2 B<CRAB configuration for Condor-G mode:>
188
189 The CRAB configuration for the Condor-G mode only requires changes in crab.cfg:
190
191 =over 2
192
193 =item select condor_g Scheduler:
194
195 scheduler = condor_g
196
197 =item select the domain for a single OSG site:
198
199 CE_white_list = "one of unl.edu,ufl.edu,ucsd.edu,wisc.edu,purdue.edu,ultralight.org,mit.edu"
200
201 =back
202
203 =head1 COMMAND
204
205 =over 4
206
207 =item B<-create>
208
209 Create the jobs: from version 1_3_0 it is only possible to create all jobs.
210 The maximum number of jobs depens on dataset and splittig directives. This set of identical jobs accessing the same dataset are defined as a task.
211 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).
212 See also I<-continue>.
213
214 =item B<-submit [range]>
215
216 Submit n jobs: 'n' is either a positive integer or 'all' or a [range]. Default is all.
217 If 'n' is passed as argument, the first 'n' suitable jobs will be submitted. Please note that this is behaviour is different from other commenads, 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.
218 This option must 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>.
219
220 =item B<-continue [dir] | -c [dir]>
221
222 Apply the action on the task stored on directory [dir]. If the task directory is the standard one (crab_0_date_time), the more recent in time is taken. Any other directory must be specified.
223 Basically all commands (but -create) need -continue, so it is automatically assumed. Of course, the standard task directory is used in this case.
224
225 =item B<-status>
226
227 Check the status of the jobs, in all states. All the info (e.g. application and wrapper exit codes) will be available only after the output retrieval.
228
229 =item B<-getoutput|-get [range]>
230
231 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>. See I<range> below for syntax.
232
233 =item B<-publish [dbs_url]>
234
235 Publish user output in a local DBS instance after retrieving of output. By default the publish uses the dbs_url_for_publication specified in the crab.cfg file, otherwise you can write it as argument of this option.
236
237 =item B<-resubmit [range]>
238
239 Resubmit jobs which have been previously submitted and have been either I<killed> or are I<aborted>. See I<range> below for syntax.
240 The resubmit option can be used only with CRAB without server. For the server this option will be implemented as soon as possible
241
242 =item B<-kill [range]>
243
244 Kill (cancel) jobs which have been submitted to the scheduler. A range B<must> be used in all cases, no default value is set.
245
246 =item B<-testJdl [range]>
247
248 Check if the job can find compatible resources. It's equivalent of doing I<edg-job-list-match> on edg.
249
250 =item B<-printId [range]>
251
252 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.
253
254 =item B<-postMortem [range]>
255
256 Try to collect more information of the job from the scheduler point of view.
257
258 =item B<-list [range]>
259
260 Dump technical informations about jobs: for developers only.
261
262 =item B<-clean [dir]>
263
264 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)!
265
266 =item B<-help [format] | -h [format]>
267
268 This help. It can be produced in three different I<format>: I<man> (default), I<tex> and I<html>.
269
270 =item B<-v>
271
272 Print the version and exit.
273
274 =item B<range>
275
276 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.
277 Example: 1,3-5,8 = {1,3,4,5,8}
278
279 =back
280
281 =head1 OPTION
282
283 =over 4
284
285 =item B<-cfg [file]>
286
287 Configuration file name. Default is B<crab.cfg>.
288
289 =item B<-debug [level]>
290
291 Set the debug level: high number for high verbosity.
292
293 =back
294
295 =head1 CONFIGURATION PARAMETERS
296
297 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> .
298 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.
299 Mandatory parameters are flagged with a *.
300
301 B<[CRAB]>
302
303 =over 4
304
305 =item B<jobtype *>
306
307 The type of the job to be executed: I<cmssw> jobtypes are supported
308
309 =item B<scheduler *>
310
311 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 sumbission (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
312 From version 210, also local scheduler are supported, for the tim being only at CERN. I<LSF> is the standard CERN local scheduler or I<CAF> which is LSF dedicated to CERN Analysis Facilities.
313
314 =item B<server_name>
315
316 To use the CRAB-server support it is needed to fill this key with server name as <Server_DOMAIN> (e.g. cnaf,fnal). If I<server_name=None> crab works in standalone way.
317 The server available to users can be found from CRAB web page.
318
319 =back
320
321 B<[CMSSW]>
322
323 =over 4
324
325 =item B<datasetpath *>
326
327 the path of processed dataset as defined on the DBS. It comes with the format I</PrimaryDataset/DataTier/Process> . In case no input is needed I<None> must be specified.
328
329 =item B<pset *>
330
331 the ParameterSet to be used
332
333 =item I<Of the following three parameter exactly two must be used, otherwise CRAB will complain.>
334
335 =item B<total_number_of_events *>
336
337 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<event_per_job>.
338
339 =item B<events_per_job*>
340
341 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.
342
343 =item B<number_of_jobs *>
344
345 Define the number of job to be run for the task. The number of event 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.
346
347 =item B<output_file *>
348
349 the output files produced by your application (comma separated list).
350
351 =item B<increment_seeds>
352
353 Specifies a comma separated list of seeds to increment from job to job. The initial value is taken
354 from the CMSSW config file. I<increment_seeds=sourceSeed,g4SimHits> will set sourceSeed=11,12,13 and g4SimHits=21,22,23 on
355 subsequent jobs if the values of the two seeds are 10 and 20 in the CMSSW config file.
356
357 See also I<preserve_seeds>. Seeds not listed in I<increment_seeds> or I<preserve_seeds> are randomly set for each job.
358
359 =item B<preserve_seeds>
360
361 Specifies a comma separated list of seeds to which CRAB will not change from their values in the user's
362 CMSSW config file. I<preserve_seeds=sourceSeed,g4SimHits> will leave the Pythia and GEANT seeds the same for every job.
363
364 See also I<increment_seeds>. Seeds not listed in I<increment_seeds> or I<preserve_seeds> are randomly set for each job.
365
366 =item B<pythia_seed>
367
368 This parameter is deprecated. See the documentation for I<increment_seeds> and I<preserve_seeds>.
369
370 =item B<vtx_seed>
371
372 This parameter is deprecated. See the documentation for I<increment_seeds> and I<preserve_seeds>.
373
374 =item B<g4_seed>
375
376 This parameter is deprecated. See the documentation for I<increment_seeds> and I<preserve_seeds>.
377
378 =item B<mix_seed>
379
380 This parameter is deprecated. See the documentation for I<increment_seeds> and I<preserve_seeds>.
381
382 =item B<first_run>
383
384 First run to be generated in a generation jobs. Relevant only for no-input workflow.
385
386 =item B<executable>
387
388 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.
389
390 =item I<DBS and DLS parameters:>
391
392 =item B<dbs_url>
393
394 The URL of the DBS query page. For expert only.
395
396 =back
397
398 B<[USER]>
399
400 =over 4
401
402 =item B<additional_input_files>
403
404 Any additional input file you want to ship to WN: comma separated list. These are the files which might be needed by your executable: they will be placed in the WN working dir. You don\'t need to specify the I<ParameterSet> you are using, which will be included automatically. Wildcards are allowed.
405
406 =item B<script_exe>
407
408 A user script that will be run on WN (instead of default cmsrun). It\'s up to the user to setup properly the script itself to run on WN enviroment. CRAB guarantees that the CMSSW environment is setup (eg scram is in the path) and that the modified pset.cfg will be placed in the working directory, with name CMSSW.cfg . The user must ensure that a job report named crab_fjr.xml will be written. This can be guaranteed by passing the arguments "-j crab_fjr.xml" to cmsRun in the script. The script itself will be added automatically to the input sandbox.
409
410 =item B<ui_working_dir>
411
412 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 eg the dataset is SingleMuon, the ui_working_dir will be set to SingleMuon as well.
413
414 =item B<thresholdLevel>
415
416 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 with the server_mode = 1.
417
418 =item B<eMail>
419
420 The server will notify the specified e-mail when the task will reaches the specified B<thresholdLevel>. A notification is also sended 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 with the server_mode = 1.
421
422 =item B<return_data *>
423
424 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 accomodate 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>.
425
426 =item B<outputdir>
427
428 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 defaul location of returned output is ui_working_dir/res .
429
430 =item B<logdir>
431
432 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 defaul location of returned output is ui_working_dir/res .
433
434 =item B<copy_data *>
435
436 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 recomended in case of large output.
437
438 =item B<storage_element>
439
440 To be used together with I<copy_data>. Storage Element name.
441
442 =item B<storage_path>
443
444 To be used together with I<copy_data>. Path where to put output files on Storage Element. Full path is needed, and the directory must be writeable by all.
445
446 =item B<copyCommand>
447
448 Only for LSF scheduer: allow to define the command to be used to copy the output to final location. Default is rfcp
449
450 =item B<register_data>
451
452 =back
453
454 B<[EDG]>
455
456 =over 4
457
458 =item B<RB>
459
460 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 actaully identical, being a colelction of all RB/WMS available for CMS: the configuration files needed to change the broker will be automatically downloaded from CRAB web page and used.
461 You can use any other RB which is available, if you provide the proper configuration files. Eg, for RB XYZ, you should provide I<edg_wl_ui.conf.CMS_XYZ> and I<edg_wl_ui_cmd_var.conf.CMS_XYZ> for EDG RB, or I<glite.conf.CMS_XYZ> for glite WMS. 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.
462 Please get in contact with crab team if you wish to provide your RB or WMS as a service to the CMS community.
463
464 =item B<proxy_server>
465
466 The proxy server to which you delegate the responsibility to renew your proxy once expired. The default is I<myproxy.cern.ch> : change only if you B<really> know what you are doing.
467
468 =item B<role>
469
470 The role to be set in the VOMS. See VOMS documentation for more info.
471
472 =item B<group>
473
474 The group to be set in the VOMS, See VOMS documentation for more info.
475
476 =item B<dont_check_proxy>
477
478 If you do not want CRAB to check your proxy. The creation of the proxy (with proper lenght), its delegation to a myproxyserver is your responsability.
479
480 =item B<requirements>
481
482 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.
483
484 =item B<additional_jdl_parameters:>
485
486 Any other parameters you want to add to jdl file:semicolon separated list, each
487 item B<must> be complete, including the closing ";".
488
489 =item B<wms_service>
490
491 With this field it\'s 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".
492
493 =item B<max_cpu_time>
494
495 Maximum CPU time needed to finish one job. It will be used to select a suitable queue on the CE. Time in minutes.
496
497 =item B<max_wall_clock_time>
498
499 Same as previous, but with real time, and not CPU one.
500
501 =item B<CE_black_list>
502
503 All the CE (Computing Element) whose name contains the following strings (comma separated list) will not be considered for submission. Use the dns domain (eg fnal, cern, ifae, fzk, cnaf, lnl,....)
504
505 =item B<CE_white_list>
506
507 Only the CE (Computing Element) whose name contains the following strings (comma separated list) will be considered for submission. Use the dns domain (eg fnal, cern, ifae, fzk, cnaf, lnl,....). Please note that if the selected CE(s) does not contain the data you want to access, no submission can take place.
508
509 =item B<SE_black_list>
510
511 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.
512
513 =item B<SE_white_list>
514
515 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.
516
517 =item B<virtual_organization>
518
519 You don\'t want to change this: it\'s cms!
520
521 =item B<retry_count>
522
523 Number of time the Grid will try to resubmit your job in case of Grid related problem.
524
525 =item B<shallow_retry_count>
526
527 Number of time shallow resubmission the Grid will try: resubmissions are tried B<only> if the job aborted B<before> start. So you are guaranteed that your jobs run strictly once.
528
529 =item B<maxtarballsize>
530
531 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)
532
533 =back
534
535 B<[LSF]>
536
537 =over 4
538
539 =item B<queue>
540
541 The LSF queue you want to use: if none, the default one will be used. For CAF, the proper queue will be autoamtically selected.
542
543 =item B<resource>
544
545 The resources to be used within a LSF queue. Again, for CAF, the right one is selected.
546
547
548 =back
549
550 =head1 FILES
551
552 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.
553
554 I<crab> creates by default a working directory 'crab_0_E<lt>dateE<gt>_E<lt>timeE<gt>'
555
556 I<crab> saves all command lines in the file I<crab.history>.
557
558 =head1 HISTORY
559
560 B<CRAB> is a tool for the CMS analysis on the Grid environment. It is based on the ideas from CMSprod, a production tools implemented originally by Nikolai Smirnov.
561
562 =head1 AUTHORS
563
564 """
565 author_string = '\n'
566 for auth in common.prog_authors:
567 #author = auth[0] + ' (' + auth[2] + ')' + ' E<lt>'+auth[1]+'E<gt>,\n'
568 author = auth[0] + ' E<lt>' + auth[1] +'E<gt>,\n'
569 author_string = author_string + author
570 pass
571 help_string = help_string + author_string[:-2] + '.'\
572 """
573
574 =cut
575 """
576
577 pod = tempfile.mktemp()+'.pod'
578 pod_file = open(pod, 'w')
579 pod_file.write(help_string)
580 pod_file.close()
581
582 if option == 'man':
583 man = tempfile.mktemp()
584 pod2man = 'pod2man --center=" " --release=" " '+pod+' >'+man
585 os.system(pod2man)
586 os.system('man '+man)
587 pass
588 elif option == 'tex':
589 fname = common.prog_name+'-v'+common.prog_version_str
590 tex0 = tempfile.mktemp()+'.tex'
591 pod2tex = 'pod2latex -full -out '+tex0+' '+pod
592 os.system(pod2tex)
593 tex = fname+'.tex'
594 tex_old = open(tex0, 'r')
595 tex_new = open(tex, 'w')
596 for s in tex_old.readlines():
597 if string.find(s, '\\begin{document}') >= 0:
598 tex_new.write('\\title{'+common.prog_name+'\\\\'+
599 '(Version '+common.prog_version_str+')}\n')
600 tex_new.write('\\author{\n')
601 for auth in common.prog_authors:
602 tex_new.write(' '+auth[0]+
603 '\\thanks{'+auth[1]+'} \\\\\n')
604 tex_new.write('}\n')
605 tex_new.write('\\date{}\n')
606 elif string.find(s, '\\tableofcontents') >= 0:
607 tex_new.write('\\maketitle\n')
608 continue
609 elif string.find(s, '\\clearpage') >= 0:
610 continue
611 tex_new.write(s)
612 tex_old.close()
613 tex_new.close()
614 print 'See '+tex
615 pass
616 elif option == 'html':
617 fname = common.prog_name+'-v'+common.prog_version_str+'.html'
618 pod2html = 'pod2html --title='+common.prog_name+\
619 ' --infile='+pod+' --outfile='+fname
620 os.system(pod2html)
621 print 'See '+fname
622 pass
623 elif option == 'txt':
624 fname = common.prog_name+'-v'+common.prog_version_str+'.txt'
625 pod2text = 'pod2text '+pod+' '+fname
626 os.system(pod2text)
627 print 'See '+fname
628 pass
629
630 sys.exit(0)