1 |
slacapra |
1.1 |
from Actor import *
|
2 |
|
|
import common
|
3 |
|
|
|
4 |
|
|
class Checker(Actor):
|
5 |
|
|
def __init__(self, cfg_params, nj_list):
|
6 |
|
|
self.cfg_params = cfg_params
|
7 |
|
|
self.nj_list = nj_list
|
8 |
|
|
return
|
9 |
ewv |
1.9 |
|
10 |
slacapra |
1.1 |
def run(self):
|
11 |
|
|
"""
|
12 |
|
|
The main method of the class.
|
13 |
|
|
"""
|
14 |
|
|
common.logger.debug(5, "Checker::run() called")
|
15 |
|
|
|
16 |
|
|
if len(self.nj_list)==0:
|
17 |
|
|
common.logger.debug(5, "No jobs to check")
|
18 |
|
|
return
|
19 |
slacapra |
1.10 |
|
20 |
spiga |
1.11 |
task=common._db.getTask(self.nj_list)
|
21 |
slacapra |
1.10 |
allMatch={}
|
22 |
spiga |
1.11 |
for job in task.jobs:
|
23 |
spiga |
1.12 |
id_job = job['jobId']
|
24 |
spiga |
1.11 |
dest = job['dlsDestination']
|
25 |
slacapra |
1.10 |
if dest in allMatch.keys():
|
26 |
|
|
common.logger.message("As previous job: "+str(allMatch[dest]))
|
27 |
ewv |
1.9 |
else:
|
28 |
slacapra |
1.10 |
match = common.scheduler.listMatch(dest)
|
29 |
spiga |
1.11 |
# allMatch[job['dlsDestination']]= match
|
30 |
slacapra |
1.10 |
if len(match)>0:
|
31 |
|
|
common.logger.message("Found "+str(len(match))+" compatible site(s) for job "+str(id_job)+" : "+str(match))
|
32 |
|
|
else:
|
33 |
|
|
common.logger.message("No compatible site found, will not submit jobs "+str(id_job))
|
34 |
slacapra |
1.1 |
|
35 |
|
|
return
|