ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/Checker.py
Revision: 1.17
Committed: Tue May 26 10:23:00 2009 UTC (15 years, 11 months ago) by spiga
Content type: text/x-python
Branch: MAIN
Changes since 1.16: +6 -6 lines
Log Message:
adapting code to logging usage. (crab_logger removed)

File Contents

# User Rev Content
1 slacapra 1.1 from Actor import *
2     import common
3 slacapra 1.16 import string
4 slacapra 1.1
5     class Checker(Actor):
6     def __init__(self, cfg_params, nj_list):
7     self.cfg_params = cfg_params
8     self.nj_list = nj_list
9 slacapra 1.14 from WMCore.SiteScreening.BlackWhiteListParser import SEBlackWhiteListParser
10     seWhiteList = cfg_params.get('EDG.se_white_list',[])
11     seBlackList = cfg_params.get('EDG.se_black_list',[])
12     self.blackWhiteListParser = SEBlackWhiteListParser(seWhiteList, seBlackList, common.logger)
13 slacapra 1.16 self.datasetpath=self.cfg_params['CMSSW.datasetpath']
14     if string.lower(self.datasetpath)=='none':
15     self.datasetpath = None
16 slacapra 1.1 return
17 ewv 1.9
18 slacapra 1.1 def run(self):
19     """
20     The main method of the class.
21     """
22 spiga 1.17 common.logger.debug( "Checker::run() called")
23 slacapra 1.1
24     if len(self.nj_list)==0:
25 spiga 1.17 common.logger.debug( "No jobs to check")
26 slacapra 1.1 return
27 slacapra 1.10
28 spiga 1.11 task=common._db.getTask(self.nj_list)
29 slacapra 1.10 allMatch={}
30 slacapra 1.15
31 spiga 1.11 for job in task.jobs:
32 spiga 1.12 id_job = job['jobId']
33 slacapra 1.15 jobDest = job['dlsDestination']
34     if not jobDest: jobDest=[]
35     dest = self.blackWhiteListParser.cleanForBlackWhiteList(jobDest, True)
36 slacapra 1.14
37 slacapra 1.16 # only if some dest i s available or if dataset is None
38     if len(dest) > 0 or not self.datasetpath:
39     if ','.join(dest) in allMatch.keys():
40 spiga 1.17 common.logger.info("As previous job: "+str(allMatch[','.join(dest)]))
41 slacapra 1.16 else:
42     match = common.scheduler.listMatch(dest, True)
43     allMatch[','.join(dest)] = match
44     if len(match)>0:
45 spiga 1.17 common.logger.info("Found "+str(len(match))+" compatible site(s) for job "+str(id_job)+" : "+str(match))
46 slacapra 1.16 else:
47 spiga 1.17 common.logger.info("No compatible site found, will not submit jobs "+str(id_job))
48 slacapra 1.16 pass
49     pass
50 ewv 1.9 else:
51 spiga 1.17 common.logger.info("No compatible site found, will not submit jobs "+str(id_job))
52 slacapra 1.1 return