23 |
|
def configure(self, cfg_params): |
24 |
|
|
25 |
|
try: |
26 |
< |
RB = cfg_params["EDG.rb"] |
27 |
< |
edgConfig = EdgConfig(RB) |
28 |
< |
self.edg_config = edgConfig.config() |
29 |
< |
self.edg_config_vo = edgConfig.configVO() |
26 |
> |
RB=cfg_params["EDG.rb"] |
27 |
> |
self.rb_param_file=self.rb_configure(RB) |
28 |
|
except KeyError: |
29 |
< |
self.edg_config = '' |
30 |
< |
self.edg_config_vo = '' |
33 |
< |
|
29 |
> |
self.rb_param_file='' |
30 |
> |
pass |
31 |
|
try: |
32 |
|
self.proxyServer = cfg_params["EDG.proxy_server"] |
33 |
|
except KeyError: |
35 |
|
common.logger.debug(5,'Setting myproxy server to '+self.proxyServer) |
36 |
|
|
37 |
|
try: |
38 |
+ |
self.group = cfg_params["EDG.group"] |
39 |
+ |
except KeyError: |
40 |
+ |
self.group = None |
41 |
+ |
|
42 |
+ |
try: |
43 |
|
self.role = cfg_params["EDG.role"] |
44 |
|
except KeyError: |
45 |
|
self.role = None |
47 |
|
try: self.LCG_version = cfg_params["EDG.lcg_version"] |
48 |
|
except KeyError: self.LCG_version = '2' |
49 |
|
|
48 |
– |
try: self.EDG_requirements = cfg_params['EDG.requirements'] |
49 |
– |
except KeyError: self.EDG_requirements = '' |
50 |
– |
|
51 |
– |
try: self.EDG_retry_count = cfg_params['EDG.retry_count'] |
52 |
– |
except KeyError: self.EDG_retry_count = '' |
53 |
– |
|
50 |
|
try: |
51 |
|
self.EDG_ce_black_list = cfg_params['EDG.ce_black_list'] |
56 |
– |
#print "self.EDG_ce_black_list = ", self.EDG_ce_black_list |
52 |
|
except KeyError: |
53 |
|
self.EDG_ce_black_list = '' |
54 |
|
|
55 |
|
try: |
56 |
|
self.EDG_ce_white_list = cfg_params['EDG.ce_white_list'] |
62 |
– |
#print "self.EDG_ce_white_list = ", self.EDG_ce_white_list |
57 |
|
except KeyError: self.EDG_ce_white_list = '' |
58 |
|
|
59 |
|
try: self.VO = cfg_params['EDG.virtual_organization'] |
60 |
|
except KeyError: self.VO = 'cms' |
61 |
|
|
62 |
|
try: self.return_data = cfg_params['USER.return_data'] |
63 |
< |
except KeyError: self.return_data = 1 |
70 |
< |
|
71 |
< |
# was set t o zero in cms_cmssw.py to deactivate only for cmssw |
72 |
< |
# after CRAB_1_3_0, support for ORCA was dropped, so setting it here to zero and avoiding usage of non-existant analisys_common_info |
73 |
< |
self.copy_input_data = 0 |
63 |
> |
except KeyError: self.return_data = 0 |
64 |
|
|
65 |
|
try: |
66 |
|
self.copy_data = cfg_params["USER.copy_data"] |
122 |
|
|
123 |
|
try: self.EDG_requirements = cfg_params['EDG.requirements'] |
124 |
|
except KeyError: self.EDG_requirements = '' |
125 |
< |
|
125 |
> |
|
126 |
> |
try: self.EDG_addJdlParam = string.split(cfg_params['EDG.additional_jdl_parameters'],',') |
127 |
> |
except KeyError: self.EDG_addJdlParam = [] |
128 |
> |
|
129 |
|
try: self.EDG_retry_count = cfg_params['EDG.retry_count'] |
130 |
|
except KeyError: self.EDG_retry_count = '' |
131 |
< |
|
131 |
> |
|
132 |
> |
try: self.EDG_shallow_retry_count= cfg_params['EDG.shallow_retry_count'] |
133 |
> |
except KeyError: self.EDG_shallow_retry_count = '' |
134 |
> |
|
135 |
|
try: self.EDG_clock_time = cfg_params['EDG.max_wall_clock_time'] |
136 |
|
except KeyError: self.EDG_clock_time= '' |
137 |
< |
|
137 |
> |
|
138 |
|
try: self.EDG_cpu_time = cfg_params['EDG.max_cpu_time'] |
139 |
|
except KeyError: self.EDG_cpu_time = '' |
140 |
|
|
167 |
|
return |
168 |
|
|
169 |
|
|
170 |
+ |
def rb_configure(self, RB): |
171 |
+ |
self.edg_config = '' |
172 |
+ |
self.edg_config_vo = '' |
173 |
+ |
self.rb_param_file = '' |
174 |
+ |
|
175 |
+ |
edgConfig = EdgConfig(RB) |
176 |
+ |
self.edg_config = edgConfig.config() |
177 |
+ |
self.edg_config_vo = edgConfig.configVO() |
178 |
+ |
|
179 |
+ |
if (self.edg_config and self.edg_config_vo != ''): |
180 |
+ |
self.rb_param_file = 'RBconfig = "'+self.edg_config+'";\nRBconfigVO = "'+self.edg_config_vo+'";' |
181 |
+ |
#print "rb_param_file = ", self.rb_param_file |
182 |
+ |
return self.rb_param_file |
183 |
+ |
|
184 |
+ |
|
185 |
|
def sched_parameter(self): |
186 |
|
""" |
187 |
< |
Returns file with scheduler-specific parameters |
187 |
> |
Returns file with requirements and scheduler-specific parameters |
188 |
|
""" |
189 |
< |
|
190 |
< |
if (self.edg_config and self.edg_config_vo != ''): |
191 |
< |
self.param='sched_param.clad' |
189 |
> |
index = int(common.jobDB.nJobs()) - 1 |
190 |
> |
job = common.job_list[index] |
191 |
> |
jbt = job.type() |
192 |
> |
|
193 |
> |
lastBlock=-1 |
194 |
> |
first = [] |
195 |
> |
for n in range(common.jobDB.nJobs()): |
196 |
> |
currBlock=common.jobDB.block(n) |
197 |
> |
if (currBlock!=lastBlock): |
198 |
> |
lastBlock = currBlock |
199 |
> |
first.append(n) |
200 |
> |
|
201 |
> |
req = '' |
202 |
> |
req = req + jbt.getRequirements() |
203 |
> |
|
204 |
> |
if self.EDG_requirements: |
205 |
> |
if (req == ' '): |
206 |
> |
req = req + self.EDG_requirements |
207 |
> |
else: |
208 |
> |
req = req + ' && ' + self.EDG_requirements |
209 |
> |
|
210 |
> |
if self.EDG_ce_white_list: |
211 |
> |
ce_white_list = string.split(self.EDG_ce_white_list,',') |
212 |
> |
for i in range(len(ce_white_list)): |
213 |
> |
if i == 0: |
214 |
> |
if (req == ' '): |
215 |
> |
req = req + '((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))' |
216 |
> |
else: |
217 |
> |
req = req + ' && ((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))' |
218 |
> |
pass |
219 |
> |
else: |
220 |
> |
req = req + ' || (RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))' |
221 |
> |
req = req + ')' |
222 |
> |
|
223 |
> |
if self.EDG_ce_black_list: |
224 |
> |
ce_black_list = string.split(self.EDG_ce_black_list,',') |
225 |
> |
for ce in ce_black_list: |
226 |
> |
if (req == ' '): |
227 |
> |
req = req + '(!RegExp("' + ce + '", other.GlueCEUniqueId))' |
228 |
> |
else: |
229 |
> |
req = req + ' && (!RegExp("' + ce + '", other.GlueCEUniqueId))' |
230 |
> |
pass |
231 |
> |
if self.EDG_clock_time: |
232 |
> |
if (req == ' '): |
233 |
> |
req = req + 'other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time |
234 |
> |
else: |
235 |
> |
req = req + ' && other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time |
236 |
> |
|
237 |
> |
if self.EDG_cpu_time: |
238 |
> |
if (req == ' '): |
239 |
> |
req = req + ' other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time |
240 |
> |
else: |
241 |
> |
req = req + ' && other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time |
242 |
> |
|
243 |
> |
for i in range(len(first)): # Add loop DS |
244 |
> |
self.param='sched_param_'+str(i)+'.clad' |
245 |
|
param_file = open(common.work_space.shareDir()+'/'+self.param, 'w') |
246 |
< |
param_file.write('RBconfig = "'+self.edg_config+'";\n') |
247 |
< |
param_file.write('RBconfigVO = "'+self.edg_config_vo+'";') |
246 |
> |
|
247 |
> |
itr4=self.findSites_(first[i]) |
248 |
> |
for arg in itr4: |
249 |
> |
req = req + ' && anyMatch(other.storage.CloseSEs, ('+str(arg)+'))' |
250 |
> |
param_file.write('Requirements = '+req +';\n') |
251 |
> |
|
252 |
> |
if (self.rb_param_file != ''): |
253 |
> |
param_file.write(self.rb_param_file) |
254 |
> |
|
255 |
> |
if len(self.EDG_addJdlParam): |
256 |
> |
for p in self.EDG_addJdlParam: |
257 |
> |
param_file.write(p) |
258 |
> |
|
259 |
|
param_file.close() |
260 |
< |
return 1 |
186 |
< |
else: |
187 |
< |
return 0 |
260 |
> |
|
261 |
|
|
262 |
|
def wsSetupEnvironment(self): |
263 |
|
""" |
326 |
|
txt += 'echo "SE_PATH = $SE_PATH"\n' |
327 |
|
|
328 |
|
txt += 'export VO='+self.VO+'\n' |
329 |
< |
### FEDE: add some line for LFC catalog setting |
329 |
> |
### add some line for LFC catalog setting |
330 |
|
txt += 'if [ $middleware == LCG ]; then \n' |
331 |
|
txt += ' if [[ $LCG_CATALOG_TYPE != \''+self.lcg_catalog_type+'\' ]]; then\n' |
332 |
|
txt += ' export LCG_CATALOG_TYPE='+self.lcg_catalog_type+'\n' |
393 |
|
Copy input data from SE to WN |
394 |
|
""" |
395 |
|
txt = '' |
396 |
< |
try: |
324 |
< |
self.copy_input_data = common.analisys_common_info['copy_input_data'] |
325 |
< |
except KeyError: self.copy_input_data = 0 |
326 |
< |
if int(self.copy_input_data) == 1: |
396 |
> |
|
397 |
|
## OLI_Daniele deactivate for OSG (wait for LCG UI installed on OSG) |
398 |
< |
txt += 'if [ $middleware == OSG ]; then\n' |
399 |
< |
txt += ' #\n' |
400 |
< |
txt += ' # Copy Input Data from SE to this WN deactivated in OSG mode\n' |
401 |
< |
txt += ' #\n' |
402 |
< |
txt += ' echo "Copy Input Data from SE to this WN deactivated in OSG mode"\n' |
403 |
< |
txt += 'elif [ $middleware == LCG ]; then \n' |
404 |
< |
txt += ' #\n' |
405 |
< |
txt += ' # Copy Input Data from SE to this WN\n' |
406 |
< |
txt += ' #\n' |
407 |
< |
### changed by georgia (put a loop copying more than one input files per jobs) |
408 |
< |
txt += ' for input_file in $cur_file_list \n' |
409 |
< |
txt += ' do \n' |
410 |
< |
txt += ' lcg-cp --vo $VO --verbose -t 1200 lfn:$input_lfn/$input_file file:`pwd`/$input_file 2>&1\n' |
411 |
< |
txt += ' copy_input_exit_status=$?\n' |
412 |
< |
txt += ' echo "COPY_INPUT_EXIT_STATUS = $copy_input_exit_status"\n' |
413 |
< |
txt += ' if [ $copy_input_exit_status -ne 0 ]; then \n' |
414 |
< |
txt += ' echo "Problems with copying to WN" \n' |
415 |
< |
txt += ' else \n' |
416 |
< |
txt += ' echo "input copied into WN" \n' |
417 |
< |
txt += ' fi \n' |
418 |
< |
txt += ' done \n' |
419 |
< |
### copy a set of PU ntuples (same for each jobs -- but accessed randomly) |
420 |
< |
txt += ' for file in $cur_pu_list \n' |
421 |
< |
txt += ' do \n' |
422 |
< |
txt += ' lcg-cp --vo $VO --verbose -t 1200 lfn:$pu_lfn/$file file:`pwd`/$file 2>&1\n' |
423 |
< |
txt += ' copy_input_pu_exit_status=$?\n' |
424 |
< |
txt += ' echo "COPY_INPUT_PU_EXIT_STATUS = $copy_input_pu_exit_status"\n' |
425 |
< |
txt += ' if [ $copy_input_pu_exit_status -ne 0 ]; then \n' |
426 |
< |
txt += ' echo "Problems with copying pu to WN" \n' |
427 |
< |
txt += ' else \n' |
428 |
< |
txt += ' echo "input pu files copied into WN" \n' |
429 |
< |
txt += ' fi \n' |
430 |
< |
txt += ' done \n' |
431 |
< |
txt += ' \n' |
432 |
< |
txt += ' ### Check SCRATCH space available on WN : \n' |
433 |
< |
txt += ' df -h \n' |
434 |
< |
txt += 'fi \n' |
398 |
> |
txt += 'if [ $middleware == OSG ]; then\n' |
399 |
> |
txt += ' #\n' |
400 |
> |
txt += ' # Copy Input Data from SE to this WN deactivated in OSG mode\n' |
401 |
> |
txt += ' #\n' |
402 |
> |
txt += ' echo "Copy Input Data from SE to this WN deactivated in OSG mode"\n' |
403 |
> |
txt += 'elif [ $middleware == LCG ]; then \n' |
404 |
> |
txt += ' #\n' |
405 |
> |
txt += ' # Copy Input Data from SE to this WN\n' |
406 |
> |
txt += ' #\n' |
407 |
> |
### changed by georgia (put a loop copying more than one input files per jobs) |
408 |
> |
txt += ' for input_file in $cur_file_list \n' |
409 |
> |
txt += ' do \n' |
410 |
> |
txt += ' lcg-cp --vo $VO --verbose -t 1200 lfn:$input_lfn/$input_file file:`pwd`/$input_file 2>&1\n' |
411 |
> |
txt += ' copy_input_exit_status=$?\n' |
412 |
> |
txt += ' echo "COPY_INPUT_EXIT_STATUS = $copy_input_exit_status"\n' |
413 |
> |
txt += ' if [ $copy_input_exit_status -ne 0 ]; then \n' |
414 |
> |
txt += ' echo "Problems with copying to WN" \n' |
415 |
> |
txt += ' else \n' |
416 |
> |
txt += ' echo "input copied into WN" \n' |
417 |
> |
txt += ' fi \n' |
418 |
> |
txt += ' done \n' |
419 |
> |
### copy a set of PU ntuples (same for each jobs -- but accessed randomly) |
420 |
> |
txt += ' for file in $cur_pu_list \n' |
421 |
> |
txt += ' do \n' |
422 |
> |
txt += ' lcg-cp --vo $VO --verbose -t 1200 lfn:$pu_lfn/$file file:`pwd`/$file 2>&1\n' |
423 |
> |
txt += ' copy_input_pu_exit_status=$?\n' |
424 |
> |
txt += ' echo "COPY_INPUT_PU_EXIT_STATUS = $copy_input_pu_exit_status"\n' |
425 |
> |
txt += ' if [ $copy_input_pu_exit_status -ne 0 ]; then \n' |
426 |
> |
txt += ' echo "Problems with copying pu to WN" \n' |
427 |
> |
txt += ' else \n' |
428 |
> |
txt += ' echo "input pu files copied into WN" \n' |
429 |
> |
txt += ' fi \n' |
430 |
> |
txt += ' done \n' |
431 |
> |
txt += ' \n' |
432 |
> |
txt += ' ### Check SCRATCH space available on WN : \n' |
433 |
> |
txt += ' df -h \n' |
434 |
> |
txt += 'fi \n' |
435 |
|
|
436 |
|
return txt |
437 |
|
|
452 |
|
txt += ' export X509_CERT_DIR=$OSG_APP/glite/etc/grid-security/certificates\n' |
453 |
|
txt += ' echo "export X509_CERT_DIR=$X509_CERT_DIR"\n' |
454 |
|
txt += ' fi \n' |
455 |
+ |
|
456 |
|
txt += ' for out_file in $file_list ; do\n' |
457 |
< |
txt += ' echo "Trying to copy output file to $SE using lcg-cp"\n' |
458 |
< |
if common.logger.debugLevel() >= 5: |
459 |
< |
txt += ' echo "lcg-cp --vo $VO -t 2400 --verbose file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
460 |
< |
txt += ' exitstring=`lcg-cp --vo $VO -t 2400 --verbose file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
461 |
< |
else: |
462 |
< |
txt += ' echo "lcg-cp --vo $VO -t 2400 file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
463 |
< |
txt += ' exitstring=`lcg-cp --vo $VO -t 2400 file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
457 |
> |
txt += ' echo "Trying to copy output file to $SE using srmcp"\n' |
458 |
> |
txt += ' echo "mkdir -p $HOME/.srmconfig"\n' |
459 |
> |
txt += ' mkdir -p $HOME/.srmconfig\n' |
460 |
> |
txt += ' if [ $middleware == LCG ]; then\n' |
461 |
> |
txt += ' echo "srmcp -retry_num 3 -retry_timeout 480000 file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
462 |
> |
txt += ' exitstring=`srmcp -retry_num 3 -retry_timeout 480000 file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
463 |
> |
txt += ' elif [ $middleware == OSG ]; then\n' |
464 |
> |
txt += ' echo "srmcp -retry_num 3 -retry_timeout 240000 -x509_user_trusted_certificates $X509_CERT_DIR file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
465 |
> |
txt += ' exitstring=`srmcp -retry_num 3 -retry_timeout 240000 -x509_user_trusted_certificates $X509_CERT_DIR file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
466 |
> |
txt += ' fi \n' |
467 |
|
txt += ' copy_exit_status=$?\n' |
468 |
< |
txt += ' echo "COPY_EXIT_STATUS for lcg-cp = $copy_exit_status"\n' |
468 |
> |
txt += ' echo "COPY_EXIT_STATUS for srmcp = $copy_exit_status"\n' |
469 |
|
txt += ' echo "STAGE_OUT = $copy_exit_status"\n' |
470 |
+ |
|
471 |
|
txt += ' if [ $copy_exit_status -ne 0 ]; then\n' |
472 |
|
txt += ' echo "Possible problem with SE = $SE"\n' |
473 |
|
txt += ' echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n' |
474 |
|
txt += ' echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n' |
475 |
< |
txt += ' echo "lcg-cp failed. For verbose lcg-cp output, use command line option -debug 5."\n' |
476 |
< |
txt += ' echo "lcg-cp failed, attempting srmcp"\n' |
477 |
< |
txt += ' echo "mkdir -p $HOME/.srmconfig"\n' |
478 |
< |
txt += ' mkdir -p $HOME/.srmconfig\n' |
479 |
< |
txt += ' if [ $middleware == LCG ]; then\n' |
480 |
< |
txt += ' echo "srmcp -retry_num 5 -retry_timeout 480000 file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
481 |
< |
txt += ' exitstring=`srmcp -retry_num 5 -retry_timeout 480000 file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
407 |
< |
txt += ' elif [ $middleware == OSG ]; then\n' |
408 |
< |
txt += ' echo "srmcp -retry_num 5 -retry_timeout 240000 -x509_user_trusted_certificates $X509_CERT_DIR file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
409 |
< |
txt += ' exitstring=`srmcp -retry_num 5 -retry_timeout 240000 -x509_user_trusted_certificates $X509_CERT_DIR file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
410 |
< |
txt += ' fi \n' |
475 |
> |
txt += ' echo "srmcp failed, attempting lcg-cp."\n' |
476 |
> |
if common.logger.debugLevel() >= 5: |
477 |
> |
txt += ' echo "lcg-cp --vo $VO -t 2400 --verbose file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
478 |
> |
txt += ' exitstring=`lcg-cp --vo $VO -t 2400 --verbose file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
479 |
> |
else: |
480 |
> |
txt += ' echo "lcg-cp --vo $VO -t 2400 file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
481 |
> |
txt += ' exitstring=`lcg-cp --vo $VO -t 2400 file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
482 |
|
txt += ' copy_exit_status=$?\n' |
483 |
< |
txt += ' echo "COPY_EXIT_STATUS for srm = $copy_exit_status"\n' |
483 |
> |
txt += ' echo "COPY_EXIT_STATUS for lcg-cp = $copy_exit_status"\n' |
484 |
|
txt += ' echo "STAGE_OUT = $copy_exit_status"\n' |
485 |
+ |
|
486 |
|
txt += ' if [ $copy_exit_status -ne 0 ]; then\n' |
487 |
|
txt += ' echo "Problems with SE = $SE"\n' |
488 |
|
txt += ' echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n' |
489 |
|
txt += ' echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n' |
490 |
< |
txt += ' echo "lcg-cp and srm failed"\n' |
419 |
< |
txt += ' echo "If storage_path in your config file contains a ? you may need a \? instead."\n' |
490 |
> |
txt += ' echo "srmcp and lcg-cp and failed!"\n' |
491 |
|
txt += ' else\n' |
492 |
|
txt += ' echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n' |
493 |
|
txt += ' echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n' |
494 |
|
txt += ' echo "output copied into $SE/$SE_PATH directory"\n' |
495 |
|
txt += ' echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n' |
496 |
< |
txt += ' echo "srmcp succeeded"\n' |
496 |
> |
txt += ' echo "lcg-cp succeeded"\n' |
497 |
|
txt += ' fi\n' |
498 |
|
txt += ' else\n' |
499 |
|
txt += ' echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n' |
500 |
|
txt += ' echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n' |
501 |
|
txt += ' echo "output copied into $SE/$SE_PATH directory"\n' |
502 |
|
txt += ' echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n' |
503 |
< |
txt += ' echo "lcg-cp succeeded"\n' |
503 |
> |
txt += ' echo "srmcp succeeded"\n' |
504 |
|
txt += ' fi\n' |
505 |
|
txt += ' done\n' |
506 |
|
return txt |
601 |
|
# Instance of the Status class provided by LB API |
602 |
|
jobStat = Status() |
603 |
|
st = 0 |
604 |
+ |
#print id, level, attr, self.states.index(attr) |
605 |
|
jobStat.getStatus(id, level) |
606 |
+ |
#print jobStat.loadStatus(st) |
607 |
|
err, apiMsg = jobStat.get_error() |
608 |
|
if err: |
609 |
|
common.logger.debug(5,'Error caught' + apiMsg) |
612 |
|
for i in range(len(self.states)): |
613 |
|
# Fill an hash table with all information retrieved from LB API |
614 |
|
hstates[ self.states[i] ] = jobStat.loadStatus(st)[i] |
615 |
+ |
#print i, jobStat.loadStatus(st)[i] |
616 |
|
result = jobStat.loadStatus(st)[self.states.index(attr)] |
617 |
+ |
#print str(result) |
618 |
|
return result |
619 |
|
|
620 |
|
def queryDetailedStatus(self, id): |
624 |
|
return cmd_out |
625 |
|
|
626 |
|
##### FEDE ###### |
627 |
< |
def findSites_(self, n_tot_job): |
628 |
< |
itr4 = [] |
629 |
< |
# print "n_tot_job = ", n_tot_job |
630 |
< |
for n in range(n_tot_job): |
631 |
< |
sites = common.jobDB.destination(n) |
632 |
< |
if len(sites)>0 and sites[0]=="Any": continue |
633 |
< |
|
634 |
< |
#job = common.job_list[n] |
635 |
< |
#jbt = job.type() |
636 |
< |
# print "common.jobDB.destination(n) = ", common.jobDB.destination(n) |
637 |
< |
# print "sites = ", sites |
638 |
< |
itr = '' |
564 |
< |
if sites != [""]:#CarlosDaniele |
565 |
< |
for site in sites: |
566 |
< |
#itr = itr + 'target.GlueSEUniqueID=="'+site+'" || ' |
567 |
< |
itr = itr + 'target.GlueSEUniqueID=="'+site+'" || ' |
568 |
< |
pass |
569 |
< |
# remove last || |
570 |
< |
itr = itr[0:-4] |
571 |
< |
itr4.append( itr ) |
572 |
< |
# remove last , |
573 |
< |
# print "itr4 = ", itr4 |
627 |
> |
def findSites_(self, n): |
628 |
> |
itr4 =[] |
629 |
> |
sites = common.jobDB.destination(n) |
630 |
> |
if len(sites)>0 and sites[0]=="Any": |
631 |
> |
return itr4 |
632 |
> |
itr = '' |
633 |
> |
if sites != [""]:#CarlosDaniele |
634 |
> |
for site in sites: |
635 |
> |
#itr = itr + 'target.GlueSEUniqueID=="'+site+'" || ' |
636 |
> |
itr = itr + 'target.GlueSEUniqueID=="'+site+'" || ' |
637 |
> |
itr = itr[0:-4] |
638 |
> |
itr4.append( itr ) |
639 |
|
return itr4 |
640 |
|
|
641 |
|
def createXMLSchScript(self, nj, argsList): |
642 |
|
# def createXMLSchScript(self, nj): |
643 |
+ |
|
644 |
|
""" |
645 |
|
Create a XML-file for BOSS4. |
646 |
|
""" |
647 |
|
# job = common.job_list[nj] |
648 |
|
""" |
649 |
|
INDY |
650 |
< |
[begin] da rivedere: |
651 |
< |
in particolare passerei il jobType ed eliminerei le dipendenze da job |
650 |
> |
[begin] FIX-ME: |
651 |
> |
I would pass jobType instead of job |
652 |
|
""" |
653 |
|
index = nj - 1 |
654 |
|
job = common.job_list[index] |
657 |
|
inp_sandbox = jbt.inputSandbox(index) |
658 |
|
out_sandbox = jbt.outputSandbox(index) |
659 |
|
""" |
660 |
< |
[end] da rivedere |
660 |
> |
[end] FIX-ME |
661 |
|
""" |
662 |
|
|
663 |
|
|
677 |
|
req=' ' |
678 |
|
req = req + jbt.getRequirements() |
679 |
|
|
614 |
– |
|
615 |
– |
#sites = common.jobDB.destination(nj) |
616 |
– |
#if len(sites)>0 and sites[0]!="Any": |
617 |
– |
# req = req + ' && anyMatch(other.storage.CloseSEs, (_ITR4_))' |
618 |
– |
#req = req |
619 |
– |
|
680 |
|
if self.EDG_requirements: |
681 |
|
if (req == ' '): |
682 |
|
req = req + self.EDG_requirements |
719 |
|
to_write = to_write + 'RetryCount = "'+self.EDG_retry_count+'"\n' |
720 |
|
pass |
721 |
|
|
722 |
+ |
if ( self.EDG_shallow_retry_count ): |
723 |
+ |
to_write = to_write + 'ShallowRetryCount = "'+self.EDG_shallow_retry_count+'"\n' |
724 |
+ |
pass |
725 |
+ |
|
726 |
|
to_write = to_write + 'MyProxyServer = ""' + self.proxyServer + '""\n' |
727 |
|
to_write = to_write + 'VirtualOrganisation = ""' + self.VO + '""\n' |
728 |
|
|
729 |
< |
|
666 |
< |
#TaskName |
729 |
> |
#TaskName |
730 |
|
dir = string.split(common.work_space.topDir(), '/') |
731 |
|
taskName = dir[len(dir)-2] |
732 |
|
|
733 |
|
xml.write(str(title)) |
734 |
|
xml.write('<task name="' +str(taskName)+'">\n') |
735 |
|
xml.write(jt_string) |
736 |
+ |
|
737 |
+ |
if (to_write != ''): |
738 |
+ |
xml.write('<extraTags\n') |
739 |
+ |
xml.write(to_write) |
740 |
+ |
xml.write('/>\n') |
741 |
+ |
pass |
742 |
|
|
743 |
|
xml.write('<iterator>\n') |
744 |
|
xml.write('\t<iteratorRule name="ITR1">\n') |
755 |
|
xml.write('\t</iteratorRule>\n') |
756 |
|
|
757 |
|
''' |
758 |
< |
indy: qui sotto ci sta itr4 |
758 |
> |
indy: here itr4 |
759 |
|
''' |
760 |
|
|
692 |
– |
itr4=self.findSites_(nj) |
693 |
– |
#print "--->>> itr4 = ", itr4 |
694 |
– |
if (itr4 != []): |
695 |
– |
xml.write('\t<iteratorRule name="ITR4">\n') |
696 |
– |
#print argsList |
697 |
– |
for arg in itr4: |
698 |
– |
xml.write('\t\t<ruleElement> <![CDATA[\n'+ arg + '\n\t\t]]> </ruleElement>\n') |
699 |
– |
pass |
700 |
– |
xml.write('\t</iteratorRule>\n') |
701 |
– |
req = req + ' && anyMatch(other.storage.CloseSEs, (_ITR4_))' |
702 |
– |
pass |
703 |
– |
# print "--->>> req= ", req |
704 |
– |
|
705 |
– |
if (to_write != ''): |
706 |
– |
xml.write('<extraTags\n') |
707 |
– |
xml.write(to_write) |
708 |
– |
xml.write('/>\n') |
709 |
– |
pass |
761 |
|
|
762 |
|
xml.write('<chain scheduler="'+str(self.schedulerName)+'">\n') |
763 |
|
xml.write(jt_string) |
764 |
|
|
714 |
– |
if (req != ' '): |
715 |
– |
req = req + '\n' |
716 |
– |
xml.write('<extraTags>\n') |
717 |
– |
xml.write('<Requirements>\n') |
718 |
– |
xml.write('<![CDATA[\n') |
719 |
– |
xml.write(req) |
720 |
– |
xml.write(']]>\n') |
721 |
– |
xml.write('</Requirements>\n') |
722 |
– |
xml.write('</extraTags>\n') |
723 |
– |
pass |
724 |
– |
|
765 |
|
#executable |
766 |
|
|
767 |
|
""" |
768 |
|
INDY |
769 |
< |
script dipende dal jobType: dovrebbe essere semplice tirarlo fuori in altro modo |
769 |
> |
script depends on jobType: it should be probably get in a different way |
770 |
|
""" |
771 |
|
script = job.scriptFilename() |
772 |
|
xml.write('<program>\n') |
773 |
|
xml.write('<exec> ' + os.path.basename(script) +' </exec>\n') |
774 |
|
xml.write(jt_string) |
775 |
|
|
736 |
– |
|
737 |
– |
### only one .sh JDL has arguments: |
738 |
– |
### Fabio |
739 |
– |
# xml.write('args = "' + str(nj+1)+' '+ jbt.getJobTypeArguments(nj, "EDG") +'"\n') |
776 |
|
xml.write('<args> <![CDATA[\n _ITR2_ \n]]> </args>\n') |
777 |
|
xml.write('<program_types> crabjob </program_types>\n') |
778 |
|
inp_box = script + ',' |
787 |
|
os.path.abspath(os.environ['CRABDIR']+'/python/'+'DashboardAPI.py') + ','+\ |
788 |
|
os.path.abspath(os.environ['CRABDIR']+'/python/'+'Logger.py') + ','+\ |
789 |
|
os.path.abspath(os.environ['CRABDIR']+'/python/'+'ProcInfo.py') + ','+\ |
790 |
< |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'apmon.py') |
790 |
> |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'apmon.py') + ','+\ |
791 |
> |
os.path.abspath(os.environ['CRABDIR']+'/python/'+'parseCrabFjr.py') |
792 |
|
|
793 |
|
if (not jbt.additional_inbox_files == []): |
794 |
|
inp_box = inp_box + ',' |
824 |
|
|
825 |
|
""" |
826 |
|
INDY |
827 |
< |
qualcosa del genere andrebbe fatta per gli infiles |
828 |
< |
""" |
827 |
> |
something similar should be also done for infiles (if it makes sense!) |
828 |
> |
""" |
829 |
|
if int(self.return_data) == 1: |
830 |
|
for fl in jbt.output_file: |
831 |
|
out_box = out_box + '' + jbt.numberFile_(fl, '_ITR1_') + ',' |
845 |
|
xml.write('</task>\n') |
846 |
|
|
847 |
|
xml.close() |
848 |
+ |
|
849 |
+ |
|
850 |
|
return |
851 |
|
|
852 |
|
def checkProxy(self): |
874 |
|
pass |
875 |
|
|
876 |
|
if mustRenew: |
877 |
< |
common.logger.message( "No valid proxy found or remaining time of validity of already existing proxy shorter than 10 hours!\n Creating a user proxy with default length of 96h\n") |
878 |
< |
cmd = 'voms-proxy-init -voms '+self.VO+' -valid 96:00' |
877 |
> |
common.logger.message( "No valid proxy found or remaining time of validity of already existing proxy shorter than 10 hours!\n Creating a user proxy with default length of 192h\n") |
878 |
> |
cmd = 'voms-proxy-init -voms '+self.VO |
879 |
> |
if self.group: |
880 |
> |
cmd += ':/'+self.VO+'/'+self.group |
881 |
|
if self.role: |
882 |
< |
cmd = 'voms-proxy-init -voms '+self.VO+':/'+self.VO+'/role='+self.role+' -valid 96:00' |
882 |
> |
cmd += '/role='+self.role |
883 |
> |
cmd += ' -valid 192:00' |
884 |
|
try: |
885 |
|
# SL as above: damn it! |
886 |
+ |
common.logger.debug(10,cmd) |
887 |
|
out = os.system(cmd) |
888 |
|
if (out>0): raise CrabException("Unable to create a valid proxy!\n") |
889 |
|
except: |