10 from optparse
import OptionParser
12 parser = OptionParser(usage=
'%prog <target_directories> [options]',
13 description=
'Check one or more chunck folders. Wildcard (*) can be used to specify multiple directories')
15 parser.add_option(
"-b",
"--batch", dest=
"batch",
17 help=
"batch command for resubmission" 20 (options,args) = parser.parse_args()
23 print 'provide at least one directory in argument. Use -h to display help' 30 if not os.path.isdir(dir):
32 if dir.find(
'_Chunk') == -1:
34 logName =
'/'.
join([dir,
'log.txt'])
35 if not os.path.isfile( logName ):
36 print dir,
': log.txt does not exist' 39 logFile = open(logName)
43 nEvents = line.split(
'processed:')[1]
47 print dir,
'cannot find number of processed events' 54 print 'list of bad directories:' 55 pprint.pprint(badDirs)
57 if options.batch
is not None:
61 cmd = [options.batch,
'-J', dir,
' < batchScript.sh' ]
62 print 'resubmitting in', os.getcwd()
static std::string join(char **cmd)