ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CRAB/python/SchedulerEdg.py
(Generate patch)

Comparing COMP/CRAB/python/SchedulerEdg.py (file contents):
Revision 1.7 by slacapra, Mon Jul 25 14:31:24 2005 UTC vs.
Revision 1.71 by fanzago, Thu Jul 6 13:45:57 2006 UTC

# Line 2 | Line 2 | from Scheduler import Scheduler
2   from crab_logger import Logger
3   from crab_exceptions import *
4   from crab_util import *
5 + from EdgConfig import *
6   import common
7  
8 < import os, sys, tempfile
8 > import os, sys, time
9  
10   class SchedulerEdg(Scheduler):
11      def __init__(self):
12          Scheduler.__init__(self,"EDG")
13 +        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          return
22  
23      def configure(self, cfg_params):
24  
25 <        try: self.edg_ui_cfg = cfg_params["EDG.rb_config"]
26 <        except KeyError: self.edg_ui_cfg = ''
27 <
28 <        try: self.edg_config = cfg_params["EDG.config"]
29 <        except KeyError: self.edg_config = ''
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()
30 >        except KeyError:
31 >            self.edg_config = ''
32 >            self.edg_config_vo = ''
33  
34 <        try: self.edg_config_vo = cfg_params["EDG.config_vo"]
35 <        except KeyError: self.edg_config_vo = ''
34 >        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  
40          try: self.LCG_version = cfg_params["EDG.lcg_version"]
41          except KeyError: self.LCG_version = '2'
# Line 31 | Line 46 | class SchedulerEdg(Scheduler):
46          try: self.EDG_retry_count = cfg_params['EDG.retry_count']
47          except KeyError: self.EDG_retry_count = ''
48  
49 +        try:
50 +            self.EDG_ce_black_list = cfg_params['EDG.ce_black_list']
51 +            #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']
57 +            #print "self.EDG_ce_white_list = ", self.EDG_ce_white_list
58 +        except KeyError: self.EDG_ce_white_list = ''
59 +
60 +        try: self.VO = cfg_params['EDG.virtual_organization']
61 +        except KeyError: self.VO = 'cms'
62 +
63 +        try: self.return_data = cfg_params['USER.return_data']
64 +        except KeyError: self.return_data = 1
65 +
66 +        try:
67 +             self.copy_input_data = common.analisys_common_info['copy_input_data']
68 +             #print "self.copy_input_data = ", self.copy_input_data
69 +        except KeyError: self.copy_input_data = 0
70 +
71 +        try:
72 +            self.copy_data = cfg_params["USER.copy_data"]
73 +            if int(self.copy_data) == 1:
74 +                try:
75 +                    self.SE = cfg_params['USER.storage_element']
76 +                    self.SE_PATH = cfg_params['USER.storage_path']
77 +                except KeyError:
78 +                    msg = "Error. The [USER] section does not have 'storage_element'"
79 +                    msg = msg + " and/or 'storage_path' entries, necessary to copy the output"
80 +                    common.logger.message(msg)
81 +                    raise CrabException(msg)
82 +        except KeyError: self.copy_data = 0
83 +
84 +        if ( int(self.return_data) == 0 and int(self.copy_data) == 0 ):
85 +           msg = 'Warning: return_data = 0 and copy_data = 0 ==> your exe output will be lost\n'
86 +           msg = msg + 'Please modify return_data and copy_data value in your crab.cfg file\n'
87 +           raise CrabException(msg)
88 +
89 +        try:
90 +            self.lfc_host = cfg_params['EDG.lfc_host']
91 +        except KeyError:
92 +            msg = "Error. The [EDG] section does not have 'lfc_host' value"
93 +            msg = msg + " it's necessary to know the LFC host name"
94 +            common.logger.message(msg)
95 +            raise CrabException(msg)
96 +        try:
97 +            self.lcg_catalog_type = cfg_params['EDG.lcg_catalog_type']
98 +        except KeyError:
99 +            msg = "Error. The [EDG] section does not have 'lcg_catalog_type' value"
100 +            msg = msg + " it's necessary to know the catalog type"
101 +            common.logger.message(msg)
102 +            raise CrabException(msg)
103          try:
104 <            self.VO = cfg_params['EDG.virtual_organization']
104 >            self.lfc_home = cfg_params['EDG.lfc_home']
105          except KeyError:
106 <            msg = 'EDG.virtual_organization is mandatory.'
106 >            msg = "Error. The [EDG] section does not have 'lfc_home' value"
107 >            msg = msg + " it's necessary to know the home catalog dir"
108 >            common.logger.message(msg)
109              raise CrabException(msg)
110 +      
111 +        try:
112 +            self.register_data = cfg_params["USER.register_data"]
113 +            if int(self.register_data) == 1:
114 +                try:
115 +                    self.LFN = cfg_params['USER.lfn_dir']
116 +                except KeyError:
117 +                    msg = "Error. The [USER] section does not have 'lfn_dir' value"
118 +                    msg = msg + " it's necessary for LCF registration"
119 +                    common.logger.message(msg)
120 +                    raise CrabException(msg)
121 +        except KeyError: self.register_data = 0
122 +
123 +        if ( int(self.copy_data) == 0 and int(self.register_data) == 1 ):
124 +           msg = 'Warning: register_data = 1 must be used with copy_data = 1\n'
125 +           msg = msg + 'Please modify copy_data value in your crab.cfg file\n'
126 +           common.logger.message(msg)
127 +           raise CrabException(msg)
128  
129 <        
130 <        #self.scripts_dir = common.bin_dir + '/scripts'
131 <        #self.cmd_prefix = 'edg'
132 <        #if common.LCG_version == '0' : self.cmd_prefix = 'dg'
129 >        try: self.EDG_requirements = cfg_params['EDG.requirements']
130 >        except KeyError: self.EDG_requirements = ''
131 >                                                                                                                                                            
132 >        try: self.EDG_retry_count = cfg_params['EDG.retry_count']
133 >        except KeyError: self.EDG_retry_count = ''
134 >                                                                                                                                                            
135 >        try: self.EDG_clock_time = cfg_params['EDG.max_wall_clock_time']
136 >        except KeyError: self.EDG_clock_time= ''
137 >                                                                                                                                                            
138 >        try: self.EDG_cpu_time = cfg_params['EDG.max_cpu_time']
139 >        except KeyError: self.EDG_cpu_time = ''
140  
141          # Add EDG_WL_LOCATION to the python path
142  
# Line 55 | Line 151 | class SchedulerEdg(Scheduler):
151          libPath=os.path.join(path, "lib", "python")
152          sys.path.append(libPath)
153  
154 <        self.checkProxy_()
154 >        self.proxyValid=0
155 >
156 >        try:
157 >            self._taskId = cfg_params['taskId']
158 >        except:
159 >            self._taskId = ''
160 >
161          return
162      
163 +
164 +    def sched_parameter(self):
165 +        """
166 +        Returns file with scheduler-specific parameters
167 +        """
168 +      
169 +        if (self.edg_config and self.edg_config_vo != ''):
170 +            self.param='sched_param.clad'
171 +            param_file = open(common.work_space.shareDir()+'/'+self.param, 'w')
172 +            param_file.write('RBconfig = "'+self.edg_config+'";\n')  
173 +            param_file.write('RBconfigVO = "'+self.edg_config_vo+'";')
174 +            param_file.close()  
175 +            return 1
176 +        else:
177 +            return 0
178 +
179      def wsSetupEnvironment(self):
180          """
181          Returns part of a job script which does scheduler-specific work.
182          """
183 <        txt = '\n'
184 <        txt += 'CloseCEs=`edg-brokerinfo getCE`\n'
185 <        txt += 'echo "CloseCEs = $CloseCEs"\n'
186 <        txt += 'CE=`echo $CloseCEs | sed -e "s/:.*//"`\n'
187 <        txt += 'echo "CE = $CE"\n'
183 >        txt = ''
184 >        txt += "# job number (first parameter for job wrapper)\n"
185 >        txt += "NJob=$1\n"
186 >
187 >        txt += '# job identification to DashBoard \n'
188 >        txt += 'MonitorJobID=`echo ${NJob}_$EDG_WL_JOBID`\n'
189 >        txt += 'SyncGridJobId=`echo $EDG_WL_JOBID`\n'
190 >        txt += 'MonitorID=`echo ' + self._taskId + '`\n'
191 >        txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
192 >        txt += 'echo "SyncGridJobId=`echo $SyncGridJobId`" | tee -a $RUNTIME_AREA/$repo \n'
193 >        txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
194 >
195 >        txt += 'echo "middleware discovery " \n'
196 >        txt += 'if [ $VO_CMS_SW_DIR ]; then \n'
197 >        txt += '    middleware=LCG \n'
198 >        txt += '    echo "SyncCE=`edg-brokerinfo getCE`" | tee -a $RUNTIME_AREA/$repo \n'
199 >        txt += '    echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
200 >        txt += '    echo "middleware =$middleware" \n'
201 >        txt += 'elif [ $GRID3_APP_DIR ]; then\n'
202 >        txt += '    middleware=OSG \n'
203 >        txt += '    echo "SyncCE=`echo $EDG_WL_LOG_DESTINATION`" | tee -a $RUNTIME_AREA/$repo \n'
204 >        txt += '    echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
205 >        txt += '    echo "middleware =$middleware" \n'
206 >        txt += 'elif [ $OSG_APP ]; then \n'
207 >        txt += '    middleware=OSG \n'
208 >        txt += '    echo "SyncCE=`echo $EDG_WL_LOG_DESTINATION`" | tee -a $RUNTIME_AREA/$repo \n'
209 >        txt += '    echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
210 >        txt += '    echo "middleware =$middleware" \n'
211 >        txt += 'else \n'
212 >        txt += '    echo "SET_CMS_ENV 10030 ==> middleware not identified" \n'
213 >        txt += '    echo "JOB_EXIT_STATUS = 10030" \n'
214 >        txt += '    echo "JobExitCode=10030" | tee -a $RUNTIME_AREA/$repo \n'
215 >        txt += '    dumpStatus $RUNTIME_AREA/$repo \n'
216 >        txt += '    rm -f $RUNTIME_AREA/$repo \n'
217 >        txt += '    echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
218 >        txt += '    echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
219 >        txt += '    exit 1 \n'
220 >        txt += 'fi \n'
221 >
222 >        txt += '# report first time to DashBoard \n'
223 >        txt += 'dumpStatus $RUNTIME_AREA/$repo \n'
224 >        txt += 'rm -f $RUNTIME_AREA/$repo \n'
225 >        txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
226 >        txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
227 >        
228 >        txt += '\n\n'
229 >
230 >        if int(self.copy_data) == 1:
231 >           if self.SE:
232 >              txt += 'export SE='+self.SE+'\n'
233 >              txt += 'echo "SE = $SE"\n'
234 >           if self.SE_PATH:
235 >              if ( self.SE_PATH[-1] != '/' ) : self.SE_PATH = self.SE_PATH + '/'
236 >              txt += 'export SE_PATH='+self.SE_PATH+'\n'
237 >              txt += 'echo "SE_PATH = $SE_PATH"\n'
238 >
239 >        txt += 'export VO='+self.VO+'\n'
240 >        ### FEDE: add some line for LFC catalog setting
241 >        txt += 'if [ $middleware == LCG ]; then \n'
242 >        txt += '    if [[ $LCG_CATALOG_TYPE != \''+self.lcg_catalog_type+'\' ]]; then\n'
243 >        txt += '        export LCG_CATALOG_TYPE='+self.lcg_catalog_type+'\n'
244 >        txt += '    fi\n'
245 >        txt += '    if [[ $LFC_HOST != \''+self.lfc_host+'\' ]]; then\n'
246 >        txt += '        export LFC_HOST='+self.lfc_host+'\n'
247 >        txt += '    fi\n'
248 >        txt += '    if [[ $LFC_HOME != \''+self.lfc_home+'\' ]]; then\n'
249 >        txt += '        export LFC_HOME='+self.lfc_home+'\n'
250 >        txt += '    fi\n'
251 >        txt += 'elif [ $middleware == OSG ]; then\n'
252 >        txt += '    echo "LFC catalog setting to be implemented for OSG"\n'
253 >        txt += 'fi\n'
254 >        #####
255 >        if int(self.register_data) == 1:
256 >           txt += 'if [ $middleware == LCG ]; then \n'
257 >           txt += '    export LFN='+self.LFN+'\n'
258 >           txt += '    lfc-ls $LFN\n'
259 >           txt += '    result=$?\n'
260 >           txt += '    echo $result\n'
261 >           ### creation of LFN dir in LFC catalog, under /grid/cms dir  
262 >           txt += '    if [ $result != 0 ]; then\n'
263 >           txt += '       lfc-mkdir $LFN\n'
264 >           txt += '       result=$?\n'
265 >           txt += '       echo $result\n'
266 >           txt += '    fi\n'
267 >           txt += 'elif [ $middleware == OSG ]; then\n'
268 >           txt += '    echo " Files registration to be implemented for OSG"\n'
269 >           txt += 'fi\n'
270 >           txt += '\n'
271 >
272 >           if self.VO:
273 >              txt += 'export VO='+self.VO+'\n'
274 >           if self.LFN:
275 >              txt += 'if [ $middleware == LCG ]; then \n'
276 >              txt += '    export LFN='+self.LFN+'\n'
277 >              txt += 'fi\n'
278 >              txt += '\n'
279 >
280 >        txt += 'if [ $middleware == LCG ]; then\n'
281 >        txt += '    CloseCEs=`edg-brokerinfo getCE`\n'
282 >        txt += '    echo "CloseCEs = $CloseCEs"\n'
283 >        txt += '    CE=`echo $CloseCEs | sed -e "s/:.*//"`\n'
284 >        txt += '    echo "CE = $CE"\n'
285 >        txt += 'elif [ $middleware == OSG ]; then \n'
286 >        txt += '    if [ $OSG_JOB_CONTACT ]; then \n'
287 >        txt += '        CE=`echo $OSG_JOB_CONTACT | /usr/bin/awk -F\/ \'{print $1}\'` \n'
288 >        txt += '    else \n'
289 >        txt += '        echo "SET_CMS_ENV 10099 ==> OSG mode: ERROR in setting CE name from OSG_JOB_CONTACT" \n'
290 >        txt += '        echo "JOB_EXIT_STATUS = 10099" \n'
291 >        txt += '        echo "JobExitCode=10099" | tee -a $RUNTIME_AREA/$repo \n'
292 >        txt += '        dumpStatus $RUNTIME_AREA/$repo \n'
293 >        txt += '        rm -f $RUNTIME_AREA/$repo \n'
294 >        txt += '        echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
295 >        txt += '        echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
296 >        txt += '        exit 1 \n'
297 >        txt += '    fi \n'
298 >        txt += 'fi \n'
299 >
300          return txt
301  
302 <    def loggingInfo(self, nj):
302 >    def wsCopyInput(self):
303 >        """
304 >        Copy input data from SE to WN    
305 >        """
306 >        txt = ''
307 >        try:
308 >            self.copy_input_data = common.analisys_common_info['copy_input_data']
309 >            #print "self.copy_input_data = ", self.copy_input_data
310 >        except KeyError: self.copy_input_data = 0
311 >        if int(self.copy_input_data) == 1:
312 >        ## OLI_Daniele deactivate for OSG (wait for LCG UI installed on OSG)
313 >           txt += 'if [ $middleware == OSG ]; then\n'
314 >           txt += '   #\n'
315 >           txt += '   #   Copy Input Data from SE to this WN deactivated in OSG mode\n'
316 >           txt += '   #\n'
317 >           txt += '   echo "Copy Input Data from SE to this WN deactivated in OSG mode"\n'
318 >           txt += 'elif [ $middleware == LCG ]; then \n'
319 >           txt += '   #\n'
320 >           txt += '   #   Copy Input Data from SE to this WN\n'
321 >           txt += '   #\n'
322 > ### changed by georgia (put a loop copying more than one input files per jobs)          
323 >           txt += '   for input_file in $cur_file_list \n'
324 >           txt += '   do \n'
325 >           #### FEDE
326 >           #txt += '      echo "which lcg-cp" \n'
327 >           #txt += '      which lcg-cp \n'
328 >           #########
329 >           txt += '      lcg-cp --vo $VO --verbose -t 1200 lfn:$input_lfn/$input_file file:`pwd`/$input_file 2>&1\n'
330 >           txt += '      copy_input_exit_status=$?\n'
331 >           txt += '      echo "COPY_INPUT_EXIT_STATUS = $copy_input_exit_status"\n'
332 >           txt += '      if [ $copy_input_exit_status -ne 0 ]; then \n'
333 >           txt += '         echo "Problems with copying to WN" \n'
334 >           txt += '      else \n'
335 >           txt += '         echo "input copied into WN" \n'
336 >           txt += '      fi \n'
337 >           txt += '   done \n'
338 > ### copy a set of PU ntuples (same for each jobs -- but accessed randomly)
339 >           txt += '   for file in $cur_pu_list \n'
340 >           txt += '   do \n'
341 >           #### FEDE
342 >           #txt += '      echo "which lcg-cp" \n'
343 >           #txt += '      which lcg-cp \n'
344 >           #########
345 >           txt += '      lcg-cp --vo $VO --verbose -t 1200 lfn:$pu_lfn/$file file:`pwd`/$file 2>&1\n'
346 >           txt += '      copy_input_exit_status=$?\n'
347 >           txt += '      echo "COPY_INPUT_PU_EXIT_STATUS = $copy_input_pu_exit_status"\n'
348 >           txt += '      if [ $copy_input_pu_exit_status -ne 0 ]; then \n'
349 >           txt += '         echo "Problems with copying pu to WN" \n'
350 >           txt += '      else \n'
351 >           txt += '         echo "input pu files copied into WN" \n'
352 >           txt += '      fi \n'
353 >           txt += '   done \n'
354 >           txt += '   \n'
355 >           txt += '   ### Check SCRATCH space available on WN : \n'
356 >           txt += '   df -h \n'
357 >           txt += 'fi \n'
358 >          
359 >        return txt
360 >
361 >    def wsCopyOutput(self):
362 >        """
363 >        Write a CopyResults part of a job script, e.g.
364 >        to copy produced output into a storage element.
365 >        """
366 >        txt = ''
367 >        if int(self.copy_data) == 1:
368 >           txt += '#\n'
369 >           txt += '#   Copy output to SE = $SE\n'
370 >           txt += '#\n'
371 >           #txt += 'if [ $exe_result -eq 0 ]; then\n'
372 >           txt += '    for out_file in $file_list ; do\n'
373 >           txt += '        echo "Trying to copy output file to $SE "\n'
374 >           ## OLI_Daniele globus-* for OSG, lcg-* for LCG
375 >           txt += '        if [ $middleware == OSG ]; then\n'
376 >           txt += '           echo "globus-url-copy file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1"\n'
377 >           txt += '           globus-url-copy file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1 \n'
378 >           txt += '           copy_exit_status=$? \n'
379 >           txt += '        elif [ $middleware == LCG ]; then \n'
380 >           #txt += '           echo "#######################################" \n'
381 >           #txt += '           echo "#######################################" \n'
382 >           #txt += '           echo "directory: " \n'
383 >           #txt += '           pwd \n'
384 >           #txt += '           echo "files:" \n'
385 >           #txt += '           ls \n'
386 >           #txt += '           echo "#######################################" \n'
387 >           #txt += '           echo "#######################################" \n'
388 >           #### FEDE
389 >           #txt += '           echo "which lcg-cp" \n'
390 >           #txt += '           which lcg-cp \n'
391 >           #########
392 >           txt += '           echo "lcg-cp --vo $VO --verbose -t 1200 file://$RUNTIME_AREA/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1"\n'
393 >           txt += '           lcg-cp --vo $VO --verbose -t 1200 file://$RUNTIME_AREA/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1\n'
394 >           txt += '           copy_exit_status=$? \n'
395 >           txt += '        fi \n'
396 >           txt += '        echo "COPY_EXIT_STATUS = $copy_exit_status"\n'
397 >           txt += '        echo "STAGE_OUT = $copy_exit_status"\n'
398 >           txt += '        exit_status=$copy_exit_status\n'
399 >           txt += '        if [ $copy_exit_status -ne 0 ]; then\n'
400 >           txt += '            echo "Problems with SE = $SE"\n'
401 >           txt += '            echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n'
402 >           txt += '            echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n'
403 >           txt += '        else\n'
404 >           txt += '            echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n'
405 >           txt += '            echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n'
406 >           txt += '            echo "output copied into $SE/$SE_PATH directory"\n'
407 >           txt += '            echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n'
408 >           txt += '         fi\n'
409 >           txt += '     done\n'
410 >           #txt += 'fi\n'
411 >        return txt
412 >
413 >    def wsRegisterOutput(self):
414 >        """
415 >        Returns part of a job script which does scheduler-specific work.
416 >        """
417 >
418 >        txt = ''
419 >        if int(self.register_data) == 1:
420 >        ## OLI_Daniele deactivate for OSG (wait for LCG UI installed on OSG)
421 >           txt += 'if [ $middleware == OSG ]; then\n'
422 >           txt += '   #\n'
423 >           txt += '   #   Register output to LFC deactivated in OSG mode\n'
424 >           txt += '   #\n'
425 >           txt += '   echo "Register output to LFC deactivated in OSG mode"\n'
426 >           txt += 'elif [ $middleware == LCG ]; then \n'
427 >           txt += '#\n'
428 >           txt += '#  Register output to LFC\n'
429 >           txt += '#\n'
430 >           #txt += '   if [[ $exe_result -eq 0 && $copy_exit_status -eq 0 ]]; then\n'
431 >           txt += '   if [ $copy_exit_status -eq 0 ]; then\n'
432 >           txt += '      for out_file in $file_list ; do\n'
433 >           txt += '         echo "Trying to register the output file into LFC"\n'
434 >           #### FEDE
435 >           #txt += '         echo "which lcg-rf" \n'
436 >           #txt += '         which lcg-rf \n'
437 >           #########
438 >           txt += '         echo "lcg-rf -l $LFN/$out_file --vo $VO -t 1200 sfn://$SE$SE_PATH/$out_file 2>&1"\n'
439 >           txt += '         lcg-rf -l $LFN/$out_file --vo $VO -t 1200 sfn://$SE$SE_PATH/$out_file 2>&1 \n'
440 >           txt += '         register_exit_status=$?\n'
441 >           txt += '         echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
442 >           txt += '         echo "STAGE_OUT = $register_exit_status"\n'
443 >           txt += '         if [ $register_exit_status -ne 0 ]; then \n'
444 >           txt += '            echo "Problems with the registration to LFC" \n'
445 >           txt += '            echo "Try with srm protocol" \n'
446 >           #### FEDE
447 >           #txt += '            echo "which lcg-rf" \n'
448 >           #txt += '            which lcg-rf \n'
449 >           #########
450 >           txt += '            echo "lcg-rf -l $LFN/$out_file --vo $VO -t 1200 srm://$SE$SE_PATH/$out_file 2>&1"\n'
451 >           txt += '            lcg-rf -l $LFN/$out_file --vo $VO -t 1200 srm://$SE$SE_PATH/$out_file 2>&1 \n'
452 >           txt += '            register_exit_status=$?\n'
453 >           txt += '            echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
454 >           txt += '            echo "STAGE_OUT = $register_exit_status"\n'
455 >           txt += '            if [ $register_exit_status -ne 0 ]; then \n'
456 >           txt += '               echo "Problems with the registration into LFC" \n'
457 >           txt += '            fi \n'
458 >           txt += '         else \n'
459 >           txt += '            echo "output registered to LFC"\n'
460 >           txt += '         fi \n'
461 >           txt += '         echo "StageOutExitStatus = $register_exit_status" | tee -a $RUNTIME_AREA/$repo\n'
462 >           txt += '      done\n'
463 >           #txt += '   elif [[ $exe_result -eq 0 && $copy_exit_status -ne 0 ]]; then \n'
464 >           txt += '   else \n'
465 >           txt += '      echo "Trying to copy output file to CloseSE"\n'
466 >           txt += '      CLOSE_SE=`edg-brokerinfo getCloseSEs | head -1`\n'
467 >           txt += '      for out_file in $file_list ; do\n'
468 >           #### FEDE
469 >           #txt += '         echo "which lcg-cr" \n'
470 >           #txt += '         which lcg-cr \n'
471 >           #########
472 >           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'
473 >           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'
474 >           txt += '         register_exit_status=$?\n'
475 >           txt += '         echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
476 >           txt += '         echo "STAGE_OUT = $register_exit_status"\n'
477 >           txt += '         if [ $register_exit_status -ne 0 ]; then \n'
478 >           txt += '            echo "Problems with CloseSE or Catalog" \n'
479 >           txt += '         else \n'
480 >           txt += '            echo "The program was successfully executed"\n'
481 >           txt += '            echo "SE = $CLOSE_SE"\n'
482 >           txt += '            echo "LFN for the file is LFN=${LFN}/$out_file"\n'
483 >           txt += '         fi \n'
484 >           txt += '         echo "StageOutExitStatus = $register_exit_status" | tee -a $RUNTIME_AREA/$repo\n'
485 >           txt += '      done\n'
486 >           #txt += '   else\n'
487 >           #txt += '      echo "Problem with the executable"\n'
488 >           txt += '   fi \n'
489 >           txt += '   exit_status=$register_exit_status\n'
490 >           txt += 'fi \n'
491 >        return txt
492 >
493 >    def loggingInfo(self, id):
494          """
495          retrieve the logging info from logging and bookkeeping and return it
496          """
497 <        id = common.jobDB.jobId(nj)
498 <        edg_ui_cfg_opt = ''
499 <        if self.edg_config:
500 <          edg_ui_cfg_opt = ' -c ' + self.edg_config + ' '
80 <        cmd = 'edg-job-get-logging-info -v 2 ' + edg_ui_cfg_opt + id
81 <        print cmd
82 <        myCmd = os.popen(cmd)
83 <        cmd_out = myCmd.readlines()
84 <        myCmd.close()
497 >        self.checkProxy()
498 >        cmd = 'edg-job-get-logging-info -v 2 ' + id
499 >        #cmd_out = os.popen(cmd)
500 >        cmd_out = runCommand(cmd)
501          return cmd_out
502  
503      def listMatch(self, nj):
504          """
505          Check the compatibility of available resources
506          """
507 +        self.checkProxy()
508          jdl = common.job_list[nj].jdlFilename()
509 <        edg_ui_cfg_opt = ''
510 <        if self.edg_config:
511 <          edg_ui_cfg_opt = ' -c ' + self.edg_config + ' '
512 <        if self.edg_config_vo:
513 <          edg_ui_cfg_opt += ' --config-vo ' + self.edg_config_vo + ' '
97 <        cmd = 'edg-job-list-match ' + edg_ui_cfg_opt + jdl
98 <        myCmd = os.popen(cmd)
99 <        cmd_out = myCmd.readlines()
100 <        myCmd.close()
509 >        cmd = 'edg-job-list-match ' + self.configOpt_() + jdl
510 >        cmd_out = runCommand(cmd,0,10)
511 >        if not cmd_out:
512 >            raise CrabException("ERROR: "+cmd+" failed!")
513 >
514          return self.parseListMatch_(cmd_out, jdl)
515  
516      def parseListMatch_(self, out, jdl):
517 +        """
518 +        Parse the f* output of edg-list-match and produce something sensible
519 +        """
520          reComment = re.compile( r'^\**$' )
521          reEmptyLine = re.compile( r'^$' )
522          reVO = re.compile( r'Selected Virtual Organisation name.*' )
523 <        reCE = re.compile( r'CEId' )
523 >        reLine = re.compile( r'.*')
524 >        reCE = re.compile( r'(.*:.*)')
525 >        reCEId = re.compile( r'CEId.*')
526          reNO = re.compile( r'No Computing Element matching' )
527          reRB = re.compile( r'Connecting to host' )
528          next = 0
529          CEs=[]
530          Match=0
531 <        for line in out:
532 <            line = line.strip()
531 >
532 >        #print out
533 >        lines = reLine.findall(out)
534 >
535 >        i=0
536 >        CEs=[]
537 >        for line in lines:
538 >            string.strip(line)
539              #print line
540 <            if reComment.match( line ):
541 <                next = 0
542 <                continue
543 <            if reEmptyLine.match(line):
120 <                continue
540 >            if reNO.match( line ):
541 >                common.logger.debug(5,line)
542 >                return 0
543 >                pass
544              if reVO.match( line ):
545 <                VO =line.split()[-1]
546 <                common.logger.debug(5, 'VO           :'+VO)
545 >                VO =reVO.match( line ).group()
546 >                common.logger.debug(5,"VO "+VO)
547                  pass
548 +
549              if reRB.match( line ):
550 <                RB =line.split()[3]
551 <                common.logger.debug(5, 'Using RB     :'+RB)
550 >                RB = reRB.match(line).group()
551 >                common.logger.debug(5,"RB "+RB)
552                  pass
553 <            if reCE.search( line ):
554 <                next = 1
555 <                continue
556 <            if next:
557 <                CE=line.split(':')[0]
558 <                CEs.append(CE)
559 <                common.logger.debug(5, 'Matched CE   :'+CE)
560 <                Match=Match+1
137 <                pass
138 <            if reNO.match( line ):
139 <                common.logger.debug(5,line)
140 <                self.noMatchFound_(jdl)
141 <                Match=0
553 >
554 >            if reCEId.search( line ):
555 >                for lineCE in lines[i:-1]:
556 >                    if reCE.match( lineCE ):
557 >                        CE = string.strip(reCE.search(lineCE).group(1))
558 >                        CEs.append(CE.split(':')[0])
559 >                        pass
560 >                    pass
561                  pass
562 <        return Match
562 >            i=i+1
563 >            pass
564 >
565 >        common.logger.debug(5,"All CE :"+str(CEs))
566 >
567 >        sites = []
568 >        [sites.append(it) for it in CEs if not sites.count(it)]
569 >
570 >        common.logger.debug(5,"All Sites :"+str(sites))
571 >        common.logger.message("Matched Sites :"+str(sites))
572 >        return len(sites)
573  
574      def noMatchFound_(self, jdl):
575          reReq = re.compile( r'Requirements' )
# Line 166 | Line 595 | class SchedulerEdg(Scheduler):
595          Submit one EDG job.
596          """
597  
598 +        self.checkProxy()
599          jid = None
600          jdl = common.job_list[nj].jdlFilename()
601 <        id_tmp = tempfile.mktemp()
602 <        edg_ui_cfg_opt = ' '
173 <        if self.edg_config:
174 <          edg_ui_cfg_opt = ' -c ' + self.edg_config + ' '
175 <        if self.edg_config_vo:
176 <          edg_ui_cfg_opt += ' --config-vo ' + self.edg_config_vo + ' '
177 <        cmd = 'edg-job-submit -o ' + id_tmp + edg_ui_cfg_opt + jdl
601 >
602 >        cmd = 'edg-job-submit ' + self.configOpt_() + jdl
603          cmd_out = runCommand(cmd)
604          if cmd_out != None:
605 <            idfile = open(id_tmp)
606 <            jid_line = idfile.readline()
182 <            while jid_line[0] == '#':
183 <                jid_line = idfile.readline()
184 <                pass
185 <            jid = string.strip(jid_line)
186 <            os.unlink(id_tmp)
605 >            reSid = re.compile( r'https.+' )
606 >            jid = reSid.search(cmd_out).group()
607              pass
608          return jid
609  
610 +    def resubmit(self, nj_list):
611 +        """
612 +        Prepare jobs to be submit
613 +        """
614 +        return
615 +
616 +    def getExitStatus(self, id):
617 +        return self.getStatusAttribute_(id, 'exit_code')
618 +
619      def queryStatus(self, id):
620 +        return self.getStatusAttribute_(id, 'status')
621 +
622 +    def queryDest(self, id):  
623 +        return self.getStatusAttribute_(id, 'destination')
624 +
625 +
626 +    def getStatusAttribute_(self, id, attr):
627          """ Query a status of the job with id """
628 <        cmd0 = 'edg-job-status '
629 <        cmd = cmd0 + id
630 <        cmd_out = runCommand(cmd)
631 <        if cmd_out == None:
632 <            common.logger.message('Error. No output from `'+cmd+'`')
633 <            return None
634 <        # parse output
635 <        status_prefix = 'Current Status:'
636 <        status_index = string.find(cmd_out, status_prefix)
637 <        if status_index == -1:
638 <            common.logger.message('Error. Bad output of `'+cmd0+'`:\n'+cmd_out)
628 >
629 >        self.checkProxy()
630 >        hstates = {}
631 >        Status = importName('edg_wl_userinterface_common_LbWrapper', 'Status')
632 >        # Bypass edg-job-status interfacing directly to C++ API
633 >        # Job attribute vector to retrieve status without edg-job-status
634 >        level = 0
635 >        # Instance of the Status class provided by LB API
636 >        jobStat = Status()
637 >        st = 0
638 >        jobStat.getStatus(id, level)
639 >        err, apiMsg = jobStat.get_error()
640 >        if err:
641 >            common.logger.debug(5,'Error caught' + apiMsg)
642              return None
643 <        status = cmd_out[(status_index+len(status_prefix)):]
644 <        nl = string.find(status,'\n')
645 <        status = string.strip(status[0:nl])
646 <        return status
643 >        else:
644 >            for i in range(len(self.states)):
645 >                # Fill an hash table with all information retrieved from LB API
646 >                hstates[ self.states[i] ] = jobStat.loadStatus(st)[i]
647 >            result = jobStat.loadStatus(st)[ self.states.index(attr) ]
648 >            return result
649  
650      def queryDetailedStatus(self, id):
651          """ Query a detailed status of the job with id """
# Line 218 | Line 659 | class SchedulerEdg(Scheduler):
659          Returns the name of directory with results.
660          """
661  
662 +        self.checkProxy()
663          cmd = 'edg-job-get-output --dir ' + common.work_space.resDir() + ' ' + id
664          cmd_out = runCommand(cmd)
665  
666          # Determine the output directory name
667          dir = common.work_space.resDir()
668 <        dir += os.getlogin()
668 >        dir += os.environ['USER']
669          dir += '_' + os.path.basename(id)
670          return dir
671  
672      def cancel(self, id):
673          """ Cancel the EDG job with id """
674 +        self.checkProxy()
675          cmd = 'edg-job-cancel --noint ' + id
676          cmd_out = runCommand(cmd)
677          return cmd_out
678  
679 <    def checkProxy_(self):
237 <        """
238 <        Function to check the Globus proxy.
239 <        """
240 <        cmd = 'grid-proxy-info -timeleft'
241 <        cmd_out = runCommand(cmd)
242 <        ok = 1
243 <        timeleft = -999
244 <        try: timeleft = int(cmd_out)
245 <        except ValueError: ok=0
246 <        except TypeError: ok=0
247 <        if timeleft < 1:  ok=0
248 <
249 <        if ok==0:
250 <            msg = 'No valid proxy found !\n'
251 <            msg += "Please do 'grid-proxy-init'."
252 <            raise CrabException(msg)
253 <        return
254 <    
255 <    def createJDL(self, nj):
679 >    def createSchScript(self, nj):
680          """
681          Create a JDL-file for EDG.
682          """
683  
684          job = common.job_list[nj]
685          jbt = job.type()
262 #        jbt.loadJobInfo()
686          inp_sandbox = jbt.inputSandbox(nj)
687          out_sandbox = jbt.outputSandbox(nj)
688 <        inp_storage_subdir = ''#jbt.inputStorageSubdir()
688 >        inp_storage_subdir = ''
689          
690          title = '# This JDL was generated by '+\
691                  common.prog_name+' (version '+common.prog_version_str+')\n'
692          jt_string = ''
693 +
694 +
695          
696          SPL = inp_storage_subdir
697          if ( SPL and SPL[-1] != '/' ) : SPL = SPL + '/'
# Line 279 | Line 704 | class SchedulerEdg(Scheduler):
704          jdl.write('Executable = "' + os.path.basename(script) +'";\n')
705          jdl.write(jt_string)
706  
707 +        ### only one .sh  JDL has arguments:
708 +
709 +        ### Fabio
710 +        jdl.write('Arguments = "' + str(nj+1)+' '+ jbt.getJobTypeArguments(nj, "EDG") +'";\n')
711          inp_box = 'InputSandbox = { '
712          inp_box = inp_box + '"' + script + '",'
713  
# Line 291 | Line 720 | class SchedulerEdg(Scheduler):
720          #if common.use_jam:
721          #   inp_box = inp_box+' "'+common.bin_dir+'/'+common.run_jam+'",'
722  
723 <        for addFile in jbt.additional_inbox_files:
724 <            addFile = os.path.abspath(addFile)
725 <            inp_box = inp_box+' "'+addFile+'",'
726 <            pass
723 >        # Marco (VERY TEMPORARY ML STUFF)
724 >        inp_box = inp_box+' "' + os.path.abspath(os.environ['CRABDIR']+'/python/'+'report.py') + '", "' +\
725 >                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'DashboardAPI.py') + '", "'+\
726 >                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'Logger.py') + '", "'+\
727 >                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'ProcInfo.py') + '", "'+\
728 >                  os.path.abspath(os.environ['CRABDIR']+'/python/'+'apmon.py') + '"'
729 >        # End Marco
730 >
731 >        if (not jbt.additional_inbox_files == []):
732 >            inp_box = inp_box + ', '
733 >            for addFile in jbt.additional_inbox_files:
734 >                addFile = os.path.abspath(addFile)
735 >                inp_box = inp_box+' "'+addFile+'",'
736 >                pass
737  
738          if inp_box[-1] == ',' : inp_box = inp_box[:-1]
739          inp_box = inp_box + ' };\n'
# Line 302 | Line 741 | class SchedulerEdg(Scheduler):
741  
742          jdl.write('StdOutput     = "' + job.stdout() + '";\n')
743          jdl.write('StdError      = "' + job.stderr() + '";\n')
744 <
745 <        #if common.flag_return_data :
746 <        #    for fl in job.outputDataFiles():
747 <        #        out_box = out_box + ' "' + fl + '",'
748 <        #        pass
749 <        #    pass
750 <
751 <        out_box = 'OutputSandbox = { '
752 <        if out_sandbox != None:
753 <            for fl in out_sandbox:
754 <                out_box = out_box + ' "' + fl + '",'
744 >        
745 >        
746 >        if job.stdout() == job.stderr():
747 >          out_box = 'OutputSandbox = { "' + \
748 >                    job.stdout() + '", ".BrokerInfo",'
749 >        else:
750 >          out_box = 'OutputSandbox = { "' + \
751 >                    job.stdout() + '", "' + \
752 >                    job.stderr() + '", ".BrokerInfo",'
753 >
754 >        if int(self.return_data) == 1:
755 >            if out_sandbox != None:
756 >                for fl in out_sandbox:
757 >                    out_box = out_box + ' "' + fl + '",'
758 >                    pass
759                  pass
760              pass
761 <
761 >                                                                                                                                                            
762          if out_box[-1] == ',' : out_box = out_box[:-1]
763          out_box = out_box + ' };'
764          jdl.write(out_box+'\n')
765  
323        # If CloseCE is used ...
324        #if common.flag_usecloseCE and job.inputDataFiles():
325        #    indata = 'InputData = { '
326        #    for fl in job.inputDataFiles():
327        #       indata = indata + ' "lfn:' + SPL + fl + '",'
328        #    if indata[-1] == ',' : indata = indata[:-1]
329        #    indata = indata + ' };'
330        #    jdl.write(indata+'\n')
331        #    jdl.write('DataAccessProtocol = { "gsiftp" };\n')
332
333        if common.analisys_common_info['sites']:
334           if common.analisys_common_info['sw_version']:
335
336             req='Requirements = '
337         ### First ORCA version
338             req=req + 'Member("VO-cms-' + \
339                 common.analisys_common_info['sw_version'] + \
340                 '", other.GlueHostApplicationSoftwareRunTimeEnvironment)'
341         ## then sites
342             if len(common.analisys_common_info['sites'])>0:
343               req = req + ' && ('
344             for i in range(len(common.analisys_common_info['sites'])):
345                req = req + 'other.GlueCEInfoHostName == "' \
346                      + common.analisys_common_info['sites'][i] + '"'
347                if ( i < (int(len(common.analisys_common_info['sites']) - 1)) ):
348                    req = req + ' || '
349             req = req + ')'
350         ## then user requirement
351             if self.EDG_requirements:
352               req = req +  ' && ' + self.EDG_requirements
353             req = req + ';\n'
354        jdl.write(req)
766  
767 +        req='Requirements = '
768 +        noreq=req
769 +        req = req + jbt.getRequirements()
770 +        #### and USER REQUIREMENT
771 +        if self.EDG_requirements:
772 +            if (req != noreq):
773 +                req = req +  ' && '
774 +            req = req + self.EDG_requirements
775 +        #### FEDE #####
776 +        if self.EDG_ce_white_list:
777 +            ce_white_list = string.split(self.EDG_ce_white_list,',')
778 +            #print "req = ", req
779 +            for i in range(len(ce_white_list)):
780 +                if i == 0:
781 +                    if (req != noreq):
782 +                        req = req +  ' && '
783 +                    req = req + '((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
784 +                    pass
785 +                else:
786 +                    req = req +  ' || (RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
787 +            req = req + ')'
788 +        
789 +        if self.EDG_ce_black_list:
790 +            ce_black_list = string.split(self.EDG_ce_black_list,',')
791 +            for ce in ce_black_list:
792 +                if (req != noreq):
793 +                    req = req +  ' && '
794 +                req = req + '(!RegExp("' + ce + '", other.GlueCEUniqueId))'
795 +                pass
796 +
797 +        ###############
798 +        clockTime=480
799 +        if self.EDG_clock_time:
800 +            clockTime= self.EDG_clock_time
801 +        if (req != noreq):
802 +            req = req + ' && '
803 +        req = req + '((other.GlueCEPolicyMaxWallClockTime == 0) || (other.GlueCEPolicyMaxWallClockTime>='+str(clockTime)+'))'
804 +
805 +        cpuTime=1000
806 +        if self.EDG_cpu_time:
807 +            cpuTime=self.EDG_cpu_time
808 +        if (req != noreq):
809 +            req = req + ' && '
810 +        req = req + '((other.GlueCEPolicyMaxCPUTime == 0) || (other.GlueCEPolicyMaxCPUTime>='+str(cpuTime)+'))'
811 +
812 +        if (req != noreq):
813 +            req = req + ';\n'
814 +            jdl.write(req)
815 +                                                                                                                                                            
816          jdl.write('VirtualOrganisation = "' + self.VO + '";\n')
817  
818          if ( self.EDG_retry_count ):              
819              jdl.write('RetryCount = '+self.EDG_retry_count+';\n')
820              pass
821  
822 +        jdl.write('MyProxyServer = "' + self.proxyServer + '";\n')
823 +
824          jdl.close()
825          return
826 +
827 +    def checkProxy(self):
828 +        """
829 +        Function to check the Globus proxy.
830 +        """
831 +        if (self.proxyValid): return
832 +        timeleft = -999
833 +        minTimeLeft=10*3600 # in seconds
834 +
835 +        minTimeLeftServer = 100 # in hours
836 +
837 +        #cmd = 'voms-proxy-info -exists -valid '+str(minTimeLeft)+':00'
838 +        #cmd = 'voms-proxy-info -timeleft'
839 +        mustRenew = 0
840 +        timeLeftLocal = runCommand('voms-proxy-info -timeleft 2>/dev/null')
841 +        timeLeftServer = -999
842 +        if not timeLeftLocal or int(timeLeftLocal) <= 0 or not isInt(timeLeftLocal):
843 +            mustRenew = 1
844 +        else:
845 +            timeLeftServer = runCommand('voms-proxy-info -actimeleft 2>/dev/null | head -1')
846 +            if not timeLeftServer or not isInt(timeLeftServer):
847 +                mustRenew = 1
848 +            elif timeLeftLocal<minTimeLeft or timeLeftServer<minTimeLeft:
849 +                mustRenew = 1
850 +            pass
851 +        pass
852 +
853 +        if mustRenew:
854 +            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")
855 +            cmd = 'voms-proxy-init -voms cms -valid 96:00'
856 +            try:
857 +                # SL as above: damn it!
858 +                out = os.system(cmd)
859 +                if (out>0): raise CrabException("Unable to create a valid proxy!\n")
860 +            except:
861 +                msg = "Unable to create a valid proxy!\n"
862 +                raise CrabException(msg)
863 +            # cmd = 'grid-proxy-info -timeleft'
864 +            # cmd_out = runCommand(cmd,0,20)
865 +            pass
866 +
867 +        ## now I do have a voms proxy valid, and I check the myproxy server
868 +        renewProxy = 0
869 +        cmd = 'myproxy-info -d -s '+self.proxyServer
870 +        cmd_out = runCommand(cmd,0,20)
871 +        if not cmd_out:
872 +            common.logger.message('No credential delegated to myproxy server '+self.proxyServer+' will do now')
873 +            renewProxy = 1
874 +        else:
875 +            # if myproxy exist but not long enough, renew
876 +            reTime = re.compile( r'timeleft: (\d+)' )
877 +            #print "<"+str(reTime.search( cmd_out ).group(1))+">"
878 +            if reTime.match( cmd_out ):
879 +                time = reTime.search( line ).group(1)
880 +                if time < minTimeLeftServer:
881 +                    renewProxy = 1
882 +                    common.logger.message('No credential delegation will expire in '+time+' hours: renew it')
883 +                pass
884 +            pass
885 +        
886 +        # if not, create one.
887 +        if renewProxy:
888 +            cmd = 'myproxy-init -d -n -s '+self.proxyServer
889 +            out = os.system(cmd)
890 +            if (out>0):
891 +                raise CrabException("Unable to delegate the proxy to myproxyserver "+self.proxyServer+" !\n")
892 +            pass
893 +
894 +        # cache proxy validity
895 +        self.proxyValid=1
896 +        return
897 +
898 +    def configOpt_(self):
899 +        edg_ui_cfg_opt = ' '
900 +        if self.edg_config:
901 +            edg_ui_cfg_opt = ' -c ' + self.edg_config + ' '
902 +        if self.edg_config_vo:
903 +            edg_ui_cfg_opt += ' --config-vo ' + self.edg_config_vo + ' '
904 +        return edg_ui_cfg_opt

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines