ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Submitter.py
Revision: 1.7
Committed: Wed Jul 20 10:03:22 2005 UTC (19 years, 9 months ago) by slacapra
Content type: text/x-python
Branch: MAIN
Changes since 1.6: +6 -0 lines
Log Message:
too many changes to list them here...

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 slacapra 1.7
18     # run a list-match on first job
19     firstJob=self.nj_list[0]
20     match = common.scheduler.listMatch(firstJob)
21    
22     common.logger.message("Found compatible resources")
23 nsmirnov 1.2
24     # Loop over jobs
25    
26 nsmirnov 1.6 njs = 0
27 nsmirnov 1.4 for nj in self.nj_list:
28 nsmirnov 1.2 st = common.jobDB.status(nj)
29 nsmirnov 1.6 if st != 'C' and st != 'K':
30     long_st = crabJobStatusToString(st)
31     msg = "Job # %d is not submitted: status %s"%(nj+1, long_st)
32     common.logger.message(msg)
33     continue
34 nsmirnov 1.2
35 nsmirnov 1.6 common.logger.message("Submitting job # "+`(nj+1)`)
36 nsmirnov 1.2
37     jid = common.scheduler.submit(nj)
38    
39     common.jobDB.setStatus(nj, 'S')
40     common.jobDB.setJobId(nj, jid)
41 nsmirnov 1.6 njs += 1
42 nsmirnov 1.2 pass
43    
44     ####
45    
46     common.jobDB.save()
47    
48 nsmirnov 1.6 msg = '\nTotal of %d jobs submitted'%njs
49     if njs != len(self.nj_list) :
50     msg += ' (from %d requested).'%(len(self.nj_list))
51     pass
52     else:
53     msg += '.'
54     pass
55 nsmirnov 1.2 common.logger.message(msg)
56 nsmirnov 1.1 return
57