1 |
nsmirnov |
1.1 |
from Actor import *
|
2 |
nsmirnov |
1.6 |
from crab_util import *
|
3 |
nsmirnov |
1.2 |
import common
|
4 |
corvo |
1.9 |
from ApmonIf import ApmonIf
|
5 |
slacapra |
1.60 |
#from random import random
|
6 |
corvo |
1.30 |
import time
|
7 |
ewv |
1.139 |
import socket
|
8 |
ewv |
1.140 |
import Scram
|
9 |
slacapra |
1.60 |
from ProgressBar import ProgressBar
|
10 |
|
|
from TerminalController import TerminalController
|
11 |
spiga |
1.175 |
try:
|
12 |
|
|
from hashlib import sha1
|
13 |
|
|
except:
|
14 |
|
|
from sha import sha as sha1
|
15 |
|
|
|
16 |
nsmirnov |
1.1 |
|
17 |
|
|
class Submitter(Actor):
|
18 |
slacapra |
1.84 |
def __init__(self, cfg_params, parsed_range, val):
|
19 |
nsmirnov |
1.1 |
self.cfg_params = cfg_params
|
20 |
ewv |
1.161 |
self.limitJobs = True
|
21 |
slacapra |
1.84 |
# get user request
|
22 |
spiga |
1.156 |
self.nsjobs = -1
|
23 |
|
|
self.chosenJobsList = None
|
24 |
slacapra |
1.84 |
if val:
|
25 |
slacapra |
1.91 |
if val=='range': # for Resubmitter
|
26 |
spiga |
1.156 |
self.chosenJobsList = parsed_range
|
27 |
ewv |
1.92 |
elif val=='all':
|
28 |
slacapra |
1.84 |
pass
|
29 |
|
|
elif (type(eval(val)) is int) and eval(val) > 0:
|
30 |
|
|
# positive number
|
31 |
spiga |
1.156 |
self.nsjobs = eval(val)
|
32 |
slacapra |
1.84 |
elif (type(eval(val)) is tuple)or( type(eval(val)) is int and eval(val)<0 ) :
|
33 |
spiga |
1.156 |
self.chosenJobsList = parsed_range
|
34 |
farinafa |
1.158 |
self.nsjobs = len(self.chosenJobsList)
|
35 |
slacapra |
1.84 |
else:
|
36 |
|
|
msg = 'Bad submission option <'+str(val)+'>\n'
|
37 |
|
|
msg += ' Must be an integer or "all"'
|
38 |
|
|
msg += ' Generic range is not allowed"'
|
39 |
|
|
raise CrabException(msg)
|
40 |
|
|
pass
|
41 |
spiga |
1.156 |
self.seWhiteList = cfg_params.get('GRID.se_white_list',[])
|
42 |
|
|
self.seBlackList = cfg_params.get('GRID.se_black_list',[])
|
43 |
ewv |
1.157 |
self.datasetPath=self.cfg_params['CMSSW.datasetpath']
|
44 |
|
|
if string.lower(self.datasetPath)=='none':
|
45 |
|
|
self.datasetPath = None
|
46 |
spiga |
1.156 |
self.scram = Scram.Scram(cfg_params)
|
47 |
|
|
return
|
48 |
|
|
|
49 |
spiga |
1.165 |
#wmbs
|
50 |
|
|
def BuildJobList(self,type=0):
|
51 |
slacapra |
1.84 |
# total jobs
|
52 |
|
|
nj_list = []
|
53 |
spiga |
1.166 |
self.complete_List = common._db.nJobs('list')
|
54 |
riahi |
1.177 |
if type==1:
|
55 |
spiga |
1.166 |
self.nj_list =[]
|
56 |
ewv |
1.176 |
if self.chosenJobsList: self.nj_list = self.chosenJobsList
|
57 |
spiga |
1.165 |
return
|
58 |
spiga |
1.156 |
# build job list
|
59 |
|
|
from WMCore.SiteScreening.BlackWhiteListParser import SEBlackWhiteListParser
|
60 |
|
|
self.blackWhiteListParser = SEBlackWhiteListParser(self.seWhiteList, self.seBlackList, common.logger())
|
61 |
|
|
common.logger.debug('nsjobs '+str(self.nsjobs))
|
62 |
slacapra |
1.84 |
# get the first not already submitted
|
63 |
spiga |
1.145 |
common.logger.debug('Total jobs '+str(len(self.complete_List)))
|
64 |
ewv |
1.161 |
|
65 |
slacapra |
1.84 |
jobSetForSubmission = 0
|
66 |
|
|
jobSkippedInSubmission = []
|
67 |
spiga |
1.115 |
tmp_jList = self.complete_List
|
68 |
spiga |
1.156 |
if self.chosenJobsList != None:
|
69 |
|
|
tmp_jList = self.chosenJobsList
|
70 |
spiga |
1.134 |
for job in common._db.getTask(tmp_jList).jobs:
|
71 |
ewv |
1.135 |
cleanedBlackWhiteList = self.blackWhiteListParser.cleanForBlackWhiteList(job['dlsDestination'])
|
72 |
ewv |
1.157 |
if (cleanedBlackWhiteList != '') or (self.datasetPath == None):
|
73 |
slacapra |
1.155 |
#if ( job.runningJob['status'] in ['C','RC'] and job.runningJob['statusScheduler'] in ['Created',None]):
|
74 |
|
|
if ( job.runningJob['state'] in ['Created']):
|
75 |
slacapra |
1.84 |
jobSetForSubmission +=1
|
76 |
ewv |
1.135 |
nj_list.append(job['id'])
|
77 |
ewv |
1.92 |
else:
|
78 |
slacapra |
1.84 |
continue
|
79 |
|
|
else :
|
80 |
spiga |
1.134 |
jobSkippedInSubmission.append( job['id'] )
|
81 |
spiga |
1.156 |
if self.nsjobs >0 and self.nsjobs == jobSetForSubmission:
|
82 |
slacapra |
1.84 |
break
|
83 |
|
|
pass
|
84 |
spiga |
1.156 |
if self.nsjobs>jobSetForSubmission:
|
85 |
|
|
common.logger.info('asking to submit '+str(self.nsjobs)+' jobs, but only '+\
|
86 |
spiga |
1.134 |
str(jobSetForSubmission)+' left: submitting those')
|
87 |
slacapra |
1.84 |
if len(jobSkippedInSubmission) > 0 :
|
88 |
|
|
mess =""
|
89 |
|
|
for jobs in jobSkippedInSubmission:
|
90 |
|
|
mess += str(jobs) + ","
|
91 |
spiga |
1.156 |
common.logger.info("Jobs: " +str(mess) + "\n\tskipped because no sites are hosting this data\n")
|
92 |
slacapra |
1.89 |
self.submissionError()
|
93 |
|
|
pass
|
94 |
slacapra |
1.84 |
# submit N from last submitted job
|
95 |
spiga |
1.145 |
common.logger.debug('nj_list '+str(nj_list))
|
96 |
slacapra |
1.84 |
self.nj_list = nj_list
|
97 |
ewv |
1.161 |
if self.limitJobs and len(self.nj_list) > 500:
|
98 |
|
|
msg = "The CRAB client will not submit more than 500 jobs.\n"
|
99 |
|
|
msg += "Use the server mode or submit your jobs in smaller groups"
|
100 |
|
|
raise CrabException(msg)
|
101 |
nsmirnov |
1.1 |
return
|
102 |
ewv |
1.92 |
|
103 |
nsmirnov |
1.1 |
def run(self):
|
104 |
nsmirnov |
1.2 |
"""
|
105 |
slacapra |
1.53 |
The main method of the class: submit jobs in range self.nj_list
|
106 |
nsmirnov |
1.2 |
"""
|
107 |
spiga |
1.145 |
common.logger.debug("Submitter::run() called")
|
108 |
slacapra |
1.24 |
|
109 |
spiga |
1.112 |
start = time.time()
|
110 |
|
|
|
111 |
riahi |
1.177 |
|
112 |
spiga |
1.156 |
self.BuildJobList()
|
113 |
|
|
|
114 |
ewv |
1.128 |
check = self.checkIfCreate()
|
115 |
|
|
|
116 |
spiga |
1.112 |
if check == 0 :
|
117 |
|
|
self.SendMLpre()
|
118 |
ewv |
1.128 |
|
119 |
|
|
list_matched , task = self.performMatch()
|
120 |
|
|
njs = self.perfromSubmission(list_matched, task)
|
121 |
|
|
|
122 |
spiga |
1.112 |
stop = time.time()
|
123 |
spiga |
1.145 |
common.logger.debug("Submission Time: "+str(stop - start))
|
124 |
ewv |
1.128 |
|
125 |
spiga |
1.149 |
msg = 'Total of %d jobs submitted'%njs
|
126 |
spiga |
1.112 |
if njs != len(self.nj_list) :
|
127 |
|
|
msg += ' (from %d requested).'%(len(self.nj_list))
|
128 |
|
|
else:
|
129 |
|
|
msg += '.'
|
130 |
spiga |
1.145 |
common.logger.info(msg)
|
131 |
ewv |
1.128 |
|
132 |
spiga |
1.112 |
if (njs < len(self.nj_list) or len(self.nj_list)==0):
|
133 |
|
|
self.submissionError()
|
134 |
|
|
|
135 |
spiga |
1.165 |
#wmbs
|
136 |
|
|
def checkIfCreate(self,type=0):
|
137 |
spiga |
1.112 |
"""
|
138 |
|
|
"""
|
139 |
|
|
code = 0
|
140 |
spiga |
1.134 |
task=common._db.getTask()
|
141 |
spiga |
1.165 |
if type == 1 and len(task.jobs)==0:
|
142 |
|
|
if task['jobType']=='Submitted':
|
143 |
|
|
common.logger.info("No Request to be submitted: first create it.\n")
|
144 |
|
|
code=1
|
145 |
|
|
else:
|
146 |
|
|
totalCreatedJobs = 0
|
147 |
|
|
for job in task.jobs:
|
148 |
|
|
if job.runningJob['state'] == 'Created': totalCreatedJobs +=1
|
149 |
ewv |
1.176 |
|
150 |
spiga |
1.165 |
if (totalCreatedJobs==0):
|
151 |
|
|
common.logger.info("No jobs to be submitted: first create them")
|
152 |
|
|
code = 1
|
153 |
ewv |
1.128 |
return code
|
154 |
ewv |
1.92 |
|
155 |
gutsche |
1.70 |
|
156 |
ewv |
1.128 |
def performMatch(self):
|
157 |
|
|
"""
|
158 |
spiga |
1.113 |
"""
|
159 |
spiga |
1.145 |
common.logger.info("Checking available resources...")
|
160 |
ewv |
1.128 |
### define here the list of distinct destinations sites list
|
161 |
spiga |
1.94 |
distinct_dests = common._db.queryDistJob_Attr('dlsDestination', 'jobId' ,self.nj_list)
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
### define here the list of jobs Id for each distinct list of sites
|
165 |
spiga |
1.112 |
self.sub_jobs =[] # list of jobs Id list to submit
|
166 |
spiga |
1.95 |
jobs_to_match =[] # list of jobs Id to match
|
167 |
ewv |
1.128 |
all_jobs=[]
|
168 |
spiga |
1.94 |
count=0
|
169 |
ewv |
1.128 |
for distDest in distinct_dests:
|
170 |
spiga |
1.94 |
all_jobs.append(common._db.queryAttrJob({'dlsDestination':distDest},'jobId'))
|
171 |
|
|
sub_jobs_temp=[]
|
172 |
|
|
for i in self.nj_list:
|
173 |
ewv |
1.128 |
if i in all_jobs[count]: sub_jobs_temp.append(i)
|
174 |
spiga |
1.94 |
if len(sub_jobs_temp)>0:
|
175 |
ewv |
1.128 |
self.sub_jobs.append(sub_jobs_temp)
|
176 |
spiga |
1.112 |
jobs_to_match.append(self.sub_jobs[count][0])
|
177 |
spiga |
1.103 |
count +=1
|
178 |
spiga |
1.94 |
sel=0
|
179 |
ewv |
1.128 |
matched=[]
|
180 |
spiga |
1.95 |
|
181 |
|
|
task=common._db.getTask()
|
182 |
|
|
for id_job in jobs_to_match :
|
183 |
spiga |
1.121 |
match = common.scheduler.listMatch(distinct_dests[sel], False)
|
184 |
slacapra |
1.111 |
if len(match)>0:
|
185 |
spiga |
1.145 |
common.logger.info("Found compatible site(s) for job "+str(id_job))
|
186 |
slacapra |
1.110 |
matched.append(sel)
|
187 |
spiga |
1.77 |
else:
|
188 |
spiga |
1.145 |
common.logger.info("No compatible site found, will not submit jobs "+str(self.sub_jobs[sel]))
|
189 |
slacapra |
1.110 |
self.submissionError()
|
190 |
spiga |
1.94 |
sel += 1
|
191 |
ewv |
1.92 |
|
192 |
ewv |
1.128 |
return matched , task
|
193 |
spiga |
1.112 |
|
194 |
|
|
def perfromSubmission(self,matched,task):
|
195 |
|
|
|
196 |
ewv |
1.128 |
njs=0
|
197 |
|
|
|
198 |
spiga |
1.94 |
### Progress Bar indicator, deactivate for debug
|
199 |
spiga |
1.147 |
if common.debugLevel == 0 :
|
200 |
slacapra |
1.110 |
term = TerminalController()
|
201 |
ewv |
1.128 |
|
202 |
|
|
if len(matched)>0:
|
203 |
spiga |
1.145 |
common.logger.info(str(len(matched))+" blocks of jobs will be submitted")
|
204 |
spiga |
1.159 |
common.logger.debug("Delegating proxy ")
|
205 |
|
|
try:
|
206 |
|
|
common.scheduler.delegateProxy()
|
207 |
|
|
except CrabException:
|
208 |
farinafa |
1.163 |
common.logger.debug("Proxy delegation failed ")
|
209 |
spiga |
1.159 |
|
210 |
ewv |
1.128 |
for ii in matched:
|
211 |
spiga |
1.145 |
common.logger.debug('Submitting jobs '+str(self.sub_jobs[ii]))
|
212 |
spiga |
1.112 |
|
213 |
farinafa |
1.174 |
# fix arguments for unique naming of the output
|
214 |
|
|
common._db.updateResubAttribs(self.sub_jobs[ii])
|
215 |
|
|
|
216 |
slacapra |
1.110 |
try:
|
217 |
spiga |
1.112 |
common.scheduler.submit(self.sub_jobs[ii],task)
|
218 |
slacapra |
1.110 |
except CrabException:
|
219 |
|
|
raise CrabException("Job not submitted")
|
220 |
|
|
|
221 |
spiga |
1.150 |
if common.debugLevel == 0 :
|
222 |
spiga |
1.112 |
try: pbar = ProgressBar(term, 'Submitting '+str(len(self.sub_jobs[ii]))+' jobs')
|
223 |
corvo |
1.74 |
except: pbar = None
|
224 |
spiga |
1.150 |
if common.debugLevel == 0:
|
225 |
spiga |
1.94 |
if pbar :
|
226 |
spiga |
1.112 |
pbar.update(float(ii+1)/float(len(self.sub_jobs)),'please wait')
|
227 |
ewv |
1.128 |
### check the if the submission succeded Maybe not needed or at least simplified
|
228 |
spiga |
1.112 |
sched_Id = common._db.queryRunJob('schedulerId', self.sub_jobs[ii])
|
229 |
spiga |
1.95 |
listId=[]
|
230 |
spiga |
1.94 |
run_jobToSave = {'status' :'S'}
|
231 |
spiga |
1.108 |
listRunField = []
|
232 |
ewv |
1.128 |
for j in range(len(self.sub_jobs[ii])):
|
233 |
|
|
if str(sched_Id[j]) != '':
|
234 |
|
|
listId.append(self.sub_jobs[ii][j])
|
235 |
|
|
listRunField.append(run_jobToSave)
|
236 |
spiga |
1.145 |
common.logger.debug("Submitted job # "+ str(self.sub_jobs[ii][j]))
|
237 |
spiga |
1.94 |
njs += 1
|
238 |
ewv |
1.128 |
common._db.updateRunJob_(listId, listRunField)
|
239 |
mcinquil |
1.144 |
self.stateChange(listId,"SubSuccess")
|
240 |
spiga |
1.112 |
self.SendMLpost(self.sub_jobs[ii])
|
241 |
spiga |
1.94 |
else:
|
242 |
spiga |
1.145 |
common.logger.info("The whole task doesn't found compatible site ")
|
243 |
ewv |
1.92 |
|
244 |
spiga |
1.112 |
return njs
|
245 |
spiga |
1.99 |
|
246 |
|
|
def submissionError(self):
|
247 |
|
|
## add some more verbose message in case submission is not complete
|
248 |
|
|
msg = 'Submission performed using the Requirements: \n'
|
249 |
|
|
### TODO_ DS--BL
|
250 |
|
|
#msg += common.taskDB.dict("jobtype")+' version: '+common.taskDB.dict("codeVersion")+'\n'
|
251 |
|
|
#msg += '(Hint: please check if '+common.taskDB.dict("jobtype")+' is available at the Sites)\n'
|
252 |
spiga |
1.146 |
if self.cfg_params.has_key('GRID.se_white_list'):
|
253 |
|
|
msg += '\tSE White List: '+self.cfg_params['GRID.se_white_list']+'\n'
|
254 |
|
|
if self.cfg_params.has_key('GRID.se_black_list'):
|
255 |
|
|
msg += '\tSE Black List: '+self.cfg_params['GRID.se_black_list']+'\n'
|
256 |
|
|
if self.cfg_params.has_key('GRID.ce_white_list'):
|
257 |
|
|
msg += '\tCE White List: '+self.cfg_params['GRID.ce_white_list']+'\n'
|
258 |
|
|
if self.cfg_params.has_key('GRID.ce_black_list'):
|
259 |
|
|
msg += '\tCE Black List: '+self.cfg_params['GRID.ce_black_list']+'\n'
|
260 |
|
|
removeDefBL = self.cfg_params.get('GRID.remove_default_blacklist',0)
|
261 |
spiga |
1.137 |
if removeDefBL == '0':
|
262 |
|
|
msg += '\tNote: All CMS T1s are BlackListed by default \n'
|
263 |
spiga |
1.136 |
msg += '\t(Hint: By whitelisting you force the job to run at this particular site(s).\n'
|
264 |
ewv |
1.176 |
msg += '\tPlease check if:\n'
|
265 |
|
|
msg += '\t\t -- the dataset is available at this site\n'
|
266 |
|
|
msg += '\t\t -- the CMSSW version is available at this site\n'
|
267 |
|
|
msg += '\t\t -- grid submission to CERN & FNAL CAFs is not allowed)\n'
|
268 |
|
|
msg += '\tPlease also look at the Site Status Page for CMS sites,\n'
|
269 |
slacapra |
1.169 |
msg += '\t to check if the sites hosting your data are ok\n'
|
270 |
|
|
msg += '\t http://dashb-ssb.cern.ch/dashboard/request.py/siteviewhome\n'
|
271 |
spiga |
1.145 |
common.logger.info(msg)
|
272 |
spiga |
1.112 |
|
273 |
|
|
return
|
274 |
spiga |
1.99 |
|
275 |
spiga |
1.112 |
def collect_MLInfo(self):
|
276 |
|
|
"""
|
277 |
ewv |
1.129 |
Prepare DashBoard information
|
278 |
spiga |
1.112 |
"""
|
279 |
ewv |
1.92 |
|
280 |
spiga |
1.142 |
taskId = common._db.queryTask('name')
|
281 |
spiga |
1.112 |
gridName = string.strip(common.scheduler.userName())
|
282 |
spiga |
1.151 |
common.logger.debug("GRIDNAME: %s "%gridName)
|
283 |
fanzago |
1.178 |
#### FEDE for taskType (savannah 76950)
|
284 |
|
|
taskType = self.cfg_params.get('USER.tasktype','analysis')
|
285 |
|
|
#### taskType = 'analysis'
|
286 |
ewv |
1.128 |
|
287 |
spiga |
1.112 |
self.executable = self.cfg_params.get('CMSSW.executable','cmsRun')
|
288 |
spiga |
1.146 |
VO = self.cfg_params.get('GRID.virtual_organization','cms')
|
289 |
spiga |
1.112 |
|
290 |
ewv |
1.129 |
params = {'tool': common.prog_name,
|
291 |
ewv |
1.157 |
'SubmissionType':'direct',
|
292 |
ewv |
1.129 |
'JSToolVersion': common.prog_version_str,
|
293 |
|
|
'tool_ui': os.environ.get('HOSTNAME',''),
|
294 |
|
|
'scheduler': common.scheduler.name(),
|
295 |
|
|
'GridName': gridName,
|
296 |
ewv |
1.140 |
'ApplicationVersion': self.scram.getSWVersion(),
|
297 |
ewv |
1.129 |
'taskType': taskType,
|
298 |
|
|
'vo': VO,
|
299 |
spiga |
1.142 |
'CMSUser': getUserName(),
|
300 |
|
|
'user': getUserName(),
|
301 |
spiga |
1.143 |
'taskId': str(taskId),
|
302 |
ewv |
1.129 |
'datasetFull': self.datasetPath,
|
303 |
farinafa |
1.171 |
'resubmitter': 'user', \
|
304 |
ewv |
1.128 |
'exe': self.executable }
|
305 |
spiga |
1.112 |
|
306 |
|
|
return params
|
307 |
ewv |
1.128 |
|
308 |
spiga |
1.112 |
def SendMLpre(self):
|
309 |
|
|
"""
|
310 |
ewv |
1.128 |
Send Pre info to ML
|
311 |
spiga |
1.112 |
"""
|
312 |
|
|
params = self.collect_MLInfo()
|
313 |
ewv |
1.128 |
|
314 |
spiga |
1.112 |
params['jobId'] ='TaskMeta'
|
315 |
ewv |
1.128 |
|
316 |
spiga |
1.112 |
common.apmon.sendToML(params)
|
317 |
ewv |
1.128 |
|
318 |
spiga |
1.151 |
common.logger.debug('Submission DashBoard Pre-Submission report: %s'%str(params))
|
319 |
ewv |
1.128 |
|
320 |
spiga |
1.112 |
return
|
321 |
ewv |
1.92 |
|
322 |
spiga |
1.112 |
def SendMLpost(self,allList):
|
323 |
|
|
"""
|
324 |
ewv |
1.128 |
Send post-submission info to ML
|
325 |
|
|
"""
|
326 |
|
|
task = common._db.getTask(allList)
|
327 |
spiga |
1.112 |
|
328 |
|
|
params = {}
|
329 |
|
|
for k,v in self.collect_MLInfo().iteritems():
|
330 |
|
|
params[k] = v
|
331 |
ewv |
1.128 |
|
332 |
ewv |
1.157 |
msg = ''
|
333 |
spiga |
1.112 |
Sub_Type = 'Direct'
|
334 |
|
|
for job in task.jobs:
|
335 |
ewv |
1.128 |
jj = job['jobId']
|
336 |
spiga |
1.112 |
jobId = ''
|
337 |
|
|
localId = ''
|
338 |
ewv |
1.128 |
jid = str(job.runningJob['schedulerId'])
|
339 |
ewv |
1.162 |
if common.scheduler.name().upper() in ['CONDOR_G']:
|
340 |
spiga |
1.112 |
rb = 'OSG'
|
341 |
ewv |
1.176 |
taskHash = sha1(common._db.queryTask('name')).hexdigest()
|
342 |
ewv |
1.130 |
jobId = str(jj) + '_https://' + common.scheduler.name() + '/' + taskHash + '/' + str(jj)
|
343 |
spiga |
1.151 |
msg += ('JobID for ML monitoring is created for CONDOR_G scheduler: %s \n'%str(jobId))
|
344 |
ewv |
1.162 |
elif common.scheduler.name().upper() in ['GLIDEIN']:
|
345 |
|
|
rb = common.scheduler.name()
|
346 |
|
|
jobId = str(jj) + '_https://' + str(jid)
|
347 |
|
|
msg += ('JobID for ML monitoring is created for GLIDEIN scheduler: %s \n'%str(jobId))
|
348 |
mcinquil |
1.164 |
elif common.scheduler.name().upper() in ['LSF', 'CAF', 'PBS']:
|
349 |
spiga |
1.172 |
jobId= str(jj) + "_https://"+common.scheduler.name().upper()+":/"+jid+"-"+string.replace(str(task['name']),"_","-")
|
350 |
mcinquil |
1.164 |
msg += ('JobID for ML monitoring is created for %s scheduler: %s\n'%(common.scheduler.name().upper(), str(jobId)) )
|
351 |
spiga |
1.112 |
rb = common.scheduler.name()
|
352 |
|
|
localId = jid
|
353 |
ewv |
1.139 |
elif common.scheduler.name().upper() in ['CONDOR']:
|
354 |
ewv |
1.176 |
taskHash = sha1(common._db.queryTask('name')).hexdigest()
|
355 |
ewv |
1.139 |
jobId = str(jj) + '_https://' + socket.gethostname() + '/' + taskHash + '/' + str(jj)
|
356 |
ewv |
1.162 |
rb = common.scheduler.name()
|
357 |
spiga |
1.151 |
msg += ('JobID for ML monitoring is created for CONDOR scheduler: %s\n'%str(jobId))
|
358 |
edelmann |
1.154 |
elif common.scheduler.name().upper() in ['ARC']:
|
359 |
edelmann |
1.167 |
jobId = str(jj) + '_' + str(jid)
|
360 |
edelmann |
1.154 |
msg += ('JobID for ML monitoring is created for ARC scheduler: %s\n'%str(jobId))
|
361 |
|
|
rb = 'ARC'
|
362 |
spiga |
1.112 |
else:
|
363 |
|
|
jobId = str(jj) + '_' + str(jid)
|
364 |
spiga |
1.151 |
msg += ('JobID for ML monitoring is created for gLite scheduler %s\n'%str(jobId))
|
365 |
spiga |
1.112 |
rb = str(job.runningJob['service'])
|
366 |
ewv |
1.128 |
|
367 |
|
|
dlsDest = job['dlsDestination']
|
368 |
spiga |
1.125 |
if len(dlsDest) == 1 :
|
369 |
|
|
T_SE=str(dlsDest[0])
|
370 |
|
|
elif len(dlsDest) == 2 :
|
371 |
|
|
T_SE=str(dlsDest[0])+','+str(dlsDest[1])
|
372 |
ewv |
1.128 |
else :
|
373 |
spiga |
1.112 |
T_SE=str(len(dlsDest))+'_Selected_SE'
|
374 |
|
|
|
375 |
|
|
|
376 |
|
|
infos = { 'jobId': jobId, \
|
377 |
|
|
'sid': jid, \
|
378 |
|
|
'broker': rb, \
|
379 |
|
|
'bossId': jj, \
|
380 |
|
|
'SubmissionType': Sub_Type, \
|
381 |
|
|
'TargetSE': T_SE, \
|
382 |
|
|
'localId' : localId}
|
383 |
|
|
|
384 |
|
|
for k,v in infos.iteritems():
|
385 |
|
|
params[k] = v
|
386 |
|
|
|
387 |
spiga |
1.151 |
msg +=('Submission DashBoard report: %s\n'%str(params))
|
388 |
spiga |
1.112 |
common.apmon.sendToML(params)
|
389 |
spiga |
1.151 |
common.logger.log(10-1,msg)
|
390 |
nsmirnov |
1.1 |
return
|
391 |
spiga |
1.112 |
|
392 |
|
|
|