def getTransformManagerNavigatorNodes(self, appdata): transform_q = leginondata.NodeSpecData(application=appdata) transform_q['class string'] = 'TransformManager' t_results = transform_q.query() navigator_q = leginondata.NodeSpecData(application=appdata) navigator_q['class string'] = 'Navigator' n_results = navigator_q.query() return t_results, n_results
def addNodeSpec(self, class_string, alias, launcheralias, dependencies=[]): for spec in self.nodespecs: if alias == spec['alias']: self.nodespecs.remove(spec) break nodespecdata = leginondata.NodeSpecData() nodespecdata['class string'] = class_string nodespecdata['alias'] = alias nodespecdata['launcher alias'] = launcheralias nodespecdata['dependencies'] = dependencies nodespecdata['application'] = self.data self.nodespecs.append(nodespecdata)
def load_from_db(self, name): instance = leginondata.ApplicationData(name=name) applicationdatalist = instance.query() try: appdata = applicationdatalist[0] except IndexError: raise ValueError('no such application') nodeinstance = leginondata.NodeSpecData(application=appdata) self.nodespecs = nodeinstance.query() bindinginstance = leginondata.BindingSpecData(application=appdata) self.bindingspecs = bindinginstance.query() self.applicationdata = appdata ## create a copy so we can modify it self.data = leginondata.ApplicationData(initializer=appdata)
def importLaunchedApplications(self): print 'importing Applications....' source_session = self.getSourceSession() q = leginondata.LaunchedApplicationData(session=source_session) launched_apps = self.research(q) self.publish(launched_apps) for appdata in map((lambda x: x['application']), launched_apps): q = leginondata.NodeSpecData(application=appdata) nodespecs = self.research(q) self.publish(nodespecs) q = leginondata.BindingSpecData(application=appdata) bindingspecs = self.research(q) self.publish(bindingspecs)
def importSettings(self): ''' Import Settings based on launched applications of the session ''' source_session = self.getSourceSession() q = leginondata.LaunchedApplicationData(session=source_session) launched_apps = self.research(q) allalias = {} for appdata in map((lambda x: x['application']), launched_apps): q = leginondata.NodeSpecData(application=appdata) results = self.research(q) for r in results: if r['class string'] not in allalias.keys(): allalias[r['class string']] = [] allalias[r['class string']].append(r['alias']) # import settings self.importSettingsByClassAndAlias(allalias)
def importRecentSettings(self): ''' Import Settings based on recent applications ''' # getSourceSession resets sinedon source_session = self.getSourceSession() q = leginondata.ApplicationData() all_apps = self.research(q) unique_apps = [] allalias = {} for appdata in all_apps: if appdata['name'] in unique_apps: continue q = leginondata.NodeSpecData(application=appdata) results = self.research(q) for r in results: if r['class string'] not in allalias.keys(): allalias[r['class string']] = [] allalias[r['class string']].append(r['alias']) unique_apps.append(appdata['name']) # import settings self.importSettingsByClassAndAlias(allalias)