ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/SchedulerEdg.py
Revision: 1.96
Committed: Mon Oct 9 23:28:22 2006 UTC (18 years, 6 months ago) by gutsche
Content type: text/x-python
Branch: MAIN
Changes since 1.95: +2 -1 lines
Log Message:
add FrameworkJobReport python WN parsing script per default to input sandbox

File Contents

# User Rev Content
1 nsmirnov 1.1 from Scheduler import Scheduler
2     from crab_logger import Logger
3     from crab_exceptions import *
4     from crab_util import *
5 slacapra 1.50 from EdgConfig import *
6 nsmirnov 1.1 import common
7    
8 slacapra 1.18 import os, sys, time
9 nsmirnov 1.1
10     class SchedulerEdg(Scheduler):
11     def __init__(self):
12     Scheduler.__init__(self,"EDG")
13 slacapra 1.8 self.states = [ "Acl", "cancelReason", "cancelling","ce_node","children", \
14     "children_hist","children_num","children_states","condorId","condor_jdl", \
15     "cpuTime","destination", "done_code","exit_code","expectFrom", \
16     "expectUpdate","globusId","jdl","jobId","jobtype", \
17     "lastUpdateTime","localId","location", "matched_jdl","network_server", \
18     "owner","parent_job", "reason","resubmitted","rsl","seed",\
19     "stateEnterTime","stateEnterTimes","subjob_failed", \
20     "user tags" , "status" , "status_code","hierarchy"]
21 nsmirnov 1.1 return
22    
23     def configure(self, cfg_params):
24 spiga 1.49
25 slacapra 1.46 try:
26     RB = cfg_params["EDG.rb"]
27     edgConfig = EdgConfig(RB)
28     self.edg_config = edgConfig.config()
29     self.edg_config_vo = edgConfig.configVO()
30     except KeyError:
31     self.edg_config = ''
32     self.edg_config_vo = ''
33 nsmirnov 1.1
34 slacapra 1.51 try:
35     self.proxyServer = cfg_params["EDG.proxy_server"]
36     except KeyError:
37     self.proxyServer = 'myproxy.cern.ch'
38     common.logger.debug(5,'Setting myproxy server to '+self.proxyServer)
39 spiga 1.49
40 slacapra 1.79 try:
41 spiga 1.91 self.group = cfg_params["EDG.group"]
42     except KeyError:
43     self.group = None
44    
45     try:
46 slacapra 1.79 self.role = cfg_params["EDG.role"]
47     except KeyError:
48     self.role = None
49    
50 nsmirnov 1.1 try: self.LCG_version = cfg_params["EDG.lcg_version"]
51     except KeyError: self.LCG_version = '2'
52    
53     try: self.EDG_requirements = cfg_params['EDG.requirements']
54     except KeyError: self.EDG_requirements = ''
55    
56 spiga 1.49 try: self.EDG_retry_count = cfg_params['EDG.retry_count']
57 nsmirnov 1.1 except KeyError: self.EDG_retry_count = ''
58    
59 fanzago 1.48 try:
60     self.EDG_ce_black_list = cfg_params['EDG.ce_black_list']
61 spiga 1.88 #print "self.EDG_ce_black_list = ", self.EDG_ce_black_list
62 fanzago 1.48 except KeyError:
63     self.EDG_ce_black_list = ''
64    
65     try:
66     self.EDG_ce_white_list = cfg_params['EDG.ce_white_list']
67 spiga 1.88 #print "self.EDG_ce_white_list = ", self.EDG_ce_white_list
68 fanzago 1.48 except KeyError: self.EDG_ce_white_list = ''
69    
70 fanzago 1.14 try: self.VO = cfg_params['EDG.virtual_organization']
71     except KeyError: self.VO = 'cms'
72    
73 spiga 1.49 try: self.return_data = cfg_params['USER.return_data']
74 spiga 1.91 except KeyError: self.return_data = 0
75    
76 fanzago 1.14 try:
77     self.copy_data = cfg_params["USER.copy_data"]
78 fanzago 1.30 if int(self.copy_data) == 1:
79     try:
80     self.SE = cfg_params['USER.storage_element']
81     self.SE_PATH = cfg_params['USER.storage_path']
82     except KeyError:
83     msg = "Error. The [USER] section does not have 'storage_element'"
84     msg = msg + " and/or 'storage_path' entries, necessary to copy the output"
85     common.logger.message(msg)
86     raise CrabException(msg)
87     except KeyError: self.copy_data = 0
88    
89     if ( int(self.return_data) == 0 and int(self.copy_data) == 0 ):
90     msg = 'Warning: return_data = 0 and copy_data = 0 ==> your exe output will be lost\n'
91     msg = msg + 'Please modify return_data and copy_data value in your crab.cfg file\n'
92     raise CrabException(msg)
93 fanzago 1.38
94     try:
95     self.lfc_host = cfg_params['EDG.lfc_host']
96     except KeyError:
97     msg = "Error. The [EDG] section does not have 'lfc_host' value"
98     msg = msg + " it's necessary to know the LFC host name"
99     common.logger.message(msg)
100     raise CrabException(msg)
101     try:
102     self.lcg_catalog_type = cfg_params['EDG.lcg_catalog_type']
103     except KeyError:
104     msg = "Error. The [EDG] section does not have 'lcg_catalog_type' value"
105     msg = msg + " it's necessary to know the catalog type"
106     common.logger.message(msg)
107     raise CrabException(msg)
108     try:
109     self.lfc_home = cfg_params['EDG.lfc_home']
110     except KeyError:
111     msg = "Error. The [EDG] section does not have 'lfc_home' value"
112     msg = msg + " it's necessary to know the home catalog dir"
113     common.logger.message(msg)
114     raise CrabException(msg)
115 fanzago 1.30
116 fanzago 1.14 try:
117     self.register_data = cfg_params["USER.register_data"]
118 fanzago 1.30 if int(self.register_data) == 1:
119     try:
120     self.LFN = cfg_params['USER.lfn_dir']
121     except KeyError:
122     msg = "Error. The [USER] section does not have 'lfn_dir' value"
123 fanzago 1.36 msg = msg + " it's necessary for LCF registration"
124 fanzago 1.30 common.logger.message(msg)
125     raise CrabException(msg)
126     except KeyError: self.register_data = 0
127    
128     if ( int(self.copy_data) == 0 and int(self.register_data) == 1 ):
129     msg = 'Warning: register_data = 1 must be used with copy_data = 1\n'
130     msg = msg + 'Please modify copy_data value in your crab.cfg file\n'
131     common.logger.message(msg)
132     raise CrabException(msg)
133 fanzago 1.14
134     try: self.EDG_requirements = cfg_params['EDG.requirements']
135     except KeyError: self.EDG_requirements = ''
136    
137     try: self.EDG_retry_count = cfg_params['EDG.retry_count']
138     except KeyError: self.EDG_retry_count = ''
139    
140     try: self.EDG_clock_time = cfg_params['EDG.max_wall_clock_time']
141     except KeyError: self.EDG_clock_time= ''
142    
143     try: self.EDG_cpu_time = cfg_params['EDG.max_cpu_time']
144     except KeyError: self.EDG_cpu_time = ''
145    
146 fanzago 1.16 # Add EDG_WL_LOCATION to the python path
147    
148     try:
149     path = os.environ['EDG_WL_LOCATION']
150     except:
151     msg = "Error: the EDG_WL_LOCATION variable is not set."
152     raise CrabException(msg)
153    
154     libPath=os.path.join(path, "lib")
155     sys.path.append(libPath)
156     libPath=os.path.join(path, "lib", "python")
157     sys.path.append(libPath)
158 nsmirnov 1.1
159 slacapra 1.18 self.proxyValid=0
160 gutsche 1.60
161 slacapra 1.61 try:
162     self._taskId = cfg_params['taskId']
163     except:
164     self._taskId = ''
165 gutsche 1.60
166 slacapra 1.81 try: self.jobtypeName = cfg_params['CRAB.jobtype']
167     except KeyError: self.jobtypeName = ''
168    
169     try: self.schedulerName = cfg_params['CRAB.scheduler']
170     except KeyError: self.scheduler = ''
171    
172 nsmirnov 1.1 return
173    
174 fanzago 1.10
175     def sched_parameter(self):
176     """
177 spiga 1.88 Returns file with requirements and scheduler-specific parameters
178 fanzago 1.10 """
179 spiga 1.88 index = int(common.jobDB.nJobs()) - 1
180     job = common.job_list[index]
181     jbt = job.type()
182    
183 slacapra 1.95 lastBlock=-1
184 spiga 1.88 first = []
185     for n in range(common.jobDB.nJobs()):
186 slacapra 1.95 currBlock=common.jobDB.block(n)
187     if (currBlock!=lastBlock):
188     lastBlock = currBlock
189 spiga 1.88 first.append(n)
190    
191     req = ''
192     req = req + jbt.getRequirements()
193    
194     if self.EDG_requirements:
195     if (req == ' '):
196     req = req + self.EDG_requirements
197     else:
198     req = req + ' && ' + self.EDG_requirements
199 slacapra 1.95
200 spiga 1.88 if self.EDG_ce_white_list:
201     ce_white_list = string.split(self.EDG_ce_white_list,',')
202     for i in range(len(ce_white_list)):
203     if i == 0:
204     if (req == ' '):
205     req = req + '((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
206     else:
207     req = req + ' && ((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
208     pass
209     else:
210     req = req + ' || (RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
211     req = req + ')'
212    
213     if self.EDG_ce_black_list:
214     ce_black_list = string.split(self.EDG_ce_black_list,',')
215     for ce in ce_black_list:
216     if (req == ' '):
217     req = req + '(!RegExp("' + ce + '", other.GlueCEUniqueId))'
218     else:
219     req = req + ' && (!RegExp("' + ce + '", other.GlueCEUniqueId))'
220     pass
221     if self.EDG_clock_time:
222     if (req == ' '):
223     req = req + 'other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time
224     else:
225     req = req + ' && other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time
226    
227     if self.EDG_cpu_time:
228     if (req == ' '):
229     req = req + ' other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
230     else:
231     req = req + ' && other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
232    
233     for i in range(len(first)): # Add loop DS
234     self.param='sched_param_'+str(i)+'.clad'
235 fanzago 1.10 param_file = open(common.work_space.shareDir()+'/'+self.param, 'w')
236 spiga 1.88
237     itr4=self.findSites_(first[i])
238 slacapra 1.95 for arg in itr4:
239     req = req + ' && anyMatch(other.storage.CloseSEs, ('+str(arg)+'))'
240     param_file.write('Requirements = '+req +';\n')
241 spiga 1.88
242     if (self.edg_config and self.edg_config_vo != ''):
243     param_file.write('RBconfig = "'+self.edg_config+'";\n')
244     param_file.write('RBconfigVO = "'+self.edg_config_vo+'";')
245    
246 fanzago 1.10 param_file.close()
247 spiga 1.88
248 fanzago 1.13
249 nsmirnov 1.2 def wsSetupEnvironment(self):
250     """
251     Returns part of a job script which does scheduler-specific work.
252     """
253 spiga 1.49 txt = ''
254 mkirn 1.75 txt += '# strip arguments\n'
255     txt += 'echo "strip arguments"\n'
256     txt += 'args=("$@")\n'
257     txt += 'nargs=$#\n'
258     txt += 'shift $nargs\n'
259 gutsche 1.60 txt += "# job number (first parameter for job wrapper)\n"
260 mkirn 1.75 #txt += "NJob=$1\n"
261     txt += "NJob=${args[0]}\n"
262 gutsche 1.60
263     txt += '# job identification to DashBoard \n'
264 gutsche 1.64 txt += 'MonitorJobID=`echo ${NJob}_$EDG_WL_JOBID`\n'
265     txt += 'SyncGridJobId=`echo $EDG_WL_JOBID`\n'
266     txt += 'MonitorID=`echo ' + self._taskId + '`\n'
267     txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
268     txt += 'echo "SyncGridJobId=`echo $SyncGridJobId`" | tee -a $RUNTIME_AREA/$repo \n'
269     txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
270 gutsche 1.60
271 spiga 1.49 txt += 'echo "middleware discovery " \n'
272 gutsche 1.84 txt += 'if [ $GRID3_APP_DIR ]; then\n'
273 spiga 1.49 txt += ' middleware=OSG \n'
274 gutsche 1.60 txt += ' echo "SyncCE=`echo $EDG_WL_LOG_DESTINATION`" | tee -a $RUNTIME_AREA/$repo \n'
275     txt += ' echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
276 spiga 1.49 txt += ' echo "middleware =$middleware" \n'
277     txt += 'elif [ $OSG_APP ]; then \n'
278     txt += ' middleware=OSG \n'
279 gutsche 1.60 txt += ' echo "SyncCE=`echo $EDG_WL_LOG_DESTINATION`" | tee -a $RUNTIME_AREA/$repo \n'
280     txt += ' echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
281 spiga 1.49 txt += ' echo "middleware =$middleware" \n'
282 gutsche 1.84 txt += 'elif [ $VO_CMS_SW_DIR ]; then \n'
283     txt += ' middleware=LCG \n'
284     txt += ' echo "SyncCE=`edg-brokerinfo getCE`" | tee -a $RUNTIME_AREA/$repo \n'
285     txt += ' echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
286     txt += ' echo "middleware =$middleware" \n'
287 spiga 1.49 txt += 'else \n'
288 gutsche 1.60 txt += ' echo "SET_CMS_ENV 10030 ==> middleware not identified" \n'
289     txt += ' echo "JOB_EXIT_STATUS = 10030" \n'
290     txt += ' echo "JobExitCode=10030" | tee -a $RUNTIME_AREA/$repo \n'
291     txt += ' dumpStatus $RUNTIME_AREA/$repo \n'
292 gutsche 1.64 txt += ' rm -f $RUNTIME_AREA/$repo \n'
293     txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
294     txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
295 gutsche 1.60 txt += ' exit 1 \n'
296     txt += 'fi \n'
297    
298     txt += '# report first time to DashBoard \n'
299     txt += 'dumpStatus $RUNTIME_AREA/$repo \n'
300 gutsche 1.64 txt += 'rm -f $RUNTIME_AREA/$repo \n'
301     txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
302     txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
303    
304 spiga 1.49 txt += '\n\n'
305    
306 fanzago 1.30 if int(self.copy_data) == 1:
307 fanzago 1.14 if self.SE:
308     txt += 'export SE='+self.SE+'\n'
309 fanzago 1.15 txt += 'echo "SE = $SE"\n'
310 fanzago 1.14 if self.SE_PATH:
311     if ( self.SE_PATH[-1] != '/' ) : self.SE_PATH = self.SE_PATH + '/'
312     txt += 'export SE_PATH='+self.SE_PATH+'\n'
313 fanzago 1.15 txt += 'echo "SE_PATH = $SE_PATH"\n'
314 spiga 1.49
315 fanzago 1.38 txt += 'export VO='+self.VO+'\n'
316 spiga 1.88 ### add some line for LFC catalog setting
317 spiga 1.49 txt += 'if [ $middleware == LCG ]; then \n'
318     txt += ' if [[ $LCG_CATALOG_TYPE != \''+self.lcg_catalog_type+'\' ]]; then\n'
319     txt += ' export LCG_CATALOG_TYPE='+self.lcg_catalog_type+'\n'
320     txt += ' fi\n'
321     txt += ' if [[ $LFC_HOST != \''+self.lfc_host+'\' ]]; then\n'
322     txt += ' export LFC_HOST='+self.lfc_host+'\n'
323     txt += ' fi\n'
324     txt += ' if [[ $LFC_HOME != \''+self.lfc_home+'\' ]]; then\n'
325     txt += ' export LFC_HOME='+self.lfc_home+'\n'
326     txt += ' fi\n'
327     txt += 'elif [ $middleware == OSG ]; then\n'
328     txt += ' echo "LFC catalog setting to be implemented for OSG"\n'
329 fanzago 1.38 txt += 'fi\n'
330     #####
331 fanzago 1.30 if int(self.register_data) == 1:
332 spiga 1.49 txt += 'if [ $middleware == LCG ]; then \n'
333     txt += ' export LFN='+self.LFN+'\n'
334     txt += ' lfc-ls $LFN\n'
335     txt += ' result=$?\n'
336     txt += ' echo $result\n'
337 fanzago 1.36 ### creation of LFN dir in LFC catalog, under /grid/cms dir
338 spiga 1.49 txt += ' if [ $result != 0 ]; then\n'
339     txt += ' lfc-mkdir $LFN\n'
340     txt += ' result=$?\n'
341     txt += ' echo $result\n'
342     txt += ' fi\n'
343     txt += 'elif [ $middleware == OSG ]; then\n'
344     txt += ' echo " Files registration to be implemented for OSG"\n'
345 fanzago 1.36 txt += 'fi\n'
346     txt += '\n'
347 spiga 1.49
348     if self.VO:
349     txt += 'export VO='+self.VO+'\n'
350     if self.LFN:
351     txt += 'if [ $middleware == LCG ]; then \n'
352     txt += ' export LFN='+self.LFN+'\n'
353     txt += 'fi\n'
354     txt += '\n'
355    
356     txt += 'if [ $middleware == LCG ]; then\n'
357     txt += ' CloseCEs=`edg-brokerinfo getCE`\n'
358     txt += ' echo "CloseCEs = $CloseCEs"\n'
359     txt += ' CE=`echo $CloseCEs | sed -e "s/:.*//"`\n'
360     txt += ' echo "CE = $CE"\n'
361     txt += 'elif [ $middleware == OSG ]; then \n'
362     txt += ' if [ $OSG_JOB_CONTACT ]; then \n'
363 slacapra 1.81 txt += ' CE=`echo $OSG_JOB_CONTACT | /usr/bin/awk -F\/ \'{print $1}\'` \n'
364 spiga 1.49 txt += ' else \n'
365 gutsche 1.60 txt += ' echo "SET_CMS_ENV 10099 ==> OSG mode: ERROR in setting CE name from OSG_JOB_CONTACT" \n'
366     txt += ' echo "JOB_EXIT_STATUS = 10099" \n'
367     txt += ' echo "JobExitCode=10099" | tee -a $RUNTIME_AREA/$repo \n'
368     txt += ' dumpStatus $RUNTIME_AREA/$repo \n'
369 gutsche 1.64 txt += ' rm -f $RUNTIME_AREA/$repo \n'
370     txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
371     txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
372 spiga 1.49 txt += ' exit 1 \n'
373     txt += ' fi \n'
374     txt += 'fi \n'
375    
376 nsmirnov 1.2 return txt
377 fanzago 1.15
378 fanzago 1.39 def wsCopyInput(self):
379     """
380     Copy input data from SE to WN
381     """
382     txt = ''
383 slacapra 1.90
384 spiga 1.49 ## OLI_Daniele deactivate for OSG (wait for LCG UI installed on OSG)
385 slacapra 1.92 txt += 'if [ $middleware == OSG ]; then\n'
386     txt += ' #\n'
387     txt += ' # Copy Input Data from SE to this WN deactivated in OSG mode\n'
388     txt += ' #\n'
389     txt += ' echo "Copy Input Data from SE to this WN deactivated in OSG mode"\n'
390     txt += 'elif [ $middleware == LCG ]; then \n'
391     txt += ' #\n'
392     txt += ' # Copy Input Data from SE to this WN\n'
393     txt += ' #\n'
394     ### changed by georgia (put a loop copying more than one input files per jobs)
395     txt += ' for input_file in $cur_file_list \n'
396     txt += ' do \n'
397     txt += ' lcg-cp --vo $VO --verbose -t 1200 lfn:$input_lfn/$input_file file:`pwd`/$input_file 2>&1\n'
398     txt += ' copy_input_exit_status=$?\n'
399     txt += ' echo "COPY_INPUT_EXIT_STATUS = $copy_input_exit_status"\n'
400     txt += ' if [ $copy_input_exit_status -ne 0 ]; then \n'
401     txt += ' echo "Problems with copying to WN" \n'
402     txt += ' else \n'
403     txt += ' echo "input copied into WN" \n'
404     txt += ' fi \n'
405     txt += ' done \n'
406     ### copy a set of PU ntuples (same for each jobs -- but accessed randomly)
407     txt += ' for file in $cur_pu_list \n'
408     txt += ' do \n'
409     txt += ' lcg-cp --vo $VO --verbose -t 1200 lfn:$pu_lfn/$file file:`pwd`/$file 2>&1\n'
410     txt += ' copy_input_pu_exit_status=$?\n'
411     txt += ' echo "COPY_INPUT_PU_EXIT_STATUS = $copy_input_pu_exit_status"\n'
412     txt += ' if [ $copy_input_pu_exit_status -ne 0 ]; then \n'
413     txt += ' echo "Problems with copying pu to WN" \n'
414     txt += ' else \n'
415     txt += ' echo "input pu files copied into WN" \n'
416     txt += ' fi \n'
417     txt += ' done \n'
418     txt += ' \n'
419     txt += ' ### Check SCRATCH space available on WN : \n'
420     txt += ' df -h \n'
421     txt += 'fi \n'
422 spiga 1.49
423 fanzago 1.39 return txt
424    
425 fanzago 1.14 def wsCopyOutput(self):
426     """
427     Write a CopyResults part of a job script, e.g.
428     to copy produced output into a storage element.
429     """
430     txt = ''
431 fanzago 1.30 if int(self.copy_data) == 1:
432 fanzago 1.14 txt += '#\n'
433 fanzago 1.15 txt += '# Copy output to SE = $SE\n'
434 fanzago 1.14 txt += '#\n'
435 gutsche 1.73 txt += ' if [ $middleware == OSG ]; then\n'
436     txt += ' echo "X509_USER_PROXY = $X509_USER_PROXY"\n'
437     txt += ' echo "source $OSG_APP/glite/setup_glite_ui.sh"\n'
438     txt += ' source $OSG_APP/glite/setup_glite_ui.sh\n'
439     txt += ' export X509_CERT_DIR=$OSG_APP/glite/etc/grid-security/certificates\n'
440     txt += ' echo "export X509_CERT_DIR=$X509_CERT_DIR"\n'
441     txt += ' fi \n'
442 spiga 1.91
443 corvo 1.34 txt += ' for out_file in $file_list ; do\n'
444 spiga 1.91 txt += ' echo "Trying to copy output file to $SE using srmcp"\n'
445     txt += ' echo "mkdir -p $HOME/.srmconfig"\n'
446     txt += ' mkdir -p $HOME/.srmconfig\n'
447     txt += ' if [ $middleware == LCG ]; then\n'
448     txt += ' echo "srmcp -retry_num 3 -retry_timeout 480000 file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n'
449     txt += ' exitstring=`srmcp -retry_num 3 -retry_timeout 480000 file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n'
450     txt += ' elif [ $middleware == OSG ]; then\n'
451     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'
452     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'
453     txt += ' fi \n'
454 gutsche 1.73 txt += ' copy_exit_status=$?\n'
455 spiga 1.91 txt += ' echo "COPY_EXIT_STATUS for srmcp = $copy_exit_status"\n'
456 corvo 1.34 txt += ' echo "STAGE_OUT = $copy_exit_status"\n'
457 spiga 1.91
458 corvo 1.34 txt += ' if [ $copy_exit_status -ne 0 ]; then\n'
459 gutsche 1.73 txt += ' echo "Possible problem with SE = $SE"\n'
460 corvo 1.34 txt += ' echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n'
461     txt += ' echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n'
462 mkirn 1.93 txt += ' echo "srmcp failed, attempting lcg-cp."\n'
463 spiga 1.91 if common.logger.debugLevel() >= 5:
464     txt += ' echo "lcg-cp --vo $VO -t 2400 --verbose file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n'
465     txt += ' exitstring=`lcg-cp --vo $VO -t 2400 --verbose file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n'
466     else:
467     txt += ' echo "lcg-cp --vo $VO -t 2400 file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n'
468     txt += ' exitstring=`lcg-cp --vo $VO -t 2400 file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n'
469 spiga 1.88 txt += ' copy_exit_status=$?\n'
470 spiga 1.91 txt += ' echo "COPY_EXIT_STATUS for lcg-cp = $copy_exit_status"\n'
471 slacapra 1.87 txt += ' echo "STAGE_OUT = $copy_exit_status"\n'
472 spiga 1.91
473 gutsche 1.73 txt += ' if [ $copy_exit_status -ne 0 ]; then\n'
474     txt += ' echo "Problems with SE = $SE"\n'
475     txt += ' echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n'
476     txt += ' echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n'
477 mkirn 1.93 txt += ' echo "srmcp and lcg-cp and failed!"\n'
478 gutsche 1.73 txt += ' else\n'
479     txt += ' echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n'
480     txt += ' echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n'
481     txt += ' echo "output copied into $SE/$SE_PATH directory"\n'
482     txt += ' echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n'
483 spiga 1.91 txt += ' echo "lcg-cp succeeded"\n'
484 gutsche 1.73 txt += ' fi\n'
485 corvo 1.34 txt += ' else\n'
486     txt += ' echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n'
487     txt += ' echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n'
488     txt += ' echo "output copied into $SE/$SE_PATH directory"\n'
489     txt += ' echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n'
490 spiga 1.91 txt += ' echo "srmcp succeeded"\n'
491 corvo 1.34 txt += ' fi\n'
492     txt += ' done\n'
493 fanzago 1.14 return txt
494    
495     def wsRegisterOutput(self):
496     """
497     Returns part of a job script which does scheduler-specific work.
498     """
499    
500     txt = ''
501 fanzago 1.30 if int(self.register_data) == 1:
502 spiga 1.49 ## OLI_Daniele deactivate for OSG (wait for LCG UI installed on OSG)
503     txt += 'if [ $middleware == OSG ]; then\n'
504     txt += ' #\n'
505     txt += ' # Register output to LFC deactivated in OSG mode\n'
506     txt += ' #\n'
507     txt += ' echo "Register output to LFC deactivated in OSG mode"\n'
508     txt += 'elif [ $middleware == LCG ]; then \n'
509 fanzago 1.14 txt += '#\n'
510 fanzago 1.36 txt += '# Register output to LFC\n'
511 fanzago 1.14 txt += '#\n'
512 fanzago 1.66 txt += ' if [ $copy_exit_status -eq 0 ]; then\n'
513 spiga 1.49 txt += ' for out_file in $file_list ; do\n'
514     txt += ' echo "Trying to register the output file into LFC"\n'
515 fanzago 1.71 txt += ' echo "lcg-rf -l $LFN/$out_file --vo $VO -t 1200 sfn://$SE$SE_PATH/$out_file 2>&1"\n'
516 fanzago 1.70 txt += ' lcg-rf -l $LFN/$out_file --vo $VO -t 1200 sfn://$SE$SE_PATH/$out_file 2>&1 \n'
517 fanzago 1.14 txt += ' register_exit_status=$?\n'
518 fanzago 1.15 txt += ' echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
519     txt += ' echo "STAGE_OUT = $register_exit_status"\n'
520 fanzago 1.14 txt += ' if [ $register_exit_status -ne 0 ]; then \n'
521 spiga 1.49 txt += ' echo "Problems with the registration to LFC" \n'
522     txt += ' echo "Try with srm protocol" \n'
523 fanzago 1.71 txt += ' echo "lcg-rf -l $LFN/$out_file --vo $VO -t 1200 srm://$SE$SE_PATH/$out_file 2>&1"\n'
524 fanzago 1.70 txt += ' lcg-rf -l $LFN/$out_file --vo $VO -t 1200 srm://$SE$SE_PATH/$out_file 2>&1 \n'
525 spiga 1.49 txt += ' register_exit_status=$?\n'
526     txt += ' echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
527     txt += ' echo "STAGE_OUT = $register_exit_status"\n'
528     txt += ' if [ $register_exit_status -ne 0 ]; then \n'
529     txt += ' echo "Problems with the registration into LFC" \n'
530     txt += ' fi \n'
531     txt += ' else \n'
532     txt += ' echo "output registered to LFC"\n'
533 fanzago 1.14 txt += ' fi \n'
534 spiga 1.49 txt += ' echo "StageOutExitStatus = $register_exit_status" | tee -a $RUNTIME_AREA/$repo\n'
535     txt += ' done\n'
536 fanzago 1.66 txt += ' else \n'
537 spiga 1.49 txt += ' echo "Trying to copy output file to CloseSE"\n'
538     txt += ' CLOSE_SE=`edg-brokerinfo getCloseSEs | head -1`\n'
539     txt += ' for out_file in $file_list ; do\n'
540 fanzago 1.71 txt += ' echo "lcg-cr -v -l lfn:${LFN}/$out_file -d $CLOSE_SE -P $LFN/$out_file --vo $VO file://$RUNTIME_AREA/$out_file 2>&1" \n'
541 fanzago 1.70 txt += ' lcg-cr -v -l lfn:${LFN}/$out_file -d $CLOSE_SE -P $LFN/$out_file --vo $VO file://$RUNTIME_AREA/$out_file 2>&1 \n'
542 spiga 1.49 txt += ' register_exit_status=$?\n'
543     txt += ' echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
544     txt += ' echo "STAGE_OUT = $register_exit_status"\n'
545     txt += ' if [ $register_exit_status -ne 0 ]; then \n'
546 fanzago 1.66 txt += ' echo "Problems with CloseSE or Catalog" \n'
547 spiga 1.49 txt += ' else \n'
548     txt += ' echo "The program was successfully executed"\n'
549     txt += ' echo "SE = $CLOSE_SE"\n'
550     txt += ' echo "LFN for the file is LFN=${LFN}/$out_file"\n'
551     txt += ' fi \n'
552     txt += ' echo "StageOutExitStatus = $register_exit_status" | tee -a $RUNTIME_AREA/$repo\n'
553     txt += ' done\n'
554     txt += ' fi \n'
555 fanzago 1.68 txt += ' exit_status=$register_exit_status\n'
556 fanzago 1.14 txt += 'fi \n'
557     return txt
558 nsmirnov 1.1
559 spiga 1.23 def loggingInfo(self, id):
560 slacapra 1.7 """
561     retrieve the logging info from logging and bookkeeping and return it
562     """
563 slacapra 1.18 self.checkProxy()
564 fanzago 1.24 cmd = 'edg-job-get-logging-info -v 2 ' + id
565 slacapra 1.32 #cmd_out = os.popen(cmd)
566     cmd_out = runCommand(cmd)
567 slacapra 1.7 return cmd_out
568    
569 slacapra 1.8 def getExitStatus(self, id):
570     return self.getStatusAttribute_(id, 'exit_code')
571 fanzago 1.10
572 nsmirnov 1.1 def queryStatus(self, id):
573 slacapra 1.8 return self.getStatusAttribute_(id, 'status')
574 fanzago 1.10
575 spiga 1.9 def queryDest(self, id):
576     return self.getStatusAttribute_(id, 'destination')
577    
578 slacapra 1.8
579     def getStatusAttribute_(self, id, attr):
580 nsmirnov 1.1 """ Query a status of the job with id """
581 slacapra 1.8
582 slacapra 1.18 self.checkProxy()
583 slacapra 1.8 hstates = {}
584 fanzago 1.12 Status = importName('edg_wl_userinterface_common_LbWrapper', 'Status')
585 slacapra 1.8 # Bypass edg-job-status interfacing directly to C++ API
586     # Job attribute vector to retrieve status without edg-job-status
587     level = 0
588     # Instance of the Status class provided by LB API
589     jobStat = Status()
590     st = 0
591 slacapra 1.95 #print id, level, attr, self.states.index(attr)
592 slacapra 1.8 jobStat.getStatus(id, level)
593 slacapra 1.95 #print jobStat.loadStatus(st)
594 slacapra 1.8 err, apiMsg = jobStat.get_error()
595     if err:
596 fanzago 1.26 common.logger.debug(5,'Error caught' + apiMsg)
597 nsmirnov 1.1 return None
598 slacapra 1.8 else:
599     for i in range(len(self.states)):
600     # Fill an hash table with all information retrieved from LB API
601     hstates[ self.states[i] ] = jobStat.loadStatus(st)[i]
602 slacapra 1.95 #print i, jobStat.loadStatus(st)[i]
603 slacapra 1.81 result = jobStat.loadStatus(st)[self.states.index(attr)]
604 slacapra 1.95 #print str(result)
605 slacapra 1.8 return result
606 nsmirnov 1.1
607     def queryDetailedStatus(self, id):
608     """ Query a detailed status of the job with id """
609     cmd = 'edg-job-status '+id
610     cmd_out = runCommand(cmd)
611     return cmd_out
612    
613 slacapra 1.80 ##### FEDE ######
614 spiga 1.88 def findSites_(self, n):
615     itr4 =[]
616     sites = common.jobDB.destination(n)
617     if len(sites)>0 and sites[0]=="Any":
618     return itr4
619     itr = ''
620     if sites != [""]:#CarlosDaniele
621     for site in sites:
622     #itr = itr + 'target.GlueSEUniqueID=="'+site+'" || '
623     itr = itr + 'target.GlueSEUniqueID=="'+site+'" || '
624     itr = itr[0:-4]
625     itr4.append( itr )
626 slacapra 1.80 return itr4
627    
628     def createXMLSchScript(self, nj, argsList):
629     # def createXMLSchScript(self, nj):
630 spiga 1.88
631 slacapra 1.80 """
632     Create a XML-file for BOSS4.
633     """
634     # job = common.job_list[nj]
635     """
636     INDY
637 spiga 1.88 [begin] FIX-ME:
638     I would pass jobType instead of job
639 slacapra 1.80 """
640     index = nj - 1
641     job = common.job_list[index]
642     jbt = job.type()
643    
644     inp_sandbox = jbt.inputSandbox(index)
645     out_sandbox = jbt.outputSandbox(index)
646 nsmirnov 1.5 """
647 spiga 1.88 [end] FIX-ME
648 nsmirnov 1.5 """
649 slacapra 1.6
650 slacapra 1.81
651     title = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'
652     jt_string = ''
653    
654     xml_fname = str(self.jobtypeName)+'.xml'
655     xml = open(common.work_space.shareDir()+'/'+xml_fname, 'a')
656    
657     #TaskName
658     dir = string.split(common.work_space.topDir(), '/')
659     taskName = dir[len(dir)-2]
660    
661     to_writeReq = ''
662     to_write = ''
663    
664     req=' '
665     req = req + jbt.getRequirements()
666    
667    
668     #sites = common.jobDB.destination(nj)
669     #if len(sites)>0 and sites[0]!="Any":
670     # req = req + ' && anyMatch(other.storage.CloseSEs, (_ITR4_))'
671     #req = req
672    
673     if self.EDG_requirements:
674     if (req == ' '):
675     req = req + self.EDG_requirements
676     else:
677     req = req + ' && ' + self.EDG_requirements
678     if self.EDG_ce_white_list:
679     ce_white_list = string.split(self.EDG_ce_white_list,',')
680     for i in range(len(ce_white_list)):
681     if i == 0:
682     if (req == ' '):
683     req = req + '((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
684     else:
685     req = req + ' && ((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
686     pass
687     else:
688     req = req + ' || (RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
689     req = req + ')'
690    
691     if self.EDG_ce_black_list:
692     ce_black_list = string.split(self.EDG_ce_black_list,',')
693     for ce in ce_black_list:
694     if (req == ' '):
695     req = req + '(!RegExp("' + ce + '", other.GlueCEUniqueId))'
696     else:
697     req = req + ' && (!RegExp("' + ce + '", other.GlueCEUniqueId))'
698     pass
699     if self.EDG_clock_time:
700     if (req == ' '):
701     req = req + 'other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time
702     else:
703     req = req + ' && other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time
704    
705     if self.EDG_cpu_time:
706     if (req == ' '):
707     req = req + ' other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
708     else:
709     req = req + ' && other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
710    
711     if ( self.EDG_retry_count ):
712     to_write = to_write + 'RetryCount = "'+self.EDG_retry_count+'"\n'
713     pass
714 nsmirnov 1.5
715 slacapra 1.81 to_write = to_write + 'MyProxyServer = "&quot;' + self.proxyServer + '&quot;"\n'
716     to_write = to_write + 'VirtualOrganisation = "&quot;' + self.VO + '&quot;"\n'
717 nsmirnov 1.1
718 spiga 1.88 #TaskName
719 slacapra 1.81 dir = string.split(common.work_space.topDir(), '/')
720     taskName = dir[len(dir)-2]
721    
722     xml.write(str(title))
723     xml.write('<task name="' +str(taskName)+'">\n')
724     xml.write(jt_string)
725 spiga 1.88
726     if (to_write != ''):
727     xml.write('<extraTags\n')
728     xml.write(to_write)
729     xml.write('/>\n')
730     pass
731 slacapra 1.81
732     xml.write('<iterator>\n')
733     xml.write('\t<iteratorRule name="ITR1">\n')
734     xml.write('\t\t<ruleElement> 1:'+ str(nj) + ' </ruleElement>\n')
735     xml.write('\t</iteratorRule>\n')
736     xml.write('\t<iteratorRule name="ITR2">\n')
737     for arg in argsList:
738     xml.write('\t\t<ruleElement> <![CDATA[\n'+ arg + '\n\t\t]]> </ruleElement>\n')
739     pass
740     xml.write('\t</iteratorRule>\n')
741     #print jobList
742     xml.write('\t<iteratorRule name="ITR3">\n')
743     xml.write('\t\t<ruleElement> 1:'+ str(nj) + ':1:6 </ruleElement>\n')
744     xml.write('\t</iteratorRule>\n')
745    
746     '''
747 spiga 1.88 indy: here itr4
748 slacapra 1.81 '''
749    
750 fanzago 1.14
751 slacapra 1.81 xml.write('<chain scheduler="'+str(self.schedulerName)+'">\n')
752     xml.write(jt_string)
753 fanzago 1.14
754 slacapra 1.81 #executable
755 nsmirnov 1.1
756 slacapra 1.81 """
757     INDY
758 spiga 1.88 script depends on jobType: it should be probably get in a different way
759 slacapra 1.81 """
760 nsmirnov 1.1 script = job.scriptFilename()
761 slacapra 1.81 xml.write('<program>\n')
762     xml.write('<exec> ' + os.path.basename(script) +' </exec>\n')
763     xml.write(jt_string)
764    
765    
766 fanzago 1.14 ### only one .sh JDL has arguments:
767 gutsche 1.56 ### Fabio
768 slacapra 1.81 # xml.write('args = "' + str(nj+1)+' '+ jbt.getJobTypeArguments(nj, "EDG") +'"\n')
769     xml.write('<args> <![CDATA[\n _ITR2_ \n]]> </args>\n')
770     xml.write('<program_types> crabjob </program_types>\n')
771     inp_box = script + ','
772 nsmirnov 1.1
773     if inp_sandbox != None:
774     for fl in inp_sandbox:
775 slacapra 1.81 inp_box = inp_box + '' + fl + ','
776 nsmirnov 1.1 pass
777     pass
778    
779 slacapra 1.81 inp_box = inp_box + os.path.abspath(os.environ['CRABDIR']+'/python/'+'report.py') + ',' +\
780     os.path.abspath(os.environ['CRABDIR']+'/python/'+'DashboardAPI.py') + ','+\
781     os.path.abspath(os.environ['CRABDIR']+'/python/'+'Logger.py') + ','+\
782     os.path.abspath(os.environ['CRABDIR']+'/python/'+'ProcInfo.py') + ','+\
783 gutsche 1.96 os.path.abspath(os.environ['CRABDIR']+'/python/'+'apmon.py') + ','+\
784     os.path.abspath(os.environ['CRABDIR']+'/python/'+'parseCrabFjr.py')
785 nsmirnov 1.1
786 fanzago 1.40 if (not jbt.additional_inbox_files == []):
787 spiga 1.82 inp_box = inp_box + ','
788 fanzago 1.40 for addFile in jbt.additional_inbox_files:
789     addFile = os.path.abspath(addFile)
790 slacapra 1.81 inp_box = inp_box+''+addFile+','
791 fanzago 1.40 pass
792 nsmirnov 1.1
793     if inp_box[-1] == ',' : inp_box = inp_box[:-1]
794 slacapra 1.81 inp_box = '<infiles> <![CDATA[\n' + inp_box + '\n]]> </infiles>\n'
795     xml.write(inp_box)
796    
797     base = jbt.name()
798     stdout = base + '__ITR3_.stdout'
799     stderr = base + '__ITR3_.stderr'
800 fanzago 1.14
801 slacapra 1.81 xml.write('<stderr> ' + stderr + '</stderr>\n')
802     xml.write('<stdout> ' + stdout + '</stdout>\n')
803 fanzago 1.14
804    
805 slacapra 1.81 out_box = stdout + ',' + \
806     stderr + ',.BrokerInfo,'
807    
808     """
809 fanzago 1.30 if int(self.return_data) == 1:
810 fanzago 1.14 if out_sandbox != None:
811     for fl in out_sandbox:
812 slacapra 1.81 out_box = out_box + '' + fl + ','
813 fanzago 1.14 pass
814 nsmirnov 1.1 pass
815     pass
816 slacapra 1.81 """
817 nsmirnov 1.1
818 slacapra 1.81 """
819     INDY
820 spiga 1.88 something similar should be also done for infiles (if it makes sense!)
821     """
822 slacapra 1.81 if int(self.return_data) == 1:
823     for fl in jbt.output_file:
824     out_box = out_box + '' + jbt.numberFile_(fl, '_ITR1_') + ','
825 fanzago 1.48 pass
826 slacapra 1.81 pass
827 slacapra 1.62
828 slacapra 1.81 if out_box[-1] == ',' : out_box = out_box[:-1]
829     out_box = '<outfiles> <![CDATA[\n' + out_box + '\n]]></outfiles>\n'
830     xml.write(out_box)
831    
832     xml.write('<BossAttr> crabjob.INTERNAL_ID=_ITR1_ </BossAttr>\n')
833 fanzago 1.48
834 slacapra 1.81 xml.write('</program>\n')
835     xml.write('</chain>\n')
836 nsmirnov 1.1
837 slacapra 1.81 xml.write('</iterator>\n')
838     xml.write('</task>\n')
839 slacapra 1.51
840 slacapra 1.81 xml.close()
841 spiga 1.88
842    
843 nsmirnov 1.1 return
844 slacapra 1.18
845     def checkProxy(self):
846     """
847     Function to check the Globus proxy.
848     """
849     if (self.proxyValid): return
850     timeleft = -999
851 slacapra 1.50 minTimeLeft=10*3600 # in seconds
852 slacapra 1.51
853     minTimeLeftServer = 100 # in hours
854    
855 slacapra 1.50 mustRenew = 0
856 fanzago 1.69 timeLeftLocal = runCommand('voms-proxy-info -timeleft 2>/dev/null')
857 slacapra 1.50 timeLeftServer = -999
858 fanzago 1.53 if not timeLeftLocal or int(timeLeftLocal) <= 0 or not isInt(timeLeftLocal):
859 slacapra 1.50 mustRenew = 1
860     else:
861 fanzago 1.69 timeLeftServer = runCommand('voms-proxy-info -actimeleft 2>/dev/null | head -1')
862 slacapra 1.50 if not timeLeftServer or not isInt(timeLeftServer):
863     mustRenew = 1
864 slacapra 1.54 elif timeLeftLocal<minTimeLeft or timeLeftServer<minTimeLeft:
865 slacapra 1.50 mustRenew = 1
866     pass
867     pass
868    
869 slacapra 1.51 if mustRenew:
870 gutsche 1.94 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")
871 spiga 1.91 cmd = 'voms-proxy-init -voms '+self.VO
872     if self.group:
873     cmd += ':/'+self.VO+'/'+self.group
874 slacapra 1.79 if self.role:
875 spiga 1.91 cmd += '/role='+self.role
876 gutsche 1.94 cmd += ' -valid 192:00'
877 slacapra 1.18 try:
878 slacapra 1.32 # SL as above: damn it!
879 spiga 1.91 common.logger.debug(10,cmd)
880 slacapra 1.19 out = os.system(cmd)
881     if (out>0): raise CrabException("Unable to create a valid proxy!\n")
882 slacapra 1.18 except:
883     msg = "Unable to create a valid proxy!\n"
884     raise CrabException(msg)
885     pass
886 slacapra 1.51
887     ## now I do have a voms proxy valid, and I check the myproxy server
888     renewProxy = 0
889     cmd = 'myproxy-info -d -s '+self.proxyServer
890     cmd_out = runCommand(cmd,0,20)
891     if not cmd_out:
892     common.logger.message('No credential delegated to myproxy server '+self.proxyServer+' will do now')
893     renewProxy = 1
894     else:
895     # if myproxy exist but not long enough, renew
896     reTime = re.compile( r'timeleft: (\d+)' )
897     #print "<"+str(reTime.search( cmd_out ).group(1))+">"
898     if reTime.match( cmd_out ):
899     time = reTime.search( line ).group(1)
900     if time < minTimeLeftServer:
901     renewProxy = 1
902     common.logger.message('No credential delegation will expire in '+time+' hours: renew it')
903     pass
904     pass
905    
906     # if not, create one.
907     if renewProxy:
908     cmd = 'myproxy-init -d -n -s '+self.proxyServer
909     out = os.system(cmd)
910     if (out>0):
911 fanzago 1.53 raise CrabException("Unable to delegate the proxy to myproxyserver "+self.proxyServer+" !\n")
912 slacapra 1.51 pass
913    
914     # cache proxy validity
915 slacapra 1.18 self.proxyValid=1
916     return
917 spiga 1.49
918 slacapra 1.18 def configOpt_(self):
919     edg_ui_cfg_opt = ' '
920     if self.edg_config:
921 slacapra 1.51 edg_ui_cfg_opt = ' -c ' + self.edg_config + ' '
922 slacapra 1.18 if self.edg_config_vo:
923 slacapra 1.51 edg_ui_cfg_opt += ' --config-vo ' + self.edg_config_vo + ' '
924 slacapra 1.18 return edg_ui_cfg_opt