ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Submitter.py
Revision: 1.8
Committed: Tue Jul 26 16:49:11 2005 UTC (19 years, 9 months ago) by slacapra
Content type: text/x-python
Branch: MAIN
CVS Tags: CRAB_1_0_0_pre3, CRAB_1_0_0_pre2, CRAB_1_0_0_pre1
Changes since 1.7: +5 -4 lines
Log Message:
more changes

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