168 |
|
|
169 |
|
# read crab.cfg file and search for storage_path |
170 |
|
crab_cfg_params = loadConfig(crab_cfg,{}) |
171 |
+ |
# also USER.ui_working_dir USER.outputdir and USER.logdir need special treatment |
172 |
|
if cfg_params.has_key("COMMON"): |
173 |
|
self.user_remote_dir = cfg_params["COMMON"].get("user.user_remote_dir", crab_cfg_params.get("USER.user_remote_dir",None)) |
174 |
+ |
self.outputdir = cfg_params["COMMON"].get("user.outputdir", crab_cfg_params.get("USER.outputdir",None)) |
175 |
+ |
self.logdir = cfg_params["COMMON"].get("user.logdir", crab_cfg_params.get("USER.logdir",None)) |
176 |
+ |
self.ui_working_dir = cfg_params["COMMON"].get("user.ui_working_dir", crab_cfg_params.get("USER.ui_working_dir",None)) |
177 |
|
else: |
178 |
|
self.user_remote_dir = crab_cfg_params.get("USER.user_remote_dir",None) |
179 |
+ |
self.outputdir = crab_cfg_params.get("USER.outputdir",None) |
180 |
+ |
self.logdir = crab_cfg_params.get("USER.logdir",None) |
181 |
+ |
self.ui_working_dir = crab_cfg_params.get("USER.ui_working_dir",None) |
182 |
+ |
|
183 |
|
return |
184 |
|
|
185 |
|
def loadMultiConfig(self, file): |
200 |
|
|
201 |
|
def run(self): |
202 |
|
#run crabs |
203 |
+ |
runFileName = 'multicrab.exe' |
204 |
+ |
runFile = open(runFileName,"w") |
205 |
|
for sec in self.cfg_params_dataset: |
206 |
|
options={} |
207 |
|
if self.flag_continue: |
215 |
|
tmp="-"+string.upper(opt.split(".")[0])+"."+opt.split(".")[1] |
216 |
|
|
217 |
|
options[tmp]=self.cfg_params_dataset[sec][opt] |
218 |
+ |
|
219 |
|
# add section to storage_path if exist in crab.cfg |
220 |
|
if not self.cfg_params_dataset.has_key("USER.user_remote_dir") and self.user_remote_dir: |
221 |
|
options["-USER.user_remote_dir"]=self.user_remote_dir+"/"+sec |
222 |
+ |
# also for ui_working_dir |
223 |
+ |
if not self.cfg_params_dataset.has_key("USER.ui_working_dir") and self.ui_working_dir: |
224 |
+ |
options["-USER.ui_working_dir"]=self.ui_working_dir+"/"+sec |
225 |
+ |
# also for logDir |
226 |
+ |
if not self.cfg_params_dataset.has_key("USER.logdir") and self.logdir: |
227 |
+ |
options["-USER.logdir"]=self.logdir+"/"+sec |
228 |
+ |
# also for outputdir |
229 |
+ |
if not self.cfg_params_dataset.has_key("USER.outputdir") and self.outputdir: |
230 |
+ |
options["-USER.outputdir"]=self.outputdir+"/"+sec |
231 |
+ |
|
232 |
|
# Input options (command) |
233 |
|
for opt in self.opts: |
234 |
|
options[opt]=self.opts[opt] |
235 |
|
if self.flag_continue and options.has_key("-cfg"): |
236 |
|
del options['-cfg'] |
237 |
|
pass |
238 |
< |
crab = Crab() |
239 |
< |
try: |
240 |
< |
crab.initialize_(options) |
241 |
< |
crab.run() |
242 |
< |
del crab |
243 |
< |
print 'Log file is %s%s.log'%(common.work_space.logDir(),common.prog_name) |
244 |
< |
print '\n############################## E N D ####################################\n' |
245 |
< |
except CrabException, e: |
246 |
< |
del crab |
247 |
< |
print '\n' + common.prog_name + ': ' + str(e) + '\n' |
248 |
< |
pass |
249 |
< |
pass |
250 |
< |
if (common.logger): common.logger.delete() |
238 |
> |
|
239 |
> |
# write crab command to be executed later... |
240 |
> |
cmd='crab ' |
241 |
> |
for o in options: |
242 |
> |
cmd+=str(o)+" "+str(options[o])+" " |
243 |
> |
cmd+="\n" |
244 |
> |
# print cmd |
245 |
> |
|
246 |
> |
runFile.write(cmd) |
247 |
> |
|
248 |
> |
# SL this does not work for complex, multi include pset.py |
249 |
> |
|
250 |
> |
# crab = Crab() |
251 |
> |
# try: |
252 |
> |
# crab.initialize_(options) |
253 |
> |
# crab.run() |
254 |
> |
# del crab |
255 |
> |
# print 'Log file is %s%s.log'%(common.work_space.logDir(),common.prog_name) |
256 |
> |
# print '\n############################## E N D ####################################\n' |
257 |
> |
# except CrabException, e: |
258 |
> |
# del crab |
259 |
> |
# print '\n' + common.prog_name + ': ' + str(e) + '\n' |
260 |
> |
# pass |
261 |
> |
# pass |
262 |
> |
# if (common.logger): common.logger.delete() |
263 |
|
pass |
264 |
|
|
265 |
|
|