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

Comparing COMP/CRAB/python/multicrab.py (file contents):
Revision 1.6 by slacapra, Tue Dec 2 15:41:29 2008 UTC vs.
Revision 1.7 by slacapra, Wed Jan 7 15:23:33 2009 UTC

# Line 116 | Line 116 | class MultiCrab:
116  
117          # Load cfg-file
118  
119 +        cfg_params = {}
120          if self.cfg_fname != None:
121              if os.path.exists(self.cfg_fname):
122 <                self.cfg_params = self.loadMultiConfig(self.cfg_fname)
122 >                cfg_params = self.loadMultiConfig(self.cfg_fname)
123                  pass
124              else:
125                  msg = 'cfg-file '+self.cfg_fname+' not found.'
# Line 129 | Line 130 | class MultiCrab:
130          # process the [CRAB] section
131  
132          lhp = len('MULTICRAB.')
133 <        for k in self.cfg_params.keys():
133 >        for k in cfg_params.keys():
134              if len(k) >= lhp and k[:lhp] == 'MULTICRAB.':
135                  opt = '-'+k[lhp:]
136                  if len(opt) >= 3 and opt[:3] == '-__': continue
137                  if opt not in opts.keys():
138 <                    opts[opt] = self.cfg_params[k]
138 >                    opts[opt] = cfg_params[k]
139                      pass
140                  pass
141              pass
# Line 142 | Line 143 | class MultiCrab:
143          self.cfg_params_dataset = {}
144          common_opts = {}
145          # first get common sections
146 <        for sec in self.cfg_params:
146 >        for sec in cfg_params:
147              if sec in ['MULTICRAB']:
148 <                cfg_common=self.cfg_params[sec]
148 >                cfg_common=cfg_params[sec]
149                  continue
150              if sec in ['COMMON']:
151 <                common_opts=self.cfg_params[sec]
151 >                common_opts=cfg_params[sec]
152                  continue
153              pass
154  
155          # then Dataset's specific
156 <        for sec in self.cfg_params:
156 >        for sec in cfg_params:
157              if sec in ['MULTICRAB', 'COMMON']: continue
158 <            self.cfg_params_dataset[sec]=self.cfg_params[sec]
158 >            self.cfg_params_dataset[sec]=cfg_params[sec]
159              # add common to all dataset
160              for key in common_opts:
161                  self.cfg_params_dataset[sec][key]=common_opts[key]
# Line 163 | Line 164 | class MultiCrab:
164          self.cfg=cfg_common['cfg']
165  
166          # read crab.cfg file and search for storage_path
167 <        cfg_params = loadConfig(self.cfg,{})
168 <        if self.cfg_params.has_key("COMMON"):
169 <            self.user_remote_dir = self.cfg_params["COMMON"].get("user.user_remote_dir", cfg_params.get("USER.user_remote_dir",None))
167 >        crab_cfg_params = loadConfig(self.cfg,{})
168 >        if cfg_params.has_key("COMMON"):
169 >            self.user_remote_dir = cfg_params["COMMON"].get("user.user_remote_dir", crab_cfg_params.get("USER.user_remote_dir",None))
170          else:
171 <            self.user_remote_dir = cfg_params.get("USER.user_remote_dir",None)
171 >            self.user_remote_dir = crab_cfg_params.get("USER.user_remote_dir",None)
172          return
173  
174      def loadMultiConfig(self, file):
# Line 203 | Line 204 | class MultiCrab:
204                  options["-USER.user_remote_dir"]=self.user_remote_dir+"/"+sec
205              # Input options (command)
206              for opt in self.opts:
207 +                # remove -cfg
208 +                if opt=='-cfg': continue
209                  options[opt]=self.opts[opt]
210              try:
211 <                #print options
211 >                # print options
212                  crab = Crab(options)
213                  crab.run()
214                  common.apmon.free()

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines