ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Submitter.py
Revision: 1.6
Committed: Thu Jun 30 10:35:27 2005 UTC (19 years, 10 months ago) by nsmirnov
Content type: text/x-python
Branch: MAIN
Changes since 1.5: +16 -3 lines
Log Message:
more flexible syntax for job range

File Contents

# User Rev Content
1 nsmirnov 1.1 from Actor import *
2 nsmirnov 1.6 from crab_util import *
3 nsmirnov 1.2 import common
4 nsmirnov 1.1
5     class Submitter(Actor):
6 nsmirnov 1.4 def __init__(self, cfg_params, nj_list):
7 nsmirnov 1.1 self.cfg_params = cfg_params
8 nsmirnov 1.4 self.nj_list = nj_list
9 nsmirnov 1.1 return
10    
11     def run(self):
12 nsmirnov 1.2 """
13     The main method of the class.
14     """
15    
16     common.logger.debug(5, "Submitter::run() called")
17    
18     # Loop over jobs
19    
20 nsmirnov 1.6 njs = 0
21 nsmirnov 1.4 for nj in self.nj_list:
22 nsmirnov 1.2 st = common.jobDB.status(nj)
23 nsmirnov 1.6 if st != 'C' and st != 'K':
24     long_st = crabJobStatusToString(st)
25     msg = "Job # %d is not submitted: status %s"%(nj+1, long_st)
26     common.logger.message(msg)
27     continue
28 nsmirnov 1.2
29 nsmirnov 1.6 common.logger.message("Submitting job # "+`(nj+1)`)
30 nsmirnov 1.2
31     jid = common.scheduler.submit(nj)
32    
33     common.jobDB.setStatus(nj, 'S')
34     common.jobDB.setJobId(nj, jid)
35 nsmirnov 1.6 njs += 1
36 nsmirnov 1.2 pass
37    
38     ####
39    
40     common.jobDB.save()
41    
42 nsmirnov 1.6 msg = '\nTotal of %d jobs submitted'%njs
43     if njs != len(self.nj_list) :
44     msg += ' (from %d requested).'%(len(self.nj_list))
45     pass
46     else:
47     msg += '.'
48     pass
49 nsmirnov 1.2 common.logger.message(msg)
50 nsmirnov 1.1 return
51