140 |
|
pass |
141 |
|
|
142 |
|
self.cfg_params_dataset = {} |
143 |
< |
common_opts = [] |
143 |
> |
common_opts = {} |
144 |
|
# first get common sections |
145 |
|
for sec in self.cfg_params: |
146 |
|
if sec in ['MULTICRAB']: |
147 |
|
cfg_common=self.cfg_params[sec] |
148 |
|
continue |
149 |
|
if sec in ['COMMON']: |
150 |
< |
common_opts.append(self.cfg_params[sec]) |
150 |
> |
common_opts=self.cfg_params[sec] |
151 |
|
continue |
152 |
|
pass |
153 |
|
|
156 |
|
if sec in ['MULTICRAB', 'COMMON']: continue |
157 |
|
self.cfg_params_dataset[sec]=self.cfg_params[sec] |
158 |
|
# add common to all dataset |
159 |
< |
for opt in common_opts: |
160 |
< |
self.cfg_params_dataset[sec]=opt |
159 |
> |
for key in common_opts: |
160 |
> |
self.cfg_params_dataset[sec][key]=common_opts[key] |
161 |
|
pass |
162 |
|
|
163 |
|
self.cfg=cfg_common['cfg'] |
164 |
|
|
165 |
|
# read crab.cfg file and search for storage_path |
166 |
|
cfg_params = loadConfig(self.cfg,{}) |
167 |
< |
self.storage_path = cfg_params.get("USER.storage_path",None) |
167 |
> |
if self.cfg_params.has_key("COMMON"): |
168 |
> |
self.user_remote_dir = self.cfg_params["COMMON"].get("user.user_remote_dir", cfg_params.get("USER.user_remote_dir",None)) |
169 |
> |
else: |
170 |
> |
self.user_remote_dir = cfg_params.get("USER.user_remote_dir",None) |
171 |
|
return |
172 |
|
|
173 |
|
def loadMultiConfig(self, file): |
199 |
|
tmp="-"+string.upper(opt.split(".")[0])+"."+opt.split(".")[1] |
200 |
|
options[tmp]=self.cfg_params_dataset[sec][opt] |
201 |
|
# add section to storage_path if exist in crab.cfg |
202 |
< |
if self.storage_path: |
203 |
< |
options["-USER.storage_path"]=self.storage_path+"/"+sec |
202 |
> |
if not self.cfg_params_dataset.has_key("USER.user_remote_dir") and self.user_remote_dir: |
203 |
> |
options["-USER.user_remote_dir"]=self.user_remote_dir+"/"+sec |
204 |
|
# Input options (command) |
205 |
|
for opt in self.opts: |
206 |
|
options[opt]=self.opts[opt] |
207 |
|
try: |
208 |
< |
# print options |
208 |
> |
#print options |
209 |
|
crab = Crab(options) |
210 |
|
crab.run() |
211 |
|
common.apmon.free() |
212 |
+ |
del crab |
213 |
|
except CrabException, e: |
214 |
|
print '\n' + common.prog_name + ': ' + str(e) + '\n' |
215 |
|
if common.logger: |