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)
Exemplo n.º 2
0
 def getApplicationHistory(self):
     initializer = {
         'session': leginondata.SessionData(user=self.session['user']),
         'application': leginondata.ApplicationData()
     }
     appdata = leginondata.LaunchedApplicationData(initializer=initializer)
     appdatalist = self.research(appdata, timelimit='-90 0:0:0')
     history = []
     map = {}
     for a in appdatalist:
         name = a['application']['name']
         if name not in history:
             history.append(name)
             map[name] = a['launchers']
     return history, map
Exemplo n.º 3
0
 def runApplication(self, app):
     name = app.applicationdata['name']
     nnodes = len(app.nodespecs)
     self.applicationevent.clear()
     self.onApplicationStarting(name, nnodes)
     self.application = app
     initializer = {}
     initializer['session'] = self.session
     initializer['application'] = app.applicationdata
     initializer['launchers'] = app.launchernames.items()
     self.appnodes = app.getNodeNames()
     app.launch()
     self.applicationevent.wait()
     d = leginondata.LaunchedApplicationData(initializer=initializer)
     self.publish(d, database=True, dbforce=True)
     self.onApplicationStarted(name)
    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)
Exemplo n.º 5
0
        self.application.load(name)

    def launchApp(self):
        '''Calls application.Application.launch.'''
        if not self.have_selectors:
            return
        for alias in self.uilauncherselectors.values():
            aliasvalue = alias.getSelectedValue()
            self.application.setLauncherAlias(alias.name, aliasvalue)
        try:
            nodenames = self.application.launch()
        except RuntimeError, e:
            self.logger.error('Application launch failed: %s' % e)
            return
        self.waitNodes(nodenames)
        dat = leginondata.LaunchedApplicationData(
            session=self.session, application=self.application.applicationdata)
        self.publish(dat, database=True, dbforce=True)

    def killApp(self):
        '''Calls application.Application.kill.'''
        self.application.kill()

    def exportApplication(self, filename, appname):
        if filename is None:
            return
        app = importexport.ImportExport()
        dump = app.exportApplication(appname)
        if dump is None:
            self.logger.warning('Application invalid')
            return
        try: