13 |
|
|
14 |
|
def configure(self,cfg_params): |
15 |
|
SchedulerGrid.configure(self, cfg_params) |
16 |
+ |
self.checkProxy() |
17 |
|
self.environment_unique_identifier = 'GLITE_WMS_JOBID' |
18 |
|
|
19 |
|
def rb_configure(self, RB): |
25 |
|
glite_config = gliteConfig.config() |
26 |
|
|
27 |
|
if (glite_config ): |
28 |
< |
rb_param_file = 'WMSconfig = '+glite_config+';\n' |
28 |
> |
rb_param_file = glite_config |
29 |
|
return rb_param_file |
30 |
|
|
31 |
|
def ce_list(self): |
32 |
|
""" |
33 |
< |
Returns string with requirement CE related |
33 |
> |
Returns string with requirement CE related |
34 |
|
""" |
35 |
< |
req = '' |
35 |
> |
req = '' |
36 |
|
if self.EDG_ce_white_list: |
37 |
|
ce_white_list = self.EDG_ce_white_list |
38 |
|
tmpCe=[] |
63 |
|
# requirement added to skip gliteCE |
64 |
|
req += '&& (!RegExp("blah", other.GlueCEUniqueId))' |
65 |
|
|
66 |
< |
return req |
66 |
> |
return req,self.EDG_ce_white_list,self.EDG_ce_black_list |
67 |
|
|
68 |
< |
def se_list(self, id): |
68 |
> |
def se_list(self, id, dest): |
69 |
|
""" |
70 |
< |
Returns string with requirement SE related |
71 |
< |
""" |
72 |
< |
hostList=self.findSites_(id) |
70 |
> |
Returns string with requirement SE related |
71 |
> |
""" |
72 |
> |
hostList=self.findSites_(id,dest) |
73 |
|
req='' |
74 |
|
reqtmp=[] |
75 |
|
concString = '||' |
83 |
|
|
84 |
|
def jdlParam(self): |
85 |
|
""" |
86 |
< |
Returns |
87 |
< |
""" |
86 |
> |
Returns |
87 |
> |
""" |
88 |
|
req='' |
89 |
|
if self.EDG_addJdlParam: |
90 |
< |
if self.EDG_addJdlParam[-1] == '': self.EDG_addJdlParam= self.EDG_addJdlParam[:-1] |
90 |
> |
if self.EDG_addJdlParam[-1] == '': self.EDG_addJdlParam= self.EDG_addJdlParam[:-1] |
91 |
|
for p in self.EDG_addJdlParam: |
92 |
|
# param_file.write(string.strip(p)+';\n') |
93 |
|
req+=string.strip(p)+';\n' ## BL--DS |
96 |
|
def specific_req(self): |
97 |
|
""" |
98 |
|
Returns string with specific requirements |
99 |
< |
""" |
99 |
> |
""" |
100 |
|
req='' |
101 |
|
if self.EDG_clock_time: |
102 |
|
if (not req == ' '): req = req + ' && ' |
105 |
|
if self.EDG_cpu_time: |
106 |
|
if (not req == ' '): req = req + ' && ' |
107 |
|
req = req + ' other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time |
108 |
< |
|
108 |
> |
|
109 |
|
return req |
110 |
|
|
111 |
< |
def sched_parameter(self): |
111 |
> |
def sched_fix_parameter(self): |
112 |
|
""" |
113 |
|
Returns string with requirements and scheduler-specific parameters |
114 |
|
""" |
115 |
< |
index = int(common._db.nJobs()) - 1 |
116 |
< |
job = common.job_list[index] |
115 |
> |
index = int(common._db.nJobs()) |
116 |
> |
job = common.job_list[index-1] |
117 |
|
jbt = job.type() |
117 |
– |
|
118 |
– |
### To Be Removed BL--DS |
119 |
– |
# lastDest='' |
120 |
– |
# first = [] |
121 |
– |
# last = [] |
122 |
– |
# for n in range(common.jobDB.nJobs()): |
123 |
– |
# currDest=common.jobDB.destination(n) |
124 |
– |
# if (currDest!=lastDest): |
125 |
– |
# lastDest = currDest |
126 |
– |
# first.append(n) |
127 |
– |
# if n != 0:last.append(n-1) |
128 |
– |
# if len(first)>len(last) :last.append(common.jobDB.nJobs()) |
129 |
– |
|
118 |
|
req = '' |
119 |
|
req = req + jbt.getRequirements() |
120 |
|
|
121 |
|
if self.EDG_requirements: |
122 |
|
if (not req == ' '): req = req + ' && ' |
123 |
|
req = req + self.EDG_requirements |
124 |
+ |
|
125 |
+ |
Task_Req={'jobType':req}## DS--BL |
126 |
+ |
common._db.updateTask_(Task_Req) |
127 |
+ |
|
128 |
+ |
def sched_parameter(self,i,task): |
129 |
+ |
""" |
130 |
+ |
Returns string with requirements and scheduler-specific parameters |
131 |
+ |
""" |
132 |
+ |
print i |
133 |
+ |
dest= eval(task.jobs[i-1]['dlsDestination']) ## DS--BL |
134 |
+ |
|
135 |
+ |
req='' |
136 |
+ |
req +=task['jobType'] |
137 |
+ |
|
138 |
|
sched_param='' |
139 |
< |
sched_param='""pippo""' |
139 |
> |
sched_param+='Requirements = ' + req +self.specific_req() + self.se_list(i,dest) +\ |
140 |
> |
self.ce_list()[0] +';\n' ## BL--DS |
141 |
> |
if self.EDG_addJdlParam: sched_param+=self.jdlParam() ## BL--DS |
142 |
> |
sched_param+='MyProxyServer = "' + self.proxyServer + '";\n' |
143 |
> |
sched_param+='VirtualOrganisation = "' + self.VO + '";\n' |
144 |
> |
sched_param+='RetryCount = '+str(self.EDG_retry_count)+';\n' |
145 |
> |
sched_param+='ShallowRetryCount = '+str(self.EDG_shallow_retry_count)+';\n' |
146 |
|
|
147 |
< |
### Temporary Problem with quote and py2sqlite.... under investigation.. |
140 |
< |
for i in range(index): |
141 |
< |
# sched_param+='Requirements = ' + req +self.specific_req() + self.se_list(i) +\ |
142 |
< |
# self.ce_list() +';\n' ## BL--DS |
143 |
< |
# if self.EDG_addJdlParam: sched_param+=self.jdlParam() ## BL--DS |
144 |
< |
# if (self.rb_param_file): sched_param+=self.rb_param_file ## BL--DS |
145 |
< |
# print sched_param |
146 |
< |
run_jobReq={'schedulerAttributes':sched_param}## DS--BL |
147 |
< |
common._db.updateRunJob_(i,run_jobReq) |
147 |
> |
return sched_param |
148 |
|
|
149 |
|
def wsSetupEnvironment(self): |
150 |
|
""" |
151 |
|
Returns part of a job script which does scheduler-specific work. |
152 |
|
""" |
153 |
< |
txt = '' |
154 |
< |
txt += '# strip arguments\n' |
155 |
< |
txt += 'echo "strip arguments"\n' |
156 |
< |
txt += 'args=("$@")\n' |
157 |
< |
txt += 'nargs=$#\n' |
158 |
< |
txt += 'shift $nargs\n' |
159 |
< |
txt += "# job number (first parameter for job wrapper)\n" |
160 |
< |
txt += "NJob=${args[0]}; export NJob\n" |
161 |
< |
|
162 |
< |
txt += '# job identification to DashBoard \n' |
163 |
< |
#txt += 'MonitorJobID=`echo ${NJob}_$GLITE_WMS_JOBID`\n' |
164 |
< |
#txt += 'SyncGridJobId=`echo $GLITE_WMS_JOBID`\n' |
165 |
< |
#txt += 'MonitorID=`echo ' + self._taskId + '`\n' |
166 |
< |
txt += 'MonitorJobID=${NJob}_$GLITE_WMS_JOBID \n' |
167 |
< |
txt += 'SyncGridJobId=$GLITE_WMS_JOBID \n' |
168 |
< |
txt += 'MonitorID='+self._taskId+' \n' |
169 |
< |
txt += 'echo "MonitorJobID=$MonitorJobID" > $RUNTIME_AREA/$repo \n' |
170 |
< |
txt += 'echo "SyncGridJobId=$SyncGridJobId" >> $RUNTIME_AREA/$repo \n' |
171 |
< |
txt += 'echo "MonitorID=$MonitorID" >> $RUNTIME_AREA/$repo\n' |
172 |
< |
#txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
173 |
< |
#txt += 'echo "SyncGridJobId=`echo $SyncGridJobId`" | tee -a $RUNTIME_AREA/$repo \n' |
174 |
< |
#txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
175 |
< |
|
176 |
< |
#txt += 'echo "middleware discovery: " \n' |
177 |
< |
txt += 'echo ">>> GridFlavour discovery: " \n' |
178 |
< |
txt += 'if [ $VO_CMS_SW_DIR ]; then \n' |
179 |
< |
txt += ' middleware=LCG\n' |
180 |
< |
#txt += ' echo "SyncCE=`glite-brokerinfo getCE`" | tee -a $RUNTIME_AREA/$repo \n' |
181 |
< |
txt += ' echo "SyncCE=`glite-brokerinfo getCE`" >> $RUNTIME_AREA/$repo \n' |
182 |
< |
#txt += ' echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n' |
183 |
< |
txt += ' echo "GridFlavour=$middleware" | tee -a $RUNTIME_AREA/$repo \n' |
184 |
< |
#txt += ' echo ">>> middleware =$middleware" \n' |
185 |
< |
txt += 'elif [ $OSG_APP ]; then \n' |
186 |
< |
txt += ' middleware=OSG \n' |
187 |
< |
txt += ' if [ $OSG_JOB_CONTACT ]; then \n' |
188 |
< |
txt += ' SyncCE="$OSG_JOB_CONTACT"; \n' |
189 |
< |
#txt += ' echo "SyncCE=$SyncCE" | tee -a $RUNTIME_AREA/$repo ;\n' |
190 |
< |
txt += ' echo "SyncCE=$SyncCE" >> $RUNTIME_AREA/$repo ;\n' |
191 |
< |
txt += ' else\n' |
192 |
< |
txt += ' echo "not reporting SyncCE";\n' |
193 |
< |
txt += ' fi\n'; |
194 |
< |
txt += ' echo "GridFlavour=$middleware" | tee -a $RUNTIME_AREA/$repo \n' |
195 |
< |
#txt += ' echo ">>> middleware =$middleware" \n' |
196 |
< |
txt += 'else \n' |
197 |
< |
txt += ' echo "ERROR ==> GridFlavour not identified" \n' |
198 |
< |
txt += ' job_exit_code=10030\n' |
199 |
< |
txt += ' func_exit \n' |
200 |
< |
#txt += ' echo "SET_CMS_ENV 10030 ==> middleware not identified" \n' |
201 |
< |
#txt += ' echo "JOB_EXIT_STATUS = 10030" \n' |
202 |
< |
#txt += ' echo "JobExitCode=10030" | tee -a $RUNTIME_AREA/$repo \n' |
203 |
< |
#txt += ' dumpStatus $RUNTIME_AREA/$repo \n' |
204 |
< |
#txt += ' exit 1 \n' |
205 |
< |
txt += 'fi \n' |
206 |
< |
|
207 |
< |
txt += 'dumpStatus $RUNTIME_AREA/$repo \n' |
208 |
< |
|
209 |
< |
txt += '\n\n' |
153 |
> |
txt = SchedulerGrid.wsSetupEnvironment(self) |
154 |
|
|
155 |
|
txt += 'export VO='+self.VO+'\n' |
156 |
|
txt += 'if [ $middleware == LCG ]; then\n' |
164 |
|
txt += ' else \n' |
165 |
|
txt += ' echo "ERROR ==> OSG mode in setting CE name from OSG_JOB_CONTACT" \n' |
166 |
|
txt += ' job_exit_code=10099\n' |
167 |
< |
txt += ' func_exit \n' |
224 |
< |
#txt += ' echo "SET_CMS_ENV 10099 ==> OSG mode: ERROR in setting CE name from OSG_JOB_CONTACT" \n' |
225 |
< |
#txt += ' echo "JOB_EXIT_STATUS = 10099" \n' |
226 |
< |
#txt += ' echo "JobExitCode=10099" | tee -a $RUNTIME_AREA/$repo \n' |
227 |
< |
#txt += ' dumpStatus $RUNTIME_AREA/$repo \n' |
228 |
< |
#txt += ' exit 1 \n' |
167 |
> |
txt += ' func_exit\n' |
168 |
|
txt += ' fi \n' |
169 |
|
txt += 'fi \n' |
170 |
|
|
185 |
|
cmd_out = runCommand(cmd) |
186 |
|
return cmd_out |
187 |
|
|
188 |
+ |
def findSites_(self, n, sites): |
189 |
+ |
itr4 =[] |
190 |
+ |
if len(sites)>0 and sites[0]=="": |
191 |
+ |
return itr4 |
192 |
+ |
if sites != [""]: |
193 |
+ |
##Addedd Daniele |
194 |
+ |
replicas = self.blackWhiteListParser.checkBlackList(sites,n) |
195 |
+ |
if len(replicas)!=0: |
196 |
+ |
replicas = self.blackWhiteListParser.checkWhiteList(replicas,n) |
197 |
+ |
|
198 |
+ |
itr4 = replicas |
199 |
+ |
##### |
200 |
+ |
return itr4 |
201 |
+ |
|
202 |
+ |
|
203 |
+ |
|
204 |
|
|
205 |
|
def tOut(self, list): |
206 |
|
return 180 |