Home | Trees | Indices | Help |
---|
|
1 2 #!/bin/env python 3 # 4 """ 5 Interface for configuring and running python filtering scripts 6 7 copyright (c) 2005 the icecube collaboration 8 9 @version: $Revision: $ 10 @date: $Date: $ 11 @author: Juan Carlos Diaz Velez <juancarlos@icecube.wisc.edu> 12 """ 13 14 import os 15 import re 16 import sys 17 import string 18 import os.path 19 import iceprod.modules 20 from ipmodule import IPBaseClass 21 from iceprod.core import odict,functions 22 import logging 2325 """ 26 This class provides an interface for preprocessing files in iceprod 27 """ 287130 IPBaseClass.__init__(self) 31 self.AddParameter('IPModuleURL','SVN URL of python script', '') 32 self.AddParameter('IPModuleRevision','SVN revision of python script',0) 33 self.AddParameter('IPModuleClass','class to load','') 34 self.AddParameter('IPModuleCache','should cache downloads',True) 35 self.logger = logging.getLogger('iceprod::IPIceTray') 36 37 self.child_parameters = odict.OrderedDict()3840 """ 41 Overload SetParameter in order to allow for undefined parameters 42 """ 43 if param in ('IPModuleURL','IPModuleRevision','IPModuleClass'): 44 IPBaseClass.SetParameter(self,param,value) 45 else: 46 self.child_parameters[param] = value47 4850 if not IPBaseClass.Execute(self,stats): return 0 51 52 # set python path 53 sys.path.insert(0,os.getcwd()) 54 55 url = self.GetParameter('IPModuleURL') 56 classname = self.GetParameter('IPModuleClass') 57 cache_src = self.GetParameter('IPModuleCache') 58 filt = os.path.basename(url) 59 60 if functions.wget(url,cache=cache_src): 61 raise Exception, "Failed to retrieve i3filter from '%s'" % url 62 63 mod = iceprod.modules.get_plugin(classname)() 64 mod.SetParser(self.parser) 65 66 # Pass parameters to module 67 for name,value in self.child_parameters.items(): 68 mod.SetParameter(name,value) 69 70 return mod.Execute(stats)
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Mon May 3 21:25:54 2010 | http://epydoc.sourceforge.net |