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.73.2.3 |
|
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 |
nsmirnov |
1.1 |
try: self.LCG_version = cfg_params["EDG.lcg_version"]
|
41 |
|
|
except KeyError: self.LCG_version = '2'
|
42 |
|
|
|
43 |
|
|
try: self.EDG_requirements = cfg_params['EDG.requirements']
|
44 |
|
|
except KeyError: self.EDG_requirements = ''
|
45 |
|
|
|
46 |
spiga |
1.49 |
try: self.EDG_retry_count = cfg_params['EDG.retry_count']
|
47 |
nsmirnov |
1.1 |
except KeyError: self.EDG_retry_count = ''
|
48 |
|
|
|
49 |
fanzago |
1.48 |
try:
|
50 |
|
|
self.EDG_ce_black_list = cfg_params['EDG.ce_black_list']
|
51 |
|
|
except KeyError:
|
52 |
|
|
self.EDG_ce_black_list = ''
|
53 |
|
|
|
54 |
|
|
try:
|
55 |
|
|
self.EDG_ce_white_list = cfg_params['EDG.ce_white_list']
|
56 |
|
|
except KeyError: self.EDG_ce_white_list = ''
|
57 |
|
|
|
58 |
fanzago |
1.14 |
try: self.VO = cfg_params['EDG.virtual_organization']
|
59 |
|
|
except KeyError: self.VO = 'cms'
|
60 |
|
|
|
61 |
spiga |
1.49 |
try: self.return_data = cfg_params['USER.return_data']
|
62 |
|
|
except KeyError: self.return_data = 1
|
63 |
|
|
|
64 |
fanzago |
1.39 |
try:
|
65 |
|
|
self.copy_input_data = common.analisys_common_info['copy_input_data']
|
66 |
|
|
except KeyError: self.copy_input_data = 0
|
67 |
|
|
|
68 |
fanzago |
1.14 |
try:
|
69 |
|
|
self.copy_data = cfg_params["USER.copy_data"]
|
70 |
fanzago |
1.30 |
if int(self.copy_data) == 1:
|
71 |
|
|
try:
|
72 |
|
|
self.SE = cfg_params['USER.storage_element']
|
73 |
|
|
self.SE_PATH = cfg_params['USER.storage_path']
|
74 |
|
|
except KeyError:
|
75 |
|
|
msg = "Error. The [USER] section does not have 'storage_element'"
|
76 |
|
|
msg = msg + " and/or 'storage_path' entries, necessary to copy the output"
|
77 |
|
|
common.logger.message(msg)
|
78 |
|
|
raise CrabException(msg)
|
79 |
|
|
except KeyError: self.copy_data = 0
|
80 |
|
|
|
81 |
|
|
if ( int(self.return_data) == 0 and int(self.copy_data) == 0 ):
|
82 |
|
|
msg = 'Warning: return_data = 0 and copy_data = 0 ==> your exe output will be lost\n'
|
83 |
|
|
msg = msg + 'Please modify return_data and copy_data value in your crab.cfg file\n'
|
84 |
|
|
raise CrabException(msg)
|
85 |
fanzago |
1.38 |
|
86 |
|
|
try:
|
87 |
|
|
self.lfc_host = cfg_params['EDG.lfc_host']
|
88 |
|
|
except KeyError:
|
89 |
|
|
msg = "Error. The [EDG] section does not have 'lfc_host' value"
|
90 |
|
|
msg = msg + " it's necessary to know the LFC host name"
|
91 |
|
|
common.logger.message(msg)
|
92 |
|
|
raise CrabException(msg)
|
93 |
|
|
try:
|
94 |
|
|
self.lcg_catalog_type = cfg_params['EDG.lcg_catalog_type']
|
95 |
|
|
except KeyError:
|
96 |
|
|
msg = "Error. The [EDG] section does not have 'lcg_catalog_type' value"
|
97 |
|
|
msg = msg + " it's necessary to know the catalog type"
|
98 |
|
|
common.logger.message(msg)
|
99 |
|
|
raise CrabException(msg)
|
100 |
|
|
try:
|
101 |
|
|
self.lfc_home = cfg_params['EDG.lfc_home']
|
102 |
|
|
except KeyError:
|
103 |
|
|
msg = "Error. The [EDG] section does not have 'lfc_home' value"
|
104 |
|
|
msg = msg + " it's necessary to know the home catalog dir"
|
105 |
|
|
common.logger.message(msg)
|
106 |
|
|
raise CrabException(msg)
|
107 |
fanzago |
1.30 |
|
108 |
fanzago |
1.14 |
try:
|
109 |
|
|
self.register_data = cfg_params["USER.register_data"]
|
110 |
fanzago |
1.30 |
if int(self.register_data) == 1:
|
111 |
|
|
try:
|
112 |
|
|
self.LFN = cfg_params['USER.lfn_dir']
|
113 |
|
|
except KeyError:
|
114 |
|
|
msg = "Error. The [USER] section does not have 'lfn_dir' value"
|
115 |
fanzago |
1.36 |
msg = msg + " it's necessary for LCF registration"
|
116 |
fanzago |
1.30 |
common.logger.message(msg)
|
117 |
|
|
raise CrabException(msg)
|
118 |
|
|
except KeyError: self.register_data = 0
|
119 |
|
|
|
120 |
|
|
if ( int(self.copy_data) == 0 and int(self.register_data) == 1 ):
|
121 |
|
|
msg = 'Warning: register_data = 1 must be used with copy_data = 1\n'
|
122 |
|
|
msg = msg + 'Please modify copy_data value in your crab.cfg file\n'
|
123 |
|
|
common.logger.message(msg)
|
124 |
|
|
raise CrabException(msg)
|
125 |
fanzago |
1.14 |
|
126 |
|
|
try: self.EDG_requirements = cfg_params['EDG.requirements']
|
127 |
|
|
except KeyError: self.EDG_requirements = ''
|
128 |
|
|
|
129 |
|
|
try: self.EDG_retry_count = cfg_params['EDG.retry_count']
|
130 |
|
|
except KeyError: self.EDG_retry_count = ''
|
131 |
|
|
|
132 |
|
|
try: self.EDG_clock_time = cfg_params['EDG.max_wall_clock_time']
|
133 |
|
|
except KeyError: self.EDG_clock_time= ''
|
134 |
|
|
|
135 |
|
|
try: self.EDG_cpu_time = cfg_params['EDG.max_cpu_time']
|
136 |
|
|
except KeyError: self.EDG_cpu_time = ''
|
137 |
|
|
|
138 |
fanzago |
1.16 |
# Add EDG_WL_LOCATION to the python path
|
139 |
|
|
try:
|
140 |
|
|
path = os.environ['EDG_WL_LOCATION']
|
141 |
|
|
except:
|
142 |
|
|
msg = "Error: the EDG_WL_LOCATION variable is not set."
|
143 |
|
|
raise CrabException(msg)
|
144 |
|
|
|
145 |
|
|
libPath=os.path.join(path, "lib")
|
146 |
|
|
sys.path.append(libPath)
|
147 |
|
|
libPath=os.path.join(path, "lib", "python")
|
148 |
|
|
sys.path.append(libPath)
|
149 |
nsmirnov |
1.1 |
|
150 |
slacapra |
1.18 |
self.proxyValid=0
|
151 |
gutsche |
1.60 |
|
152 |
slacapra |
1.61 |
try:
|
153 |
|
|
self._taskId = cfg_params['taskId']
|
154 |
|
|
except:
|
155 |
|
|
self._taskId = ''
|
156 |
gutsche |
1.60 |
|
157 |
spiga |
1.73.2.4 |
try: self.jobtypeName = cfg_params['CRAB.jobtype']
|
158 |
|
|
except KeyError: self.jobtypeName = ''
|
159 |
|
|
|
160 |
|
|
try: self.schedulerName = cfg_params['CRAB.scheduler']
|
161 |
|
|
except KeyError: self.scheduler = ''
|
162 |
|
|
|
163 |
nsmirnov |
1.1 |
return
|
164 |
|
|
|
165 |
fanzago |
1.10 |
|
166 |
|
|
def sched_parameter(self):
|
167 |
|
|
"""
|
168 |
|
|
Returns file with scheduler-specific parameters
|
169 |
|
|
"""
|
170 |
|
|
if (self.edg_config and self.edg_config_vo != ''):
|
171 |
|
|
self.param='sched_param.clad'
|
172 |
|
|
param_file = open(common.work_space.shareDir()+'/'+self.param, 'w')
|
173 |
|
|
param_file.write('RBconfig = "'+self.edg_config+'";\n')
|
174 |
|
|
param_file.write('RBconfigVO = "'+self.edg_config_vo+'";')
|
175 |
|
|
param_file.close()
|
176 |
|
|
return 1
|
177 |
|
|
else:
|
178 |
|
|
return 0
|
179 |
fanzago |
1.13 |
|
180 |
nsmirnov |
1.2 |
def wsSetupEnvironment(self):
|
181 |
|
|
"""
|
182 |
|
|
Returns part of a job script which does scheduler-specific work.
|
183 |
|
|
"""
|
184 |
spiga |
1.49 |
txt = ''
|
185 |
gutsche |
1.60 |
txt += "# job number (first parameter for job wrapper)\n"
|
186 |
|
|
txt += "NJob=$1\n"
|
187 |
|
|
|
188 |
|
|
txt += '# job identification to DashBoard \n'
|
189 |
gutsche |
1.64 |
txt += 'MonitorJobID=`echo ${NJob}_$EDG_WL_JOBID`\n'
|
190 |
|
|
txt += 'SyncGridJobId=`echo $EDG_WL_JOBID`\n'
|
191 |
|
|
txt += 'MonitorID=`echo ' + self._taskId + '`\n'
|
192 |
|
|
txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
|
193 |
|
|
txt += 'echo "SyncGridJobId=`echo $SyncGridJobId`" | tee -a $RUNTIME_AREA/$repo \n'
|
194 |
|
|
txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
|
195 |
gutsche |
1.60 |
|
196 |
spiga |
1.49 |
txt += 'echo "middleware discovery " \n'
|
197 |
gutsche |
1.60 |
txt += 'if [ $VO_CMS_SW_DIR ]; then \n'
|
198 |
spiga |
1.49 |
txt += ' middleware=LCG \n'
|
199 |
gutsche |
1.60 |
txt += ' echo "SyncCE=`edg-brokerinfo getCE`" | tee -a $RUNTIME_AREA/$repo \n'
|
200 |
|
|
txt += ' echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
|
201 |
spiga |
1.49 |
txt += ' echo "middleware =$middleware" \n'
|
202 |
|
|
txt += 'elif [ $GRID3_APP_DIR ]; then\n'
|
203 |
|
|
txt += ' middleware=OSG \n'
|
204 |
gutsche |
1.60 |
txt += ' echo "SyncCE=`echo $EDG_WL_LOG_DESTINATION`" | tee -a $RUNTIME_AREA/$repo \n'
|
205 |
|
|
txt += ' echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
|
206 |
spiga |
1.49 |
txt += ' echo "middleware =$middleware" \n'
|
207 |
|
|
txt += 'elif [ $OSG_APP ]; then \n'
|
208 |
|
|
txt += ' middleware=OSG \n'
|
209 |
gutsche |
1.60 |
txt += ' echo "SyncCE=`echo $EDG_WL_LOG_DESTINATION`" | tee -a $RUNTIME_AREA/$repo \n'
|
210 |
|
|
txt += ' echo "GridFlavour=`echo $middleware`" | tee -a $RUNTIME_AREA/$repo \n'
|
211 |
spiga |
1.49 |
txt += ' echo "middleware =$middleware" \n'
|
212 |
|
|
txt += 'else \n'
|
213 |
gutsche |
1.60 |
txt += ' echo "SET_CMS_ENV 10030 ==> middleware not identified" \n'
|
214 |
|
|
txt += ' echo "JOB_EXIT_STATUS = 10030" \n'
|
215 |
|
|
txt += ' echo "JobExitCode=10030" | tee -a $RUNTIME_AREA/$repo \n'
|
216 |
|
|
txt += ' dumpStatus $RUNTIME_AREA/$repo \n'
|
217 |
gutsche |
1.64 |
txt += ' rm -f $RUNTIME_AREA/$repo \n'
|
218 |
|
|
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
|
219 |
|
|
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
|
220 |
gutsche |
1.60 |
txt += ' exit 1 \n'
|
221 |
|
|
txt += 'fi \n'
|
222 |
|
|
|
223 |
|
|
txt += '# report first time to DashBoard \n'
|
224 |
|
|
txt += 'dumpStatus $RUNTIME_AREA/$repo \n'
|
225 |
gutsche |
1.64 |
txt += 'rm -f $RUNTIME_AREA/$repo \n'
|
226 |
|
|
txt += 'echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
|
227 |
|
|
txt += 'echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
|
228 |
|
|
|
229 |
spiga |
1.49 |
txt += '\n\n'
|
230 |
|
|
|
231 |
fanzago |
1.30 |
if int(self.copy_data) == 1:
|
232 |
fanzago |
1.14 |
if self.SE:
|
233 |
|
|
txt += 'export SE='+self.SE+'\n'
|
234 |
fanzago |
1.15 |
txt += 'echo "SE = $SE"\n'
|
235 |
fanzago |
1.14 |
if self.SE_PATH:
|
236 |
|
|
if ( self.SE_PATH[-1] != '/' ) : self.SE_PATH = self.SE_PATH + '/'
|
237 |
|
|
txt += 'export SE_PATH='+self.SE_PATH+'\n'
|
238 |
fanzago |
1.15 |
txt += 'echo "SE_PATH = $SE_PATH"\n'
|
239 |
spiga |
1.49 |
|
240 |
fanzago |
1.38 |
txt += 'export VO='+self.VO+'\n'
|
241 |
|
|
### FEDE: add some line for LFC catalog setting
|
242 |
spiga |
1.49 |
txt += 'if [ $middleware == LCG ]; then \n'
|
243 |
|
|
txt += ' if [[ $LCG_CATALOG_TYPE != \''+self.lcg_catalog_type+'\' ]]; then\n'
|
244 |
|
|
txt += ' export LCG_CATALOG_TYPE='+self.lcg_catalog_type+'\n'
|
245 |
|
|
txt += ' fi\n'
|
246 |
|
|
txt += ' if [[ $LFC_HOST != \''+self.lfc_host+'\' ]]; then\n'
|
247 |
|
|
txt += ' export LFC_HOST='+self.lfc_host+'\n'
|
248 |
|
|
txt += ' fi\n'
|
249 |
|
|
txt += ' if [[ $LFC_HOME != \''+self.lfc_home+'\' ]]; then\n'
|
250 |
|
|
txt += ' export LFC_HOME='+self.lfc_home+'\n'
|
251 |
|
|
txt += ' fi\n'
|
252 |
|
|
txt += 'elif [ $middleware == OSG ]; then\n'
|
253 |
|
|
txt += ' echo "LFC catalog setting to be implemented for OSG"\n'
|
254 |
fanzago |
1.38 |
txt += 'fi\n'
|
255 |
|
|
#####
|
256 |
fanzago |
1.30 |
if int(self.register_data) == 1:
|
257 |
spiga |
1.49 |
txt += 'if [ $middleware == LCG ]; then \n'
|
258 |
|
|
txt += ' export LFN='+self.LFN+'\n'
|
259 |
|
|
txt += ' lfc-ls $LFN\n'
|
260 |
|
|
txt += ' result=$?\n'
|
261 |
|
|
txt += ' echo $result\n'
|
262 |
fanzago |
1.36 |
### creation of LFN dir in LFC catalog, under /grid/cms dir
|
263 |
spiga |
1.49 |
txt += ' if [ $result != 0 ]; then\n'
|
264 |
|
|
txt += ' lfc-mkdir $LFN\n'
|
265 |
|
|
txt += ' result=$?\n'
|
266 |
|
|
txt += ' echo $result\n'
|
267 |
|
|
txt += ' fi\n'
|
268 |
|
|
txt += 'elif [ $middleware == OSG ]; then\n'
|
269 |
|
|
txt += ' echo " Files registration to be implemented for OSG"\n'
|
270 |
fanzago |
1.36 |
txt += 'fi\n'
|
271 |
|
|
txt += '\n'
|
272 |
spiga |
1.49 |
|
273 |
|
|
if self.VO:
|
274 |
|
|
txt += 'export VO='+self.VO+'\n'
|
275 |
|
|
if self.LFN:
|
276 |
|
|
txt += 'if [ $middleware == LCG ]; then \n'
|
277 |
|
|
txt += ' export LFN='+self.LFN+'\n'
|
278 |
|
|
txt += 'fi\n'
|
279 |
|
|
txt += '\n'
|
280 |
|
|
|
281 |
|
|
txt += 'if [ $middleware == LCG ]; then\n'
|
282 |
|
|
txt += ' CloseCEs=`edg-brokerinfo getCE`\n'
|
283 |
|
|
txt += ' echo "CloseCEs = $CloseCEs"\n'
|
284 |
|
|
txt += ' CE=`echo $CloseCEs | sed -e "s/:.*//"`\n'
|
285 |
|
|
txt += ' echo "CE = $CE"\n'
|
286 |
|
|
txt += 'elif [ $middleware == OSG ]; then \n'
|
287 |
|
|
txt += ' if [ $OSG_JOB_CONTACT ]; then \n'
|
288 |
|
|
txt += ' CE=`echo $OSG_JOB_CONTACT | /usr/bin/awk -F\/ \'{print $1}\'` \n'
|
289 |
|
|
txt += ' else \n'
|
290 |
gutsche |
1.60 |
txt += ' echo "SET_CMS_ENV 10099 ==> OSG mode: ERROR in setting CE name from OSG_JOB_CONTACT" \n'
|
291 |
|
|
txt += ' echo "JOB_EXIT_STATUS = 10099" \n'
|
292 |
|
|
txt += ' echo "JobExitCode=10099" | tee -a $RUNTIME_AREA/$repo \n'
|
293 |
|
|
txt += ' dumpStatus $RUNTIME_AREA/$repo \n'
|
294 |
gutsche |
1.64 |
txt += ' rm -f $RUNTIME_AREA/$repo \n'
|
295 |
|
|
txt += ' echo "MonitorJobID=`echo $MonitorJobID`" | tee -a $RUNTIME_AREA/$repo \n'
|
296 |
|
|
txt += ' echo "MonitorID=`echo $MonitorID`" | tee -a $RUNTIME_AREA/$repo\n'
|
297 |
spiga |
1.49 |
txt += ' exit 1 \n'
|
298 |
|
|
txt += ' fi \n'
|
299 |
|
|
txt += 'fi \n'
|
300 |
|
|
|
301 |
nsmirnov |
1.2 |
return txt
|
302 |
fanzago |
1.15 |
|
303 |
fanzago |
1.39 |
def wsCopyInput(self):
|
304 |
|
|
"""
|
305 |
|
|
Copy input data from SE to WN
|
306 |
|
|
"""
|
307 |
|
|
txt = ''
|
308 |
|
|
try:
|
309 |
|
|
self.copy_input_data = common.analisys_common_info['copy_input_data']
|
310 |
|
|
#print "self.copy_input_data = ", self.copy_input_data
|
311 |
|
|
except KeyError: self.copy_input_data = 0
|
312 |
|
|
if int(self.copy_input_data) == 1:
|
313 |
spiga |
1.49 |
## OLI_Daniele deactivate for OSG (wait for LCG UI installed on OSG)
|
314 |
|
|
txt += 'if [ $middleware == OSG ]; then\n'
|
315 |
|
|
txt += ' #\n'
|
316 |
|
|
txt += ' # Copy Input Data from SE to this WN deactivated in OSG mode\n'
|
317 |
|
|
txt += ' #\n'
|
318 |
|
|
txt += ' echo "Copy Input Data from SE to this WN deactivated in OSG mode"\n'
|
319 |
|
|
txt += 'elif [ $middleware == LCG ]; then \n'
|
320 |
|
|
txt += ' #\n'
|
321 |
|
|
txt += ' # Copy Input Data from SE to this WN\n'
|
322 |
|
|
txt += ' #\n'
|
323 |
spiga |
1.42 |
### changed by georgia (put a loop copying more than one input files per jobs)
|
324 |
spiga |
1.49 |
txt += ' for input_file in $cur_file_list \n'
|
325 |
|
|
txt += ' do \n'
|
326 |
fanzago |
1.68 |
#### FEDE
|
327 |
|
|
#txt += ' echo "which lcg-cp" \n'
|
328 |
|
|
#txt += ' which lcg-cp \n'
|
329 |
|
|
#########
|
330 |
fanzago |
1.70 |
txt += ' lcg-cp --vo $VO --verbose -t 1200 lfn:$input_lfn/$input_file file:`pwd`/$input_file 2>&1\n'
|
331 |
fanzago |
1.68 |
txt += ' copy_input_exit_status=$?\n'
|
332 |
|
|
txt += ' echo "COPY_INPUT_EXIT_STATUS = $copy_input_exit_status"\n'
|
333 |
|
|
txt += ' if [ $copy_input_exit_status -ne 0 ]; then \n'
|
334 |
|
|
txt += ' echo "Problems with copying to WN" \n'
|
335 |
|
|
txt += ' else \n'
|
336 |
|
|
txt += ' echo "input copied into WN" \n'
|
337 |
|
|
txt += ' fi \n'
|
338 |
spiga |
1.49 |
txt += ' done \n'
|
339 |
spiga |
1.43 |
### copy a set of PU ntuples (same for each jobs -- but accessed randomly)
|
340 |
spiga |
1.49 |
txt += ' for file in $cur_pu_list \n'
|
341 |
|
|
txt += ' do \n'
|
342 |
fanzago |
1.68 |
#### FEDE
|
343 |
|
|
#txt += ' echo "which lcg-cp" \n'
|
344 |
|
|
#txt += ' which lcg-cp \n'
|
345 |
|
|
#########
|
346 |
fanzago |
1.70 |
txt += ' lcg-cp --vo $VO --verbose -t 1200 lfn:$pu_lfn/$file file:`pwd`/$file 2>&1\n'
|
347 |
fanzago |
1.72 |
txt += ' copy_input_pu_exit_status=$?\n'
|
348 |
fanzago |
1.68 |
txt += ' echo "COPY_INPUT_PU_EXIT_STATUS = $copy_input_pu_exit_status"\n'
|
349 |
|
|
txt += ' if [ $copy_input_pu_exit_status -ne 0 ]; then \n'
|
350 |
|
|
txt += ' echo "Problems with copying pu to WN" \n'
|
351 |
|
|
txt += ' else \n'
|
352 |
|
|
txt += ' echo "input pu files copied into WN" \n'
|
353 |
|
|
txt += ' fi \n'
|
354 |
spiga |
1.49 |
txt += ' done \n'
|
355 |
|
|
txt += ' \n'
|
356 |
|
|
txt += ' ### Check SCRATCH space available on WN : \n'
|
357 |
|
|
txt += ' df -h \n'
|
358 |
|
|
txt += 'fi \n'
|
359 |
|
|
|
360 |
fanzago |
1.39 |
return txt
|
361 |
|
|
|
362 |
fanzago |
1.14 |
def wsCopyOutput(self):
|
363 |
|
|
"""
|
364 |
|
|
Write a CopyResults part of a job script, e.g.
|
365 |
|
|
to copy produced output into a storage element.
|
366 |
|
|
"""
|
367 |
|
|
txt = ''
|
368 |
fanzago |
1.30 |
if int(self.copy_data) == 1:
|
369 |
fanzago |
1.14 |
txt += '#\n'
|
370 |
fanzago |
1.15 |
txt += '# Copy output to SE = $SE\n'
|
371 |
fanzago |
1.14 |
txt += '#\n'
|
372 |
fanzago |
1.66 |
#txt += 'if [ $exe_result -eq 0 ]; then\n'
|
373 |
gutsche |
1.73 |
txt += ' if [ $middleware == OSG ]; then\n'
|
374 |
|
|
txt += ' echo "X509_USER_PROXY = $X509_USER_PROXY"\n'
|
375 |
|
|
txt += ' echo "source $OSG_APP/glite/setup_glite_ui.sh"\n'
|
376 |
|
|
txt += ' source $OSG_APP/glite/setup_glite_ui.sh\n'
|
377 |
|
|
txt += ' export X509_CERT_DIR=$OSG_APP/glite/etc/grid-security/certificates\n'
|
378 |
|
|
txt += ' echo "export X509_CERT_DIR=$X509_CERT_DIR"\n'
|
379 |
|
|
txt += ' fi \n'
|
380 |
corvo |
1.34 |
txt += ' for out_file in $file_list ; do\n'
|
381 |
gutsche |
1.73 |
txt += ' echo "Trying to copy output file to $SE using lcg-cp"\n'
|
382 |
|
|
txt += ' echo "lcg-cp --vo $VO -t 1200 --verbose file://`pwd`/$out_file gsiftp://${SE}${SE_PATH}$out_file"\n'
|
383 |
|
|
txt += ' exitstring=`lcg-cp --vo $VO -t 1200 --verbose file://\`pwd\`/$out_file gsiftp://${SE}${SE_PATH}$out_file 2>&1`\n'
|
384 |
|
|
txt += ' copy_exit_status=$?\n'
|
385 |
|
|
txt += ' echo "COPY_EXIT_STATUS for lcg-cp = $copy_exit_status"\n'
|
386 |
corvo |
1.34 |
txt += ' echo "STAGE_OUT = $copy_exit_status"\n'
|
387 |
|
|
txt += ' if [ $copy_exit_status -ne 0 ]; then\n'
|
388 |
gutsche |
1.73 |
txt += ' echo "Possible problem with SE = $SE"\n'
|
389 |
corvo |
1.34 |
txt += ' echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n'
|
390 |
|
|
txt += ' echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n'
|
391 |
gutsche |
1.73 |
txt += ' echo "lcg-cp failed, attempting srmcp"\n'
|
392 |
|
|
txt += ' echo "mkdir -p $HOME/.srmconfig"\n'
|
393 |
|
|
txt += ' mkdir -p $HOME/.srmconfig\n'
|
394 |
|
|
txt += ' if [ $middleware == LCG ]; then\n'
|
395 |
|
|
txt += ' echo "srmcp -retry_num 5 -retry_timeout 240000 file:////`pwd`/$out_file srm://${SE}:8443${SE_PATH}$out_file"\n'
|
396 |
|
|
txt += ' exitstring=`srmcp -retry_num 5 -retry_timeout 240000 file:////\`pwd\`/$out_file srm://${SE}:8443${SE_PATH}$out_file 2>&1`\n'
|
397 |
|
|
txt += ' elif [ $middleware == OSG ]; then\n'
|
398 |
|
|
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'
|
399 |
|
|
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'
|
400 |
|
|
txt += ' fi \n'
|
401 |
|
|
txt += ' copy_exit_status=$?\n'
|
402 |
|
|
txt += ' echo "COPY_EXIT_STATUS for srm = $copy_exit_status"\n'
|
403 |
|
|
txt += ' echo "STAGE_OUT = $copy_exit_status"\n'
|
404 |
|
|
txt += ' if [ $copy_exit_status -ne 0 ]; then\n'
|
405 |
|
|
txt += ' echo "Problems with SE = $SE"\n'
|
406 |
|
|
txt += ' echo "StageOutExitStatus = 198" | tee -a $RUNTIME_AREA/$repo\n'
|
407 |
|
|
txt += ' echo "StageOutExitStatusReason = $exitstring" | tee -a $RUNTIME_AREA/$repo\n'
|
408 |
|
|
txt += ' echo "lcg-cp and srm failed"\n'
|
409 |
|
|
txt += ' echo "If storage_path in your config file contains a ? you may need a \? instead."\n'
|
410 |
|
|
txt += ' else\n'
|
411 |
|
|
txt += ' echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n'
|
412 |
|
|
txt += ' echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n'
|
413 |
|
|
txt += ' echo "output copied into $SE/$SE_PATH directory"\n'
|
414 |
|
|
txt += ' echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n'
|
415 |
|
|
txt += ' echo "srmcp succeeded"\n'
|
416 |
|
|
txt += ' fi\n'
|
417 |
corvo |
1.34 |
txt += ' else\n'
|
418 |
|
|
txt += ' echo "StageOutSE = $SE" | tee -a $RUNTIME_AREA/$repo\n'
|
419 |
|
|
txt += ' echo "StageOutCatalog = " | tee -a $RUNTIME_AREA/$repo\n'
|
420 |
|
|
txt += ' echo "output copied into $SE/$SE_PATH directory"\n'
|
421 |
|
|
txt += ' echo "StageOutExitStatus = 0" | tee -a $RUNTIME_AREA/$repo\n'
|
422 |
gutsche |
1.73 |
txt += ' echo "lcg-cp succeeded"\n'
|
423 |
corvo |
1.34 |
txt += ' fi\n'
|
424 |
|
|
txt += ' done\n'
|
425 |
fanzago |
1.66 |
#txt += 'fi\n'
|
426 |
fanzago |
1.14 |
return txt
|
427 |
|
|
|
428 |
|
|
def wsRegisterOutput(self):
|
429 |
|
|
"""
|
430 |
|
|
Returns part of a job script which does scheduler-specific work.
|
431 |
|
|
"""
|
432 |
|
|
|
433 |
|
|
txt = ''
|
434 |
fanzago |
1.30 |
if int(self.register_data) == 1:
|
435 |
spiga |
1.49 |
## OLI_Daniele deactivate for OSG (wait for LCG UI installed on OSG)
|
436 |
|
|
txt += 'if [ $middleware == OSG ]; then\n'
|
437 |
|
|
txt += ' #\n'
|
438 |
|
|
txt += ' # Register output to LFC deactivated in OSG mode\n'
|
439 |
|
|
txt += ' #\n'
|
440 |
|
|
txt += ' echo "Register output to LFC deactivated in OSG mode"\n'
|
441 |
|
|
txt += 'elif [ $middleware == LCG ]; then \n'
|
442 |
fanzago |
1.14 |
txt += '#\n'
|
443 |
fanzago |
1.36 |
txt += '# Register output to LFC\n'
|
444 |
fanzago |
1.14 |
txt += '#\n'
|
445 |
fanzago |
1.66 |
#txt += ' if [[ $exe_result -eq 0 && $copy_exit_status -eq 0 ]]; then\n'
|
446 |
|
|
txt += ' if [ $copy_exit_status -eq 0 ]; then\n'
|
447 |
spiga |
1.49 |
txt += ' for out_file in $file_list ; do\n'
|
448 |
|
|
txt += ' echo "Trying to register the output file into LFC"\n'
|
449 |
fanzago |
1.68 |
#### FEDE
|
450 |
|
|
#txt += ' echo "which lcg-rf" \n'
|
451 |
|
|
#txt += ' which lcg-rf \n'
|
452 |
|
|
#########
|
453 |
fanzago |
1.71 |
txt += ' echo "lcg-rf -l $LFN/$out_file --vo $VO -t 1200 sfn://$SE$SE_PATH/$out_file 2>&1"\n'
|
454 |
fanzago |
1.70 |
txt += ' lcg-rf -l $LFN/$out_file --vo $VO -t 1200 sfn://$SE$SE_PATH/$out_file 2>&1 \n'
|
455 |
fanzago |
1.14 |
txt += ' register_exit_status=$?\n'
|
456 |
fanzago |
1.15 |
txt += ' echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
|
457 |
|
|
txt += ' echo "STAGE_OUT = $register_exit_status"\n'
|
458 |
fanzago |
1.14 |
txt += ' if [ $register_exit_status -ne 0 ]; then \n'
|
459 |
spiga |
1.49 |
txt += ' echo "Problems with the registration to LFC" \n'
|
460 |
|
|
txt += ' echo "Try with srm protocol" \n'
|
461 |
fanzago |
1.68 |
#### FEDE
|
462 |
|
|
#txt += ' echo "which lcg-rf" \n'
|
463 |
|
|
#txt += ' which lcg-rf \n'
|
464 |
|
|
#########
|
465 |
fanzago |
1.71 |
txt += ' echo "lcg-rf -l $LFN/$out_file --vo $VO -t 1200 srm://$SE$SE_PATH/$out_file 2>&1"\n'
|
466 |
fanzago |
1.70 |
txt += ' lcg-rf -l $LFN/$out_file --vo $VO -t 1200 srm://$SE$SE_PATH/$out_file 2>&1 \n'
|
467 |
spiga |
1.49 |
txt += ' register_exit_status=$?\n'
|
468 |
|
|
txt += ' echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
|
469 |
|
|
txt += ' echo "STAGE_OUT = $register_exit_status"\n'
|
470 |
|
|
txt += ' if [ $register_exit_status -ne 0 ]; then \n'
|
471 |
|
|
txt += ' echo "Problems with the registration into LFC" \n'
|
472 |
|
|
txt += ' fi \n'
|
473 |
|
|
txt += ' else \n'
|
474 |
|
|
txt += ' echo "output registered to LFC"\n'
|
475 |
fanzago |
1.14 |
txt += ' fi \n'
|
476 |
spiga |
1.49 |
txt += ' echo "StageOutExitStatus = $register_exit_status" | tee -a $RUNTIME_AREA/$repo\n'
|
477 |
|
|
txt += ' done\n'
|
478 |
fanzago |
1.66 |
#txt += ' elif [[ $exe_result -eq 0 && $copy_exit_status -ne 0 ]]; then \n'
|
479 |
|
|
txt += ' else \n'
|
480 |
spiga |
1.49 |
txt += ' echo "Trying to copy output file to CloseSE"\n'
|
481 |
|
|
txt += ' CLOSE_SE=`edg-brokerinfo getCloseSEs | head -1`\n'
|
482 |
|
|
txt += ' for out_file in $file_list ; do\n'
|
483 |
fanzago |
1.68 |
#### FEDE
|
484 |
|
|
#txt += ' echo "which lcg-cr" \n'
|
485 |
|
|
#txt += ' which lcg-cr \n'
|
486 |
|
|
#########
|
487 |
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'
|
488 |
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'
|
489 |
spiga |
1.49 |
txt += ' register_exit_status=$?\n'
|
490 |
|
|
txt += ' echo "REGISTER_EXIT_STATUS = $register_exit_status"\n'
|
491 |
|
|
txt += ' echo "STAGE_OUT = $register_exit_status"\n'
|
492 |
|
|
txt += ' if [ $register_exit_status -ne 0 ]; then \n'
|
493 |
fanzago |
1.66 |
txt += ' echo "Problems with CloseSE or Catalog" \n'
|
494 |
spiga |
1.49 |
txt += ' else \n'
|
495 |
|
|
txt += ' echo "The program was successfully executed"\n'
|
496 |
|
|
txt += ' echo "SE = $CLOSE_SE"\n'
|
497 |
|
|
txt += ' echo "LFN for the file is LFN=${LFN}/$out_file"\n'
|
498 |
|
|
txt += ' fi \n'
|
499 |
|
|
txt += ' echo "StageOutExitStatus = $register_exit_status" | tee -a $RUNTIME_AREA/$repo\n'
|
500 |
|
|
txt += ' done\n'
|
501 |
fanzago |
1.66 |
#txt += ' else\n'
|
502 |
|
|
#txt += ' echo "Problem with the executable"\n'
|
503 |
spiga |
1.49 |
txt += ' fi \n'
|
504 |
fanzago |
1.68 |
txt += ' exit_status=$register_exit_status\n'
|
505 |
fanzago |
1.14 |
txt += 'fi \n'
|
506 |
|
|
return txt
|
507 |
nsmirnov |
1.1 |
|
508 |
spiga |
1.23 |
def loggingInfo(self, id):
|
509 |
slacapra |
1.7 |
"""
|
510 |
|
|
retrieve the logging info from logging and bookkeeping and return it
|
511 |
|
|
"""
|
512 |
slacapra |
1.18 |
self.checkProxy()
|
513 |
fanzago |
1.24 |
cmd = 'edg-job-get-logging-info -v 2 ' + id
|
514 |
slacapra |
1.32 |
#cmd_out = os.popen(cmd)
|
515 |
|
|
cmd_out = runCommand(cmd)
|
516 |
slacapra |
1.7 |
return cmd_out
|
517 |
|
|
|
518 |
slacapra |
1.6 |
def listMatch(self, nj):
|
519 |
|
|
"""
|
520 |
|
|
Check the compatibility of available resources
|
521 |
|
|
"""
|
522 |
slacapra |
1.18 |
self.checkProxy()
|
523 |
spiga |
1.73.2.4 |
jdl = common.work_space.shareDir()+"fake.jdl"
|
524 |
|
|
cmd = 'edg-job-list-match ' + self.configOpt_() + str(jdl)
|
525 |
slacapra |
1.32 |
cmd_out = runCommand(cmd,0,10)
|
526 |
slacapra |
1.44 |
if not cmd_out:
|
527 |
|
|
raise CrabException("ERROR: "+cmd+" failed!")
|
528 |
|
|
|
529 |
slacapra |
1.6 |
return self.parseListMatch_(cmd_out, jdl)
|
530 |
|
|
|
531 |
|
|
def parseListMatch_(self, out, jdl):
|
532 |
slacapra |
1.31 |
"""
|
533 |
|
|
Parse the f* output of edg-list-match and produce something sensible
|
534 |
|
|
"""
|
535 |
slacapra |
1.6 |
reComment = re.compile( r'^\**$' )
|
536 |
|
|
reEmptyLine = re.compile( r'^$' )
|
537 |
|
|
reVO = re.compile( r'Selected Virtual Organisation name.*' )
|
538 |
slacapra |
1.31 |
reLine = re.compile( r'.*')
|
539 |
|
|
reCE = re.compile( r'(.*:.*)')
|
540 |
|
|
reCEId = re.compile( r'CEId.*')
|
541 |
slacapra |
1.6 |
reNO = re.compile( r'No Computing Element matching' )
|
542 |
|
|
reRB = re.compile( r'Connecting to host' )
|
543 |
|
|
next = 0
|
544 |
|
|
CEs=[]
|
545 |
|
|
Match=0
|
546 |
slacapra |
1.22 |
|
547 |
slacapra |
1.31 |
#print out
|
548 |
|
|
lines = reLine.findall(out)
|
549 |
|
|
|
550 |
|
|
i=0
|
551 |
|
|
CEs=[]
|
552 |
|
|
for line in lines:
|
553 |
|
|
string.strip(line)
|
554 |
|
|
#print line
|
555 |
|
|
if reNO.match( line ):
|
556 |
|
|
common.logger.debug(5,line)
|
557 |
|
|
return 0
|
558 |
|
|
pass
|
559 |
fanzago |
1.28 |
if reVO.match( line ):
|
560 |
slacapra |
1.31 |
VO =reVO.match( line ).group()
|
561 |
|
|
common.logger.debug(5,"VO "+VO)
|
562 |
fanzago |
1.28 |
pass
|
563 |
slacapra |
1.31 |
|
564 |
fanzago |
1.28 |
if reRB.match( line ):
|
565 |
slacapra |
1.31 |
RB = reRB.match(line).group()
|
566 |
|
|
common.logger.debug(5,"RB "+RB)
|
567 |
fanzago |
1.28 |
pass
|
568 |
slacapra |
1.31 |
|
569 |
|
|
if reCEId.search( line ):
|
570 |
|
|
for lineCE in lines[i:-1]:
|
571 |
|
|
if reCE.match( lineCE ):
|
572 |
|
|
CE = string.strip(reCE.search(lineCE).group(1))
|
573 |
|
|
CEs.append(CE.split(':')[0])
|
574 |
|
|
pass
|
575 |
|
|
pass
|
576 |
fanzago |
1.28 |
pass
|
577 |
slacapra |
1.31 |
i=i+1
|
578 |
|
|
pass
|
579 |
|
|
|
580 |
|
|
common.logger.debug(5,"All CE :"+str(CEs))
|
581 |
|
|
|
582 |
|
|
sites = []
|
583 |
|
|
[sites.append(it) for it in CEs if not sites.count(it)]
|
584 |
|
|
|
585 |
|
|
common.logger.debug(5,"All Sites :"+str(sites))
|
586 |
gutsche |
1.56 |
common.logger.message("Matched Sites :"+str(sites))
|
587 |
slacapra |
1.31 |
return len(sites)
|
588 |
slacapra |
1.6 |
|
589 |
|
|
def noMatchFound_(self, jdl):
|
590 |
|
|
reReq = re.compile( r'Requirements' )
|
591 |
|
|
reString = re.compile( r'"\S*"' )
|
592 |
|
|
f = file(jdl,'r')
|
593 |
|
|
for line in f.readlines():
|
594 |
|
|
line= line.strip()
|
595 |
|
|
if reReq.match(line):
|
596 |
|
|
for req in reString.findall(line):
|
597 |
|
|
if re.search("VO",req):
|
598 |
|
|
common.logger.message( "SW required: "+req)
|
599 |
|
|
continue
|
600 |
|
|
if re.search('"\d+',req):
|
601 |
|
|
common.logger.message("Other req : "+req)
|
602 |
|
|
continue
|
603 |
|
|
common.logger.message( "CE required: "+req)
|
604 |
|
|
break
|
605 |
|
|
pass
|
606 |
|
|
raise CrabException("No compatible resources found!")
|
607 |
|
|
|
608 |
nsmirnov |
1.1 |
def submit(self, nj):
|
609 |
nsmirnov |
1.3 |
"""
|
610 |
|
|
Submit one EDG job.
|
611 |
|
|
"""
|
612 |
nsmirnov |
1.1 |
|
613 |
slacapra |
1.18 |
self.checkProxy()
|
614 |
nsmirnov |
1.1 |
jid = None
|
615 |
|
|
jdl = common.job_list[nj].jdlFilename()
|
616 |
slacapra |
1.18 |
|
617 |
|
|
cmd = 'edg-job-submit ' + self.configOpt_() + jdl
|
618 |
nsmirnov |
1.1 |
cmd_out = runCommand(cmd)
|
619 |
|
|
if cmd_out != None:
|
620 |
slacapra |
1.18 |
reSid = re.compile( r'https.+' )
|
621 |
slacapra |
1.20 |
jid = reSid.search(cmd_out).group()
|
622 |
nsmirnov |
1.3 |
pass
|
623 |
nsmirnov |
1.1 |
return jid
|
624 |
|
|
|
625 |
fanzago |
1.33 |
def resubmit(self, nj_list):
|
626 |
|
|
"""
|
627 |
|
|
Prepare jobs to be submit
|
628 |
|
|
"""
|
629 |
|
|
return
|
630 |
|
|
|
631 |
slacapra |
1.8 |
def getExitStatus(self, id):
|
632 |
|
|
return self.getStatusAttribute_(id, 'exit_code')
|
633 |
fanzago |
1.10 |
|
634 |
nsmirnov |
1.1 |
def queryStatus(self, id):
|
635 |
slacapra |
1.8 |
return self.getStatusAttribute_(id, 'status')
|
636 |
fanzago |
1.10 |
|
637 |
spiga |
1.9 |
def queryDest(self, id):
|
638 |
|
|
return self.getStatusAttribute_(id, 'destination')
|
639 |
|
|
|
640 |
slacapra |
1.8 |
|
641 |
|
|
def getStatusAttribute_(self, id, attr):
|
642 |
nsmirnov |
1.1 |
""" Query a status of the job with id """
|
643 |
slacapra |
1.8 |
|
644 |
slacapra |
1.18 |
self.checkProxy()
|
645 |
slacapra |
1.8 |
hstates = {}
|
646 |
fanzago |
1.12 |
Status = importName('edg_wl_userinterface_common_LbWrapper', 'Status')
|
647 |
slacapra |
1.8 |
# Bypass edg-job-status interfacing directly to C++ API
|
648 |
|
|
# Job attribute vector to retrieve status without edg-job-status
|
649 |
|
|
level = 0
|
650 |
|
|
# Instance of the Status class provided by LB API
|
651 |
|
|
jobStat = Status()
|
652 |
|
|
st = 0
|
653 |
|
|
jobStat.getStatus(id, level)
|
654 |
|
|
err, apiMsg = jobStat.get_error()
|
655 |
|
|
if err:
|
656 |
fanzago |
1.26 |
common.logger.debug(5,'Error caught' + apiMsg)
|
657 |
nsmirnov |
1.1 |
return None
|
658 |
slacapra |
1.8 |
else:
|
659 |
|
|
for i in range(len(self.states)):
|
660 |
|
|
# Fill an hash table with all information retrieved from LB API
|
661 |
|
|
hstates[ self.states[i] ] = jobStat.loadStatus(st)[i]
|
662 |
|
|
result = jobStat.loadStatus(st)[ self.states.index(attr) ]
|
663 |
|
|
return result
|
664 |
nsmirnov |
1.1 |
|
665 |
|
|
def queryDetailedStatus(self, id):
|
666 |
|
|
""" Query a detailed status of the job with id """
|
667 |
|
|
cmd = 'edg-job-status '+id
|
668 |
|
|
cmd_out = runCommand(cmd)
|
669 |
|
|
return cmd_out
|
670 |
|
|
|
671 |
|
|
def getOutput(self, id):
|
672 |
nsmirnov |
1.5 |
"""
|
673 |
|
|
Get output for a finished job with id.
|
674 |
|
|
Returns the name of directory with results.
|
675 |
|
|
"""
|
676 |
slacapra |
1.6 |
|
677 |
slacapra |
1.18 |
self.checkProxy()
|
678 |
slacapra |
1.6 |
cmd = 'edg-job-get-output --dir ' + common.work_space.resDir() + ' ' + id
|
679 |
nsmirnov |
1.1 |
cmd_out = runCommand(cmd)
|
680 |
nsmirnov |
1.5 |
|
681 |
|
|
# Determine the output directory name
|
682 |
|
|
dir = common.work_space.resDir()
|
683 |
corvo |
1.55 |
dir += os.environ['USER']
|
684 |
nsmirnov |
1.5 |
dir += '_' + os.path.basename(id)
|
685 |
|
|
return dir
|
686 |
nsmirnov |
1.1 |
|
687 |
|
|
def cancel(self, id):
|
688 |
|
|
""" Cancel the EDG job with id """
|
689 |
slacapra |
1.18 |
self.checkProxy()
|
690 |
nsmirnov |
1.1 |
cmd = 'edg-job-cancel --noint ' + id
|
691 |
|
|
cmd_out = runCommand(cmd)
|
692 |
|
|
return cmd_out
|
693 |
spiga |
1.73.2.4 |
|
694 |
|
|
def createFakeJdl(self,nj): # TMP Just waiting listmatch functionalitly
|
695 |
|
|
# implementation into BOSS4 Daniele
|
696 |
|
|
"""
|
697 |
|
|
Create a fake jdl considering
|
698 |
|
|
only requirements
|
699 |
|
|
"""
|
700 |
fanzago |
1.73.2.5.2.3 |
#job = common.job_list[nj]
|
701 |
|
|
job = common.job_list[0]
|
702 |
spiga |
1.73.2.4 |
jbt = job.type()
|
703 |
|
|
inp_storage_subdir = ''
|
704 |
|
|
|
705 |
|
|
|
706 |
|
|
SPL = inp_storage_subdir
|
707 |
|
|
if ( SPL and SPL[-1] != '/' ) : SPL = SPL + '/'
|
708 |
nsmirnov |
1.1 |
|
709 |
spiga |
1.73.2.4 |
jdl = open(common.work_space.shareDir()+"fake.jdl","w")
|
710 |
|
|
|
711 |
|
|
script = job.scriptFilename()
|
712 |
|
|
jdl.write('Executable = "' + os.path.basename(script) +'";\n')
|
713 |
|
|
|
714 |
|
|
req='Requirements = '
|
715 |
|
|
noreq=req
|
716 |
|
|
req = req + jbt.getRequirements()
|
717 |
|
|
#### and USER REQUIREMENT
|
718 |
|
|
if self.EDG_requirements:
|
719 |
|
|
if (req != noreq):
|
720 |
|
|
req = req + ' && '
|
721 |
|
|
req = req + self.EDG_requirements
|
722 |
|
|
#### FEDE #####
|
723 |
|
|
if self.EDG_ce_white_list:
|
724 |
|
|
ce_white_list = string.split(self.EDG_ce_white_list,',')
|
725 |
|
|
#print "req = ", req
|
726 |
|
|
for i in range(len(ce_white_list)):
|
727 |
|
|
if i == 0:
|
728 |
|
|
if (req != noreq):
|
729 |
|
|
req = req + ' && '
|
730 |
|
|
req = req + '((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
|
731 |
|
|
pass
|
732 |
|
|
else:
|
733 |
|
|
req = req + ' || (RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
|
734 |
|
|
req = req + ')'
|
735 |
|
|
|
736 |
|
|
if self.EDG_ce_black_list:
|
737 |
|
|
ce_black_list = string.split(self.EDG_ce_black_list,',')
|
738 |
|
|
for ce in ce_black_list:
|
739 |
|
|
if (req != noreq):
|
740 |
|
|
req = req + ' && '
|
741 |
|
|
req = req + '(!RegExp("' + ce + '", other.GlueCEUniqueId))'
|
742 |
|
|
pass
|
743 |
|
|
|
744 |
|
|
###############
|
745 |
|
|
clockTime=480
|
746 |
|
|
if self.EDG_clock_time:
|
747 |
|
|
clockTime= self.EDG_clock_time
|
748 |
|
|
if (req != noreq):
|
749 |
|
|
req = req + ' && '
|
750 |
|
|
req = req + '((other.GlueCEPolicyMaxWallClockTime == 0) || (other.GlueCEPolicyMaxWallClockTime>='+str(clockTime)+'))'
|
751 |
|
|
|
752 |
|
|
cpuTime=1000
|
753 |
|
|
if self.EDG_cpu_time:
|
754 |
|
|
cpuTime=self.EDG_cpu_time
|
755 |
|
|
if (req != noreq):
|
756 |
|
|
req = req + ' && '
|
757 |
|
|
req = req + '((other.GlueCEPolicyMaxCPUTime == 0) || (other.GlueCEPolicyMaxCPUTime>='+str(cpuTime)+'))'
|
758 |
|
|
|
759 |
|
|
if (req != noreq):
|
760 |
|
|
req = req + ';\n'
|
761 |
|
|
jdl.write(req)
|
762 |
|
|
|
763 |
|
|
jdl.write('VirtualOrganisation = "' + self.VO + '";\n')
|
764 |
|
|
|
765 |
|
|
if ( self.EDG_retry_count ):
|
766 |
|
|
jdl.write('RetryCount = '+self.EDG_retry_count+';\n')
|
767 |
|
|
pass
|
768 |
|
|
|
769 |
|
|
jdl.write('MyProxyServer = "' + self.proxyServer + '";\n')
|
770 |
|
|
|
771 |
|
|
jdl.close()
|
772 |
|
|
return
|
773 |
|
|
|
774 |
spiga |
1.73.2.3 |
|
775 |
fanzago |
1.73.2.5.2.3 |
def createXMLSchScript(self, nj, argsList, jobList):
|
776 |
|
|
# def createXMLSchScript(self, nj):
|
777 |
nsmirnov |
1.1 |
"""
|
778 |
spiga |
1.73.2.3 |
Create a XML-file for BOSS4.
|
779 |
nsmirnov |
1.1 |
"""
|
780 |
fanzago |
1.73.2.5.2.3 |
# job = common.job_list[nj]
|
781 |
|
|
|
782 |
|
|
"""
|
783 |
|
|
INDY
|
784 |
|
|
[begin] da rivedere:
|
785 |
|
|
in particolare passerei il jobType ed eliminerei le dipendenze da job
|
786 |
|
|
"""
|
787 |
|
|
index = nj - 1
|
788 |
|
|
job = common.job_list[index]
|
789 |
nsmirnov |
1.1 |
jbt = job.type()
|
790 |
fanzago |
1.73.2.5.2.3 |
|
791 |
|
|
inp_sandbox = jbt.inputSandbox(index)
|
792 |
|
|
out_sandbox = jbt.outputSandbox(index)
|
793 |
|
|
"""
|
794 |
|
|
[end] da rivedere
|
795 |
|
|
"""
|
796 |
|
|
|
797 |
|
|
|
798 |
spiga |
1.73.2.3 |
title = '<?xml version="1.0" encoding="UTF-8" standalone="no"?>\n'
|
799 |
nsmirnov |
1.1 |
jt_string = ''
|
800 |
spiga |
1.73.2.3 |
|
801 |
spiga |
1.73.2.4 |
xml_fname = str(self.jobtypeName)+'.xml'
|
802 |
spiga |
1.73.2.3 |
xml = open(common.work_space.shareDir()+'/'+xml_fname, 'a')
|
803 |
fanzago |
1.14 |
|
804 |
spiga |
1.73.2.3 |
#TaskName
|
805 |
|
|
dir = string.split(common.work_space.topDir(), '/')
|
806 |
|
|
taskName = dir[len(dir)-2]
|
807 |
|
|
|
808 |
|
|
to_writeReq = ''
|
809 |
|
|
to_write = ''
|
810 |
|
|
req=' '
|
811 |
|
|
req = req + jbt.getRequirements()
|
812 |
|
|
if self.EDG_requirements:
|
813 |
|
|
if (req == ' '):
|
814 |
|
|
req = req + self.EDG_requirements
|
815 |
|
|
else:
|
816 |
|
|
req = req + ' && ' + self.EDG_requirements
|
817 |
|
|
if self.EDG_ce_white_list:
|
818 |
|
|
ce_white_list = string.split(self.EDG_ce_white_list,',')
|
819 |
|
|
for i in range(len(ce_white_list)):
|
820 |
|
|
if i == 0:
|
821 |
|
|
if (req == ' '):
|
822 |
|
|
req = req + '((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
|
823 |
|
|
else:
|
824 |
|
|
req = req + ' && ((RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
|
825 |
|
|
pass
|
826 |
|
|
else:
|
827 |
|
|
req = req + ' || (RegExp("' + ce_white_list[i] + '", other.GlueCEUniqueId))'
|
828 |
|
|
req = req + ')'
|
829 |
nsmirnov |
1.1 |
|
830 |
spiga |
1.73.2.3 |
if self.EDG_ce_black_list:
|
831 |
|
|
ce_black_list = string.split(self.EDG_ce_black_list,',')
|
832 |
|
|
for ce in ce_black_list:
|
833 |
|
|
if (req == ' '):
|
834 |
|
|
req = req + '(!RegExp("' + ce + '", other.GlueCEUniqueId))'
|
835 |
|
|
else:
|
836 |
|
|
req = req + ' && (!RegExp("' + ce + '", other.GlueCEUniqueId))'
|
837 |
|
|
pass
|
838 |
|
|
if self.EDG_clock_time:
|
839 |
|
|
if (req == ' '):
|
840 |
|
|
req = req + 'other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time
|
841 |
|
|
else:
|
842 |
|
|
req = req + ' && other.GlueCEPolicyMaxWallClockTime>='+self.EDG_clock_time
|
843 |
|
|
|
844 |
|
|
if self.EDG_cpu_time:
|
845 |
|
|
if (req == ' '):
|
846 |
|
|
req = req + ' other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
|
847 |
|
|
else:
|
848 |
|
|
req = req + ' && other.GlueCEPolicyMaxCPUTime>='+self.EDG_cpu_time
|
849 |
|
|
if (req != ' '):
|
850 |
|
|
req = req + '\n'
|
851 |
|
|
to_writeReq = req
|
852 |
|
|
|
853 |
|
|
|
854 |
|
|
if ( self.EDG_retry_count ):
|
855 |
|
|
to_write = to_write + 'RetryCount = "'+self.EDG_retry_count+'"\n'
|
856 |
|
|
pass
|
857 |
nsmirnov |
1.1 |
|
858 |
fanzago |
1.73.2.5.2.3 |
#to_write = to_write + 'MyProxyServer = ""' + self.proxyServer + '""\n'
|
859 |
|
|
to_write = to_write + 'MyProxyServer = "' + self.proxyServer + '"\n'
|
860 |
|
|
to_write = to_write + 'VirtualOrganisation = "' + self.VO + '"\n'
|
861 |
nsmirnov |
1.1 |
|
862 |
|
|
|
863 |
spiga |
1.73.2.3 |
#TaskName
|
864 |
|
|
dir = string.split(common.work_space.topDir(), '/')
|
865 |
|
|
taskName = dir[len(dir)-2]
|
866 |
|
|
|
867 |
slacapra |
1.8 |
|
868 |
fanzago |
1.73.2.5.2.3 |
xml.write(str(title))
|
869 |
|
|
xml.write('<task name="' +str(taskName)+'">\n')
|
870 |
|
|
xml.write(jt_string)
|
871 |
|
|
#Here it must pass the extra Tags.. (into Task & out of chain)
|
872 |
|
|
if (to_writeReq != ''):
|
873 |
|
|
xml.write('<extraTags>\n')
|
874 |
|
|
xml.write('<Requirements>\n')
|
875 |
|
|
xml.write('<![CDATA[\n')
|
876 |
|
|
xml.write(to_writeReq)
|
877 |
|
|
xml.write(']]>\n')
|
878 |
|
|
xml.write('</Requirements>\n')
|
879 |
|
|
xml.write('</extraTags>\n')
|
880 |
spiga |
1.73.2.3 |
pass
|
881 |
fanzago |
1.73.2.5.2.3 |
|
882 |
|
|
if (to_write != ''):
|
883 |
|
|
xml.write('<extraTags\n')
|
884 |
|
|
xml.write(to_write)
|
885 |
|
|
xml.write('/>\n')
|
886 |
|
|
pass
|
887 |
|
|
|
888 |
|
|
xml.write('<iterator>\n')
|
889 |
|
|
print str(nj)
|
890 |
|
|
xml.write('\t<iteratorRule name="ITR1" rule="1:'+ str(nj) + '" />\n')
|
891 |
|
|
print argsList
|
892 |
|
|
xml.write('\t<iteratorRule name="ITR2" rule="'+ argsList + '" />\n')
|
893 |
|
|
print jobList
|
894 |
|
|
xml.write('\t<iteratorRule name="ITR3" rule="'+ jobList + '" />\n')
|
895 |
|
|
|
896 |
spiga |
1.73.2.4 |
xml.write('<chain scheduler="'+str(self.schedulerName)+'">\n')
|
897 |
spiga |
1.73.2.3 |
xml.write(jt_string)
|
898 |
|
|
|
899 |
|
|
#executable
|
900 |
fanzago |
1.73.2.5.2.3 |
|
901 |
|
|
"""
|
902 |
|
|
INDY
|
903 |
|
|
script dipende dal jobType: dovrebbe essere semplice tirarlo fuori in altro modo
|
904 |
|
|
"""
|
905 |
spiga |
1.73.2.3 |
script = job.scriptFilename()
|
906 |
|
|
xml.write('<program exec="' + os.path.basename(script) +'"\n')
|
907 |
|
|
xml.write(jt_string)
|
908 |
|
|
|
909 |
|
|
|
910 |
|
|
### only one .sh JDL has arguments:
|
911 |
gutsche |
1.56 |
### Fabio
|
912 |
fanzago |
1.73.2.5.2.3 |
# xml.write('args = "' + str(nj+1)+' '+ jbt.getJobTypeArguments(nj, "EDG") +'"\n')
|
913 |
|
|
xml.write('args = "_ITR2_"\n')
|
914 |
spiga |
1.73.2.3 |
xml.write('program_types="crabjob"\n')
|
915 |
|
|
inp_box = 'infiles="'
|
916 |
|
|
inp_box = inp_box + '' + script + ','
|
917 |
nsmirnov |
1.1 |
|
918 |
|
|
if inp_sandbox != None:
|
919 |
|
|
for fl in inp_sandbox:
|
920 |
spiga |
1.73.2.3 |
inp_box = inp_box + '' + fl + ','
|
921 |
nsmirnov |
1.1 |
pass
|
922 |
|
|
pass
|
923 |
|
|
|
924 |
corvo |
1.34 |
# Marco (VERY TEMPORARY ML STUFF)
|
925 |
spiga |
1.73.2.3 |
inp_box = inp_box + os.path.abspath(os.environ['CRABDIR']+'/python/'+'report.py') + ',' +\
|
926 |
|
|
os.path.abspath(os.environ['CRABDIR']+'/python/'+'DashboardAPI.py') + ','+\
|
927 |
|
|
os.path.abspath(os.environ['CRABDIR']+'/python/'+'Logger.py') + ','+\
|
928 |
|
|
os.path.abspath(os.environ['CRABDIR']+'/python/'+'ProcInfo.py') + ','+\
|
929 |
|
|
os.path.abspath(os.environ['CRABDIR']+'/python/'+'apmon.py')
|
930 |
corvo |
1.34 |
# End Marco
|
931 |
nsmirnov |
1.1 |
|
932 |
fanzago |
1.40 |
if (not jbt.additional_inbox_files == []):
|
933 |
|
|
inp_box = inp_box + ', '
|
934 |
|
|
for addFile in jbt.additional_inbox_files:
|
935 |
|
|
addFile = os.path.abspath(addFile)
|
936 |
spiga |
1.73.2.3 |
inp_box = inp_box+''+addFile+','
|
937 |
fanzago |
1.40 |
pass
|
938 |
nsmirnov |
1.1 |
|
939 |
|
|
if inp_box[-1] == ',' : inp_box = inp_box[:-1]
|
940 |
spiga |
1.73.2.3 |
inp_box = inp_box + ' "\n'
|
941 |
|
|
xml.write(inp_box)
|
942 |
fanzago |
1.14 |
|
943 |
fanzago |
1.73.2.5.2.3 |
base = jbt.name()
|
944 |
|
|
stdout = base + '__ITR3_.stdout'
|
945 |
|
|
stderr = base + '__ITR3_.stderr'
|
946 |
|
|
|
947 |
|
|
xml.write('stderr="' + stdout + '"\n')
|
948 |
|
|
xml.write('stdout="' + stderr + '"\n')
|
949 |
fanzago |
1.14 |
|
950 |
|
|
|
951 |
fanzago |
1.73.2.5.2.3 |
out_box = 'outfiles="' + \
|
952 |
|
|
stdout + ',' + \
|
953 |
|
|
stderr + ',.BrokerInfo,'
|
954 |
|
|
|
955 |
|
|
"""
|
956 |
fanzago |
1.30 |
if int(self.return_data) == 1:
|
957 |
fanzago |
1.14 |
if out_sandbox != None:
|
958 |
|
|
for fl in out_sandbox:
|
959 |
spiga |
1.73.2.3 |
out_box = out_box + '' + fl + ','
|
960 |
fanzago |
1.14 |
pass
|
961 |
nsmirnov |
1.1 |
pass
|
962 |
|
|
pass
|
963 |
fanzago |
1.73.2.5.2.3 |
"""
|
964 |
|
|
|
965 |
|
|
"""
|
966 |
|
|
INDY
|
967 |
|
|
qualcosa del genere andrebbe fatta per gli infiles
|
968 |
|
|
"""
|
969 |
|
|
if int(self.return_data) == 1:
|
970 |
|
|
for fl in jbt.output_file:
|
971 |
|
|
out_box = out_box + '' + jbt.numberFile_(fl, '_ITR1_') + ','
|
972 |
|
|
pass
|
973 |
|
|
pass
|
974 |
|
|
|
975 |
nsmirnov |
1.1 |
if out_box[-1] == ',' : out_box = out_box[:-1]
|
976 |
spiga |
1.73.2.3 |
out_box = out_box + '"'
|
977 |
|
|
xml.write(out_box+'\n')
|
978 |
|
|
|
979 |
|
|
xml.write('group="'+taskName+'"\n')
|
980 |
fanzago |
1.73.2.5.2.3 |
# xml.write('BossAttr="[crabjob.INTERNAL_ID=' + str(nj+1) +']"\n')
|
981 |
|
|
#xml.write('BossAttr="[crabjob.INTERNAL_ID=_ITR1_]"\n')
|
982 |
|
|
xml.write('BossAttr="crabjob.INTERNAL_ID=_ITR1_"\n')
|
983 |
nsmirnov |
1.1 |
|
984 |
fanzago |
1.48 |
|
985 |
spiga |
1.73.2.3 |
|
986 |
|
|
xml.write('/>\n')
|
987 |
|
|
xml.write('</chain>\n')
|
988 |
fanzago |
1.48 |
|
989 |
fanzago |
1.73.2.5.2.3 |
# if int(nj) == int(common.jobDB.nJobs()-1): xml.write('</task>\n')
|
990 |
|
|
xml.write('</iterator>\n')
|
991 |
|
|
xml.write('</task>\n')
|
992 |
nsmirnov |
1.1 |
|
993 |
|
|
|
994 |
spiga |
1.73.2.3 |
xml.close()
|
995 |
slacapra |
1.51 |
|
996 |
nsmirnov |
1.1 |
return
|
997 |
slacapra |
1.18 |
|
998 |
spiga |
1.73.2.3 |
|
999 |
|
|
|
1000 |
slacapra |
1.18 |
def checkProxy(self):
|
1001 |
|
|
"""
|
1002 |
|
|
Function to check the Globus proxy.
|
1003 |
|
|
"""
|
1004 |
|
|
if (self.proxyValid): return
|
1005 |
|
|
timeleft = -999
|
1006 |
slacapra |
1.50 |
minTimeLeft=10*3600 # in seconds
|
1007 |
slacapra |
1.51 |
|
1008 |
|
|
minTimeLeftServer = 100 # in hours
|
1009 |
|
|
|
1010 |
slacapra |
1.50 |
#cmd = 'voms-proxy-info -exists -valid '+str(minTimeLeft)+':00'
|
1011 |
|
|
#cmd = 'voms-proxy-info -timeleft'
|
1012 |
|
|
mustRenew = 0
|
1013 |
fanzago |
1.69 |
timeLeftLocal = runCommand('voms-proxy-info -timeleft 2>/dev/null')
|
1014 |
slacapra |
1.50 |
timeLeftServer = -999
|
1015 |
fanzago |
1.53 |
if not timeLeftLocal or int(timeLeftLocal) <= 0 or not isInt(timeLeftLocal):
|
1016 |
slacapra |
1.50 |
mustRenew = 1
|
1017 |
|
|
else:
|
1018 |
fanzago |
1.69 |
timeLeftServer = runCommand('voms-proxy-info -actimeleft 2>/dev/null | head -1')
|
1019 |
slacapra |
1.50 |
if not timeLeftServer or not isInt(timeLeftServer):
|
1020 |
|
|
mustRenew = 1
|
1021 |
slacapra |
1.54 |
elif timeLeftLocal<minTimeLeft or timeLeftServer<minTimeLeft:
|
1022 |
slacapra |
1.50 |
mustRenew = 1
|
1023 |
|
|
pass
|
1024 |
|
|
pass
|
1025 |
|
|
|
1026 |
slacapra |
1.51 |
if mustRenew:
|
1027 |
gutsche |
1.58 |
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")
|
1028 |
|
|
cmd = 'voms-proxy-init -voms cms -valid 96:00'
|
1029 |
slacapra |
1.18 |
try:
|
1030 |
slacapra |
1.32 |
# SL as above: damn it!
|
1031 |
slacapra |
1.19 |
out = os.system(cmd)
|
1032 |
|
|
if (out>0): raise CrabException("Unable to create a valid proxy!\n")
|
1033 |
slacapra |
1.18 |
except:
|
1034 |
|
|
msg = "Unable to create a valid proxy!\n"
|
1035 |
|
|
raise CrabException(msg)
|
1036 |
slacapra |
1.51 |
# cmd = 'grid-proxy-info -timeleft'
|
1037 |
|
|
# cmd_out = runCommand(cmd,0,20)
|
1038 |
slacapra |
1.18 |
pass
|
1039 |
slacapra |
1.51 |
|
1040 |
|
|
## now I do have a voms proxy valid, and I check the myproxy server
|
1041 |
|
|
renewProxy = 0
|
1042 |
|
|
cmd = 'myproxy-info -d -s '+self.proxyServer
|
1043 |
|
|
cmd_out = runCommand(cmd,0,20)
|
1044 |
|
|
if not cmd_out:
|
1045 |
|
|
common.logger.message('No credential delegated to myproxy server '+self.proxyServer+' will do now')
|
1046 |
|
|
renewProxy = 1
|
1047 |
|
|
else:
|
1048 |
|
|
# if myproxy exist but not long enough, renew
|
1049 |
|
|
reTime = re.compile( r'timeleft: (\d+)' )
|
1050 |
|
|
#print "<"+str(reTime.search( cmd_out ).group(1))+">"
|
1051 |
|
|
if reTime.match( cmd_out ):
|
1052 |
|
|
time = reTime.search( line ).group(1)
|
1053 |
|
|
if time < minTimeLeftServer:
|
1054 |
|
|
renewProxy = 1
|
1055 |
|
|
common.logger.message('No credential delegation will expire in '+time+' hours: renew it')
|
1056 |
|
|
pass
|
1057 |
|
|
pass
|
1058 |
|
|
|
1059 |
|
|
# if not, create one.
|
1060 |
|
|
if renewProxy:
|
1061 |
|
|
cmd = 'myproxy-init -d -n -s '+self.proxyServer
|
1062 |
|
|
out = os.system(cmd)
|
1063 |
|
|
if (out>0):
|
1064 |
fanzago |
1.53 |
raise CrabException("Unable to delegate the proxy to myproxyserver "+self.proxyServer+" !\n")
|
1065 |
slacapra |
1.51 |
pass
|
1066 |
|
|
|
1067 |
|
|
# cache proxy validity
|
1068 |
slacapra |
1.18 |
self.proxyValid=1
|
1069 |
|
|
return
|
1070 |
spiga |
1.49 |
|
1071 |
slacapra |
1.18 |
def configOpt_(self):
|
1072 |
|
|
edg_ui_cfg_opt = ' '
|
1073 |
|
|
if self.edg_config:
|
1074 |
slacapra |
1.51 |
edg_ui_cfg_opt = ' -c ' + self.edg_config + ' '
|
1075 |
slacapra |
1.18 |
if self.edg_config_vo:
|
1076 |
slacapra |
1.51 |
edg_ui_cfg_opt += ' --config-vo ' + self.edg_config_vo + ' '
|
1077 |
slacapra |
1.18 |
return edg_ui_cfg_opt
|