ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitProd/Processing/bin/jobSitter.py
(Generate patch)

Comparing UserCode/MitProd/Processing/bin/jobSitter.py (file contents):
Revision 1.6 by paus, Sun Dec 5 01:01:21 2010 UTC vs.
Revision 1.8 by paus, Thu Oct 20 23:07:28 2011 UTC

# Line 119 | Line 119 | def removeJobRemainders(storageEle,stora
119   #===================================================================================================
120   # Define string to explain usage of the script
121   usage = \
122 <      "\nUsage: jobSitter.py [ --pattern= --blacklist=" + \
123 <      "                        --status  --help --backward --clean --extend --one --exe ]\n"
122 >      "\nUsage: jobSitter.py [ --pattern= --apattern= --blacklist=" \
123 >      +                      "  --status --kill --remove --help --backward --clean --extend --one" \
124 >      +                      " --exe ]\n"
125  
126   # Define the valid options which can be specified and check out the command line
127 < valid = ['pattern=','blacklist=','catalog=','help','backward','kill','clean','exe','extend','one']
127 > valid = ['pattern=','apattern=','blacklist=','catalog=',
128 >         'help','backward','kill','remove','clean','exe','extend','one']
129   try:
130      opts, args = getopt.getopt(sys.argv[1:], "", valid)
131   except getopt.GetoptError, ex:
# Line 136 | Line 138 | except getopt.GetoptError, ex:
138   # --------------------------------------------------------------------------------------------------
139   # Set defaults
140   pattern   = ''
141 + apattern  = ''
142   blacklist = ''
143   catalog   = 0
144   clean     = 0
145   kill      = 0
146 + remove    = 0
147   exe       = 0
148   extend    = 0
149   one       = 0
# Line 152 | Line 156 | for opt, arg in opts:
156          sys.exit(0)
157      if opt == "--pattern":
158          pattern   = arg
159 +    if opt == "--apattern":
160 +        apattern  = arg
161      if opt == "--blacklist":
162          blacklist = arg
163      if opt == "--catalog":
# Line 168 | Line 174 | for opt, arg in opts:
174          backward  = ' -r '
175      if opt == "--kill":
176          kill      = 1
177 +    if opt == "--remove":
178 +        remove    = 1
179  
180   # --------------------------------------------------------------------------------------------------
181   # Here is where the real action starts -------------------------------------------------------------
# Line 188 | Line 196 | for line in os.popen(cmd).readlines():
196      crabTask   = task.Task(tag)
197  
198      #print 'Pattern: ' + pattern + '  tag: ' + crabTask.mitDataset
199 +    if apattern != '' and re.search(apattern,crabTask.mitDataset):
200 +        print '\n Skipping: ' + crabTask.mitDataset + '\n\n'
201      if re.search(pattern,crabTask.mitDataset):
202          crabTasks.append(crabTask)
203          crabTask.show()
# Line 197 | Line 207 | for line in os.popen(cmd).readlines():
207  
208   # Process the crab tasks determined to be relevant in the last query
209   print '\n=============================================================================='
210 < print ' Process crab task list (please wait, crab commands are first fully parsed)\n'
210 > print ' Process crab task list\n'
211   i = 0
212   for crabTask in crabTasks:
213  
# Line 214 | Line 224 | for crabTask in crabTasks:
224              crabTask.killAndRemove(1)
225              continue
226  
227 +    if remove == 1:
228 +            crabTask.remove(1)
229 +            continue
230 +
231      crabTask.loadAllLfns(crabTask.mitCfg + '/' + crabTask.mitVersion + '/' + \
232                           crabTask.mitDataset + '.lfns')
233      #if crabTask.status == 'cataloged':
# Line 262 | Line 276 | for crabTask in crabTasks:
276      if extend == 1:
277          cmd = 'crab -extend -c ' + crabTask.tag
278          print '\n------------------------------------------------------------------------------'
279 <        print '  --> EXTEND ' + crabTask.tag + ' -- wait crab commands first fully parsed -- ' \
279 >        print '  --> EXTEND ' + crabTask.tag + ' -- ' \
280                + '\n       -> ' + dataset   + '  (' + crabTask.mitDataset + ')'\
281                + '\n       -> ' + storageEle \
282                + '\n       -> ' + storagePath
# Line 271 | Line 285 | for crabTask in crabTasks:
285          os.system(cmd)
286  
287      print '\n------------------------------------------------------------------------------'
288 <    print '  --> STATUS ' + crabTask.tag + ' -- wait crab commands first fully parsed -- ' \
288 >    print '  --> STATUS ' + crabTask.tag + ' -- ' \
289            + '\n       -> ' + dataset   + '  (' + crabTask.mitDataset + ')'\
290            + '\n       -> ' + storageEle \
291            + '\n       -> ' + storagePath
# Line 347 | Line 361 | for crabTask in crabTasks:
361  
362      cmd = 'crab -getoutput -continue ' + crabTask.tag
363      print '\n------------------------------------------------------------------------------'
364 <    print '  --> GETOUTPUT ' + crabTask.tag + ' -- wait crab commands first fully parsed -- ' \
364 >    print '  --> GETOUTPUT ' + crabTask.tag + ' -- ' \
365            + '\n       -> ' + dataset \
366            + '\n       -> ' + storageEle \
367            + '\n       -> ' + storagePath

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines