Exemplo n.º 1
0
    def run(self):
        from SimpleSeer.OLAPUtils import ScheduledOLAP
        from SimpleSeer.states import Core
        import Pyro4

        core = Core(self.session)
        found_statemachine = False
        with open(self.options.program) as fp:
            exec fp in dict(core=core)
            found_statemachine = True
        
        if not found_statemachine:
            raise Exception("State machine " + self.options.program + " not found!")
            
        so = ScheduledOLAP()
        gevent.spawn_link_exception(so.runSked)

        core.start_socket_communication()

        if not self.options.disable_pyro:
            gevent.spawn_link_exception(core.run)
            Pyro4.Daemon.serveSimple(
                { core: "sightmachine.seer" },
                ns=True)
        else:
            core.run()
Exemplo n.º 2
0
    def run(self):
        from SimpleSeer.states import Core

        core = Core(self.session)
        found_statemachine = False
        
        program = self.options.program or self.session.statemachine or 'states.py'

        with open(program) as fp:
            exec fp in dict(core=core)
            found_statemachine = True
        
        if not found_statemachine:
            raise Exception("State machine " + self.options.program + " not found!")
            
        try:
            core.run()
        except KeyboardInterrupt as e:
            print "Interupted by user"