def init_device(self): print "In ", self.get_name(), "::init_device()" try: DynamicDS.init_device(self) #New in Fandango 11.1 except: self.get_DynDS_properties() #LogLevel is already set here try: [ sys.path.insert(0, p) for p in self.PYTHONPATH if p not in sys.path ] except: traceback.print_exc() for m in self.ExtraModules: try: m, k = m.split(' as ') if (' as ' in m) else (m, '') m = m.strip().split('.') if not m: continue k = k or m[-1] if k in self._locals: continue if m[0] in ('sys', 'os'): raise Exception('%s not allowed' % str(m)) print '%s.init_device(): loading %s as %s' % (self.get_name(), m, k) l = imp.load_module(m[0], *imp.find_module(m[0])) if len(m) == 1: self._locals[k or m[0]] = l elif m[1] == '*': self._locals.update(get_module_dict(l)) else: self._locals[k or m[1]] = l.__dict__[m[1]] except: traceback.print_exc() self.set_state(PyTango.DevState.ON) print "Out of ", self.get_name(), "::init_device()"
def init_device(self): print "In ", self.get_name(), "::init_device{}(%s)"%self.get_init_count() try: DynamicDS.init_device(self) #New in Fandango 11.1 except: self.get_DynDS_properties() #LogLevel is already set here try:[sys.path.insert(0,p) for p in self.PYTHONPATH if p not in sys.path] except: traceback.print_exc() self.setLogLevel('INFO') default_props = dict((k,v[-1]) for k,v in WorkerDSClass.device_property_list.items()) all_props = (tango.get_matching_device_properties(self.get_name(),'*')) missing = [k for k,v in default_props.items() if v and k.lower() not in map(str.lower,all_props)] if missing: print('Updating default property values') print default_props.keys() print all_props.keys() print missing self.get_db().put_device_property(self.get_name(),dict((k,default_props[k]) for k in missing)) #TASKS IS NOT CASELESS TO KEEP THE ORIGINAL NAME OF THE TASK self.tasks = dict((k,v) for k,v in all_props.items() if k.lower() not in map(str.lower,default_props)) self.sends = CaselessDefaultDict(int) self.dones = CaselessDefaultDict(int) self.conditions = self.get_task_conditions() self.TStarted = time.time() self.StaticAttributes = ['%s = str(TASK("%s") or "")'%(t,t) for t in self.tasks] self.StaticAttributes += ['LastCheck = self.last_check'] self.parseStaticAttributes() self.info('Loaded %d tasks: %s'%(len(self.tasks),self.tasks.keys())) for m in self.ExtraModules: self.extra_modules = {} try: self.info('Loading ExtraModules(%s)'%m) m,k = m.split(' as ') if (' as ' in m) else (m,'') m = m.strip().split('.') if not m: continue k = k or m[-1] if k not in self._locals: if m[0] in ('sys','os'): raise Exception('%s not allowed'%str(m)) print '%s.init_device(): loading %s as %s' % (self.get_name(),m,k) l = imp.load_module(m[0],*imp.find_module(m[0])) if len(m)==1: self._locals[k or m[0]] = l elif m[1]=='*': self._locals.update(get_module_dict(l)) else: self._locals[k or m[1]] = l.__dict__[m[1]] self.extra_modules[k] = self._locals[k] except: traceback.print_exc() self.set_state(PyTango.DevState.INIT) self.Start() print "Out of ", self.get_name(), "::init_device()"
def init_device(self): print "In ", self.get_name(), "::init_device()" try: DynamicDS.init_device(self) #New in Fandango 11.1 except: self.get_DynDS_properties() #LogLevel is already set here if PyTangoArchiving and 'archiving' in str( self.DynamicAttributes): #+str(self.DynamicCommands): print 'Adding PyTangoArchiving support ...' self._locals['archiving'] = PyTangoArchiving.Reader() self.set_state(PyTango.DevState.ON) print "Out of ", self.get_name(), "::init_device()"
def init_device(self): print "In ", self.get_name(), "::init_device()" DynamicDS.init_device(self) if self.DynamicStates: self.set_state(PyTango.DevState.UNKNOWN) print "Out of ", self.get_name(), "::init_device()"
def init_device(self): print "In ", self.get_name( ), "::init_device{}(%s)" % self.get_init_count() try: DynamicDS.init_device(self) #New in Fandango 11.1 except: self.get_DynDS_properties() #LogLevel is already set here try: [ sys.path.insert(0, p) for p in self.PYTHONPATH if p not in sys.path ] except: traceback.print_exc() self.setLogLevel('INFO') default_props = dict( (k, v[-1]) for k, v in WorkerDSClass.device_property_list.items()) all_props = (tango.get_matching_device_properties( self.get_name(), '*')) missing = [ k for k, v in default_props.items() if v and k.lower() not in map(str.lower, all_props) ] if missing: print('Updating default property values') print default_props.keys() print all_props.keys() print missing self.get_db().put_device_property( self.get_name(), dict((k, default_props[k]) for k in missing)) self.sends = CaselessDefaultDict(int) self.dones = CaselessDefaultDict(int) self.conditions = self.get_task_conditions() #TASKS IS NOT CASELESS TO KEEP THE ORIGINAL NAME OF THE TASK self.tasks = dict((k, v) for k, v in all_props.items() if k.lower() in self.conditions #k.lower() not in map(str.lower,default_props) ) self.TStarted = time.time() self.StaticAttributes = [ '%s = str(TASK("%s") or "")' % (t, t) for t in self.tasks ] self.StaticAttributes += ['LastCheck = self.last_check'] self.parseStaticAttributes() self.info('Loaded %d tasks: %s' % (len(self.tasks), self.tasks.keys())) for m in self.ExtraModules: self.extra_modules = {} try: self.info('Loading ExtraModules(%s)' % m) m, k = m.split(' as ') if (' as ' in m) else (m, '') m = m.strip().split('.') if not m: continue k = k or m[-1] if k not in self._locals: if m[0] in ('sys', 'os'): raise Exception('%s not allowed' % str(m)) print '%s.init_device(): loading %s as %s' % ( self.get_name(), m, k) l = imp.load_module(m[0], *imp.find_module(m[0])) if len(m) == 1: self._locals[k or m[0]] = l elif m[1] == '*': self._locals.update(get_module_dict(l)) else: self._locals[k or m[1]] = l.__dict__[m[1]] self.extra_modules[k] = self._locals[k] except: traceback.print_exc() self.set_state(PyTango.DevState.INIT) self.Start() print "Out of ", self.get_name(), "::init_device()"