21 |
|
return |
22 |
|
|
23 |
|
def configure(self, cfg_params): |
24 |
< |
# test branch 2 |
24 |
> |
|
25 |
|
try: |
26 |
|
RB = cfg_params["EDG.rb"] |
27 |
|
edgConfig = EdgConfig(RB) |
37 |
|
self.proxyServer = 'myproxy.cern.ch' |
38 |
|
common.logger.debug(5,'Setting myproxy server to '+self.proxyServer) |
39 |
|
|
40 |
+ |
try: |
41 |
+ |
self.role = cfg_params["EDG.rb"] |
42 |
+ |
except KeyError: |
43 |
+ |
self.role = None |
44 |
+ |
|
45 |
+ |
try: |
46 |
+ |
self.role = cfg_params["EDG.role"] |
47 |
+ |
except KeyError: |
48 |
+ |
self.role = None |
49 |
+ |
|
50 |
|
try: self.LCG_version = cfg_params["EDG.lcg_version"] |
51 |
|
except KeyError: self.LCG_version = '2' |
52 |
|
|
191 |
|
Returns part of a job script which does scheduler-specific work. |
192 |
|
""" |
193 |
|
txt = '' |
194 |
+ |
txt += '# strip arguments\n' |
195 |
+ |
txt += 'echo "strip arguments"\n' |
196 |
+ |
txt += 'args=("$@")\n' |
197 |
+ |
txt += 'nargs=$#\n' |
198 |
+ |
txt += 'shift $nargs\n' |
199 |
|
txt += "# job number (first parameter for job wrapper)\n" |
200 |
< |
txt += "NJob=$1\n" |
200 |
> |
#txt += "NJob=$1\n" |
201 |
> |
txt += "NJob=${args[0]}\n" |
202 |
|
|
203 |
|
txt += '# job identification to DashBoard \n' |
204 |
|
txt += 'MonitorJobID=`echo ${NJob}_$EDG_WL_JOBID`\n' |
300 |
|
txt += ' echo "CE = $CE"\n' |
301 |
|
txt += 'elif [ $middleware == OSG ]; then \n' |
302 |
|
txt += ' if [ $OSG_JOB_CONTACT ]; then \n' |
303 |
< |
txt += ' CE=`echo $OSG_JOB_CONTACT | /usr/bin/awk -F\/ \'{print $1}\'` \n' |
303 |
> |
txt += ' CE=`echo $OSG_JOB_CONTACT | /usr/bin/awk -F\/ \'{print ${args[0]}}\'` \n' |
304 |
|
txt += ' else \n' |
305 |
|
txt += ' echo "SET_CMS_ENV 10099 ==> OSG mode: ERROR in setting CE name from OSG_JOB_CONTACT" \n' |
306 |
|
txt += ' echo "JOB_EXIT_STATUS = 10099" \n' |
394 |
|
txt += ' fi \n' |
395 |
|
txt += ' for out_file in $file_list ; do\n' |
396 |
|
txt += ' echo "Trying to copy output file to $SE using lcg-cp"\n' |
397 |
< |
txt += ' echo "lcg-cp --vo $VO -t 1200 --verbose file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
398 |
< |
txt += ' exitstring=`lcg-cp --vo $VO -t 1200 --verbose file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
397 |
> |
if common.logger.debugLevel() >= 5: |
398 |
> |
txt += ' echo "lcg-cp --vo $VO -t 2400 --verbose file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
399 |
> |
txt += ' exitstring=`lcg-cp --vo $VO -t 2400 --verbose file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
400 |
> |
else: |
401 |
> |
txt += ' echo "lcg-cp --vo $VO -t 2400 file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n' |
402 |
> |
txt += ' exitstring=`lcg-cp --vo $VO -t 2400 file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n' |
403 |
|
txt += ' copy_exit_status=$?\n' |
404 |
|
txt += ' echo "COPY_EXIT_STATUS for lcg-cp = $copy_exit_status"\n' |
405 |
|
txt += ' echo "STAGE_OUT = $copy_exit_status"\n' |
407 |
|
txt += ' echo "Possible problem with SE = $SE"\n' |
408 |
|
txt += ' echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n' |
409 |
|
txt += ' echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n' |
410 |
+ |
txt += ' echo "lcg-cp failed. For verbose lcg-cp output, use command line option -debug 5."\n' |
411 |
|
txt += ' echo "lcg-cp failed, attempting srmcp"\n' |
412 |
|
txt += ' echo "mkdir -p $HOME/.srmconfig"\n' |
413 |
|
txt += ' mkdir -p $HOME/.srmconfig\n' |
414 |
|
txt += ' if [ $middleware == LCG ]; then\n' |
415 |
< |
txt += ' echo "srmcp -retry_num 5 -retry_timeout 240000 file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
416 |
< |
txt += ' exitstring=`srmcp -retry_num 5 -retry_timeout 240000 file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
415 |
> |
txt += ' echo "srmcp -retry_num 5 -retry_timeout 480000 file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
416 |
> |
txt += ' exitstring=`srmcp -retry_num 5 -retry_timeout 480000 file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
417 |
|
txt += ' elif [ $middleware == OSG ]; then\n' |
418 |
|
txt += ' echo "srmcp -retry_num 5 -retry_timeout 240000 -x509_user_trusted_certificates $OSG_APP/glite/etc/grid-security/certificates file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n' |
419 |
|
txt += ' exitstring=`srmcp -retry_num 5 -retry_timeout 240000 -x509_user_trusted_certificates $OSG_APP/glite/etc/grid-security/certificates file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n' |
542 |
|
self.checkProxy() |
543 |
|
jdl = common.job_list[nj].jdlFilename() |
544 |
|
cmd = 'edg-job-list-match ' + self.configOpt_() + jdl |
545 |
< |
cmd_out = runCommand(cmd,0,10) |
545 |
> |
cmd_out = runCommand(cmd,0,45) |
546 |
|
if not cmd_out: |
547 |
|
raise CrabException("ERROR: "+cmd+" failed!") |
548 |
|
|
688 |
|
cmd_out = runCommand(cmd) |
689 |
|
return cmd_out |
690 |
|
|
691 |
< |
def getOutput(self, id): |
691 |
> |
##### FEDE ###### |
692 |
> |
def findSites_(self, n_tot_job): |
693 |
> |
itr4 = [] |
694 |
> |
# print "n_tot_job = ", n_tot_job |
695 |
> |
for n in range(n_tot_job): |
696 |
> |
sites = common.jobDB.destination(n) |
697 |
> |
if len(sites)>0 and sites[0]=="Any": continue |
698 |
> |
|
699 |
> |
#job = common.job_list[n] |
700 |
> |
#jbt = job.type() |
701 |
> |
# print "common.jobDB.destination(n) = ", common.jobDB.destination(n) |
702 |
> |
# print "sites = ", sites |
703 |
> |
itr = '' |
704 |
> |
for site in sites: |
705 |
> |
#itr = itr + 'target.GlueSEUniqueID=="'+site+'" || ' |
706 |
> |
itr = itr + 'target.GlueSEUniqueID=="'+site+'" || ' |
707 |
> |
pass |
708 |
> |
# remove last || |
709 |
> |
itr = itr[0:-4] |
710 |
> |
itr4.append( itr ) |
711 |
> |
# remove last , |
712 |
> |
# print "itr4 = ", itr4 |
713 |
> |
return itr4 |
714 |
> |
|
715 |
> |
def createXMLSchScript(self, nj, argsList): |
716 |
> |
# def createXMLSchScript(self, nj): |
717 |
> |
""" |
718 |
> |
Create a XML-file for BOSS4. |
719 |
> |
""" |
720 |
> |
# job = common.job_list[nj] |
721 |
> |
""" |
722 |
> |
INDY |
723 |
> |
[begin] da rivedere: |
724 |
> |
in particolare passerei il jobType ed eliminerei le dipendenze da job |
725 |
> |
""" |
726 |
> |
index = nj - 1 |
727 |
> |
job = common.job_list[index] |
728 |
> |
jbt = job.type() |
729 |
> |
|
730 |
> |
inp_sandbox = jbt.inputSandbox(index) |
731 |
> |
out_sandbox = jbt.outputSandbox(index) |
732 |
|
""" |
733 |
|
Get output for a finished job with id. |
734 |
|
Returns the name of directory with results. |
744 |
|
dir += '_' + os.path.basename(id) |
745 |
|
return dir |
746 |
|
|
686 |
– |
def cancel(self, id): |
687 |
– |
""" Cancel the EDG job with id """ |
688 |
– |
self.checkProxy() |
689 |
– |
cmd = 'edg-job-cancel --noint ' + id |
690 |
– |
cmd_out = runCommand(cmd) |
691 |
– |
return cmd_out |
692 |
– |
|
747 |
|
def createSchScript(self, nj): |
748 |
|
""" |
749 |
|
Create a JDL-file for EDG. |
834 |
|
|
835 |
|
req='Requirements = ' |
836 |
|
noreq=req |
837 |
< |
req = req + jbt.getRequirements() |
837 |
> |
req = req + jbt.getRequirements(nj) |
838 |
|
#### and USER REQUIREMENT |
839 |
|
if self.EDG_requirements: |
840 |
|
if (req != noreq): |
920 |
|
|
921 |
|
if mustRenew: |
922 |
|
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") |
923 |
< |
cmd = 'voms-proxy-init -voms cms -valid 96:00' |
923 |
> |
cmd = 'voms-proxy-init -voms '+self.VO+' -valid 96:00' |
924 |
> |
if self.role: |
925 |
> |
cmd = 'voms-proxy-init -voms '+self.VO+':/'+self.VO+'/role='+self.role+' -valid 96:00' |
926 |
|
try: |
927 |
|
# SL as above: damn it! |
928 |
|
out = os.system(cmd) |
930 |
|
except: |
931 |
|
msg = "Unable to create a valid proxy!\n" |
932 |
|
raise CrabException(msg) |
877 |
– |
# cmd = 'grid-proxy-info -timeleft' |
878 |
– |
# cmd_out = runCommand(cmd,0,20) |
933 |
|
pass |
934 |
|
|
935 |
|
## now I do have a voms proxy valid, and I check the myproxy server |