5 from __future__
import print_function
11 from optparse
import OptionParser
13 parser = OptionParser(usage=
'%prog <target_directories> [options]',
14 description=
'Check one or more chunck folders. Wildcard (*) can be used to specify multiple directories')
16 parser.add_option(
"-b",
"--batch", dest=
"batch",
18 help=
"batch command for resubmission"
21 (options,args) = parser.parse_args()
24 print(
'provide at least one directory in argument. Use -h to display help')
31 if not os.path.isdir(dir):
33 if dir.find(
'_Chunk') == -1:
35 logName =
'/'.
join([dir,
'log.txt'])
36 if not os.path.isfile( logName ):
37 print(dir,
': log.txt does not exist')
40 logFile = open(logName)
44 nEvents = line.split(
'processed:')[1]
48 print(dir,
'cannot find number of processed events')
50 print(dir,
'0 events')
55 print(
'list of bad directories:')
56 pprint.pprint(badDirs)
58 if options.batch
is not None:
62 cmd = [options.batch,
'-J', dir,
' < batchScript.sh' ]
63 print(
'resubmitting in', os.getcwd())