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): |
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, dest): |
69 |
|
""" |
70 |
< |
Returns string with requirement SE related |
71 |
< |
""" |
70 |
> |
Returns string with requirement SE related |
71 |
> |
""" |
72 |
|
hostList=self.findSites_(id,dest) |
73 |
|
req='' |
74 |
|
reqtmp=[] |
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_fix_parameter(self): |
112 |
|
""" |
113 |
|
Returns string with requirements and scheduler-specific parameters |
114 |
|
""" |
115 |
< |
index = int(common._db.nJobs()) |
115 |
> |
index = int(common._db.nJobs()) |
116 |
|
job = common.job_list[index-1] |
117 |
|
jbt = job.type() |
118 |
|
req = '' |
123 |
|
req = req + self.EDG_requirements |
124 |
|
|
125 |
|
Task_Req={'jobType':req}## DS--BL |
126 |
< |
common._db.updateTask_(Task_Req) |
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 |
< |
dest= eval(task.jobs[i]['dlsDestination']) ## DS--BL |
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+='Requirements = ' + req +self.specific_req() + self.se_list(i,dest) +\ |
140 |
< |
self.ce_list() +';\n' ## BL--DS |
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' |
145 |
|
sched_param+='ShallowRetryCount = '+str(self.EDG_shallow_retry_count)+';\n' |
146 |
|
|
147 |
|
return sched_param |
148 |
< |
|
148 |
> |
|
149 |
|
def wsSetupEnvironment(self): |
150 |
|
""" |
151 |
|
Returns part of a job script which does scheduler-specific work. |
152 |
|
""" |
153 |
< |
txt = '' |
152 |
< |
txt += '# strip arguments\n' |
153 |
< |
txt += 'echo "strip arguments"\n' |
154 |
< |
txt += 'args=("$@")\n' |
155 |
< |
txt += 'nargs=$#\n' |
156 |
< |
txt += 'shift $nargs\n' |
157 |
< |
txt += "# job number (first parameter for job wrapper)\n" |
158 |
< |
txt += "NJob=${args[0]}; export NJob\n" |
159 |
< |
|
160 |
< |
txt += '# job identification to DashBoard \n' |
161 |
< |
#txt += 'MonitorJobID=`echo ${NJob}_$GLITE_WMS_JOBID`\n' |
162 |
< |
#txt += 'SyncGridJobId=`echo $GLITE_WMS_JOBID`\n' |
163 |
< |
#txt += 'MonitorID=`echo ' + self._taskId + '`\n' |
164 |
< |
txt += 'MonitorJobID=${NJob}_$GLITE_WMS_JOBID \n' |
165 |
< |
txt += 'SyncGridJobId=$GLITE_WMS_JOBID \n' |
166 |
< |
txt += 'MonitorID='+self._taskId+' \n' |
167 |
< |
txt += 'echo "MonitorJobID=$MonitorJobID" > $RUNTIME_AREA/$repo \n' |
168 |
< |
txt += 'echo "SyncGridJobId=$SyncGridJobId" >> $RUNTIME_AREA/$repo \n' |
169 |
< |
txt += 'echo "MonitorID=$MonitorID" >> $RUNTIME_AREA/$repo\n' |
170 |
< |
#txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n' |
171 |
< |
#txt += 'echo "SyncGridJobId=`echo $SyncGridJobId`" | tee -a $RUNTIME_AREA/$repo \n' |
172 |
< |
#txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n' |
173 |
< |
|
174 |
< |
#txt += 'echo "middleware discovery: " \n' |
175 |
< |
txt += 'echo ">>> GridFlavour discovery: " \n' |
176 |
< |
txt += 'if [ $VO_CMS_SW_DIR ]; then \n' |
177 |
< |
txt += ' middleware=LCG\n' |
178 |
< |
#txt += ' echo "SyncCE=`glite-brokerinfo getCE`" | tee -a $RUNTIME_AREA/$repo \n' |
179 |
< |
txt += ' echo "SyncCE=`glite-brokerinfo getCE`" >> $RUNTIME_AREA/$repo \n' |
180 |
< |
#txt += ' echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n' |
181 |
< |
txt += ' echo "GridFlavour=$middleware" | tee -a $RUNTIME_AREA/$repo \n' |
182 |
< |
#txt += ' echo ">>> middleware =$middleware" \n' |
183 |
< |
txt += 'elif [ $OSG_APP ]; then \n' |
184 |
< |
txt += ' middleware=OSG \n' |
185 |
< |
txt += ' if [ $OSG_JOB_CONTACT ]; then \n' |
186 |
< |
txt += ' SyncCE="$OSG_JOB_CONTACT"; \n' |
187 |
< |
#txt += ' echo "SyncCE=$SyncCE" | tee -a $RUNTIME_AREA/$repo ;\n' |
188 |
< |
txt += ' echo "SyncCE=$SyncCE" >> $RUNTIME_AREA/$repo ;\n' |
189 |
< |
txt += ' else\n' |
190 |
< |
txt += ' echo "not reporting SyncCE";\n' |
191 |
< |
txt += ' fi\n'; |
192 |
< |
txt += ' echo "GridFlavour=$middleware" | tee -a $RUNTIME_AREA/$repo \n' |
193 |
< |
#txt += ' echo ">>> middleware =$middleware" \n' |
194 |
< |
txt += 'else \n' |
195 |
< |
txt += ' echo "ERROR ==> GridFlavour not identified" \n' |
196 |
< |
txt += ' job_exit_code=10030\n' |
197 |
< |
txt += ' func_exit \n' |
198 |
< |
#txt += ' echo "SET_CMS_ENV 10030 ==> middleware not identified" \n' |
199 |
< |
#txt += ' echo "JOB_EXIT_STATUS = 10030" \n' |
200 |
< |
#txt += ' echo "JobExitCode=10030" | tee -a $RUNTIME_AREA/$repo \n' |
201 |
< |
#txt += ' dumpStatus $RUNTIME_AREA/$repo \n' |
202 |
< |
#txt += ' exit 1 \n' |
203 |
< |
txt += 'fi \n' |
204 |
< |
|
205 |
< |
txt += 'dumpStatus $RUNTIME_AREA/$repo \n' |
206 |
< |
|
207 |
< |
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' |
222 |
< |
#txt += ' echo "SET_CMS_ENV 10099 ==> OSG mode: ERROR in setting CE name from OSG_JOB_CONTACT" \n' |
223 |
< |
#txt += ' echo "JOB_EXIT_STATUS = 10099" \n' |
224 |
< |
#txt += ' echo "JobExitCode=10099" | tee -a $RUNTIME_AREA/$repo \n' |
225 |
< |
#txt += ' dumpStatus $RUNTIME_AREA/$repo \n' |
226 |
< |
#txt += ' exit 1 \n' |
167 |
> |
txt += ' func_exit\n' |
168 |
|
txt += ' fi \n' |
169 |
|
txt += 'fi \n' |
170 |
|
|
194 |
|
replicas = self.blackWhiteListParser.checkBlackList(sites,n) |
195 |
|
if len(replicas)!=0: |
196 |
|
replicas = self.blackWhiteListParser.checkWhiteList(replicas,n) |
197 |
< |
|
197 |
> |
|
198 |
|
itr4 = replicas |
199 |
|
##### |
200 |
|
return itr4 |