99 |
|
if ( opt == '-cfg' ): |
100 |
|
if self.flag_continue: |
101 |
|
raise CrabException('-continue and -cfg cannot coexist.') |
102 |
< |
if opts[opt] : self.cfg_fname = opts[opt] |
102 |
> |
if opts[opt] : |
103 |
> |
self.cfg_fname = opts[opt] |
104 |
> |
del opts[opt] # do not pass cfg further on |
105 |
|
else : processHelpOptions() |
106 |
|
pass |
107 |
|
pass |
147 |
|
# first get common sections |
148 |
|
for sec in cfg_params: |
149 |
|
if sec in ['MULTICRAB']: |
150 |
< |
cfg_common=cfg_params[sec] |
150 |
> |
if 'cfg' in cfg_params[sec]: |
151 |
> |
common_opts['cfg']=cfg_params[sec]['cfg'] |
152 |
|
continue |
153 |
|
if sec in ['COMMON']: |
154 |
< |
common_opts=cfg_params[sec] |
154 |
> |
common_opts.update(cfg_params[sec]) |
155 |
|
continue |
156 |
|
pass |
157 |
|
|
158 |
+ |
crab_cfg='crab.cfg' |
159 |
+ |
if common_opts.has_key('cfg') : crab_cfg=common_opts['cfg'] |
160 |
+ |
|
161 |
|
# then Dataset's specific |
162 |
|
for sec in cfg_params: |
163 |
|
if sec in ['MULTICRAB', 'COMMON']: continue |
167 |
|
self.cfg_params_dataset[sec][key]=common_opts[key] |
168 |
|
pass |
169 |
|
|
164 |
– |
self.cfg=cfg_common['cfg'] |
165 |
– |
|
170 |
|
# read crab.cfg file and search for storage_path |
171 |
< |
crab_cfg_params = loadConfig(self.cfg,{}) |
171 |
> |
crab_cfg_params = loadConfig(crab_cfg,{}) |
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 |
|
else: |
201 |
|
options['-USER.ui_working_dir']=sec |
202 |
|
# options from multicrab.cfg |
203 |
|
for opt in self.cfg_params_dataset[sec]: |
204 |
< |
tmp="-"+string.upper(opt.split(".")[0])+"."+opt.split(".")[1] |
204 |
> |
tmp = "-"+str(opt) |
205 |
> |
if len(opt.split("."))==2: |
206 |
> |
tmp="-"+string.upper(opt.split(".")[0])+"."+opt.split(".")[1] |
207 |
> |
|
208 |
|
options[tmp]=self.cfg_params_dataset[sec][opt] |
209 |
|
# add section to storage_path if exist in crab.cfg |
210 |
|
if not self.cfg_params_dataset.has_key("USER.user_remote_dir") and self.user_remote_dir: |
211 |
|
options["-USER.user_remote_dir"]=self.user_remote_dir+"/"+sec |
212 |
|
# Input options (command) |
213 |
|
for opt in self.opts: |
207 |
– |
# remove -cfg |
208 |
– |
if opt=='-cfg': continue |
214 |
|
options[opt]=self.opts[opt] |
215 |
+ |
if self.flag_continue and options.has_key("-cfg"): |
216 |
+ |
del options['-cfg'] |
217 |
+ |
pass |
218 |
+ |
crab = None |
219 |
|
try: |
211 |
– |
# print options |
220 |
|
crab = Crab(options) |
221 |
|
crab.run() |
222 |
< |
common.apmon.free() |
223 |
< |
del crab |
222 |
> |
crab.delete() |
223 |
> |
print 'Log file is %s%s.log'%(common.work_space.logDir(),common.prog_name) |
224 |
> |
print '\n############################## E N D ####################################\n' |
225 |
|
except CrabException, e: |
226 |
+ |
crab.delete() |
227 |
|
print '\n' + common.prog_name + ': ' + str(e) + '\n' |
218 |
– |
if common.logger: |
219 |
– |
common.logger.write('ERROR: '+str(e)+'\n') |
220 |
– |
pass |
228 |
|
pass |
229 |
|
pass |
230 |
|
pass |
231 |
|
|
225 |
– |
#common.apmon.free() |
232 |
|
|
233 |
|
########################################################################### |
234 |
|
if __name__ == '__main__': |