Ejemplo n.º 1
0
 def __init__(self):
     ChimeraObject.__init__(self)
     self.machine = Machine(SequentialScheduler(), self)
     self.proxies = {}
     self.hostPort = ''
Ejemplo n.º 2
0
    def __start__ (self):
        self.executor = ProgramExecutor(self)
        self.scheduler = SchedulingAlgorithms[self["algorithm"]]
        self.machine = Machine(self.scheduler, self.executor, self)

        self.log.debug("Using %s algorithm" % self["algorithm"])
Ejemplo n.º 3
0
    def __start__(self):
        self.executor = ProgramExecutor(self)
        self.scheduler = SchedulingAlgorithms[self["algorithm"]]
        self.machine = Machine(self.scheduler, self.executor, self)

        self.log.debug("Using %s algorithm" % self["algorithm"])
Ejemplo n.º 4
0
class Scheduler(ChimeraObject):
    
    __config__ = {"telescope"   : "/Telescope/0",
                  "camera"      : "/Camera/0",
                  "filterwheel" : "/FilterWheel/0",
                  "focuser"     : "/Focuser/0",
                  "dome"        : "/Dome/0",
                  "autofocus"   : "/Autofocus/0",
                  "point_verify": "/PointVerify/0",
                  'site'        : '/Site/0',
                  'algorithm'   : SchedulingAlgorithm.SEQUENTIAL}
    
    def __init__(self):
        ChimeraObject.__init__(self)
        
        self.executor = None
        self.scheduler = None
        self.machine = None

    def __start__ (self):
        self.executor = ProgramExecutor(self)
        self.scheduler = SchedulingAlgorithms[self["algorithm"]]
        self.machine = Machine(self.scheduler, self.executor, self)

        self.log.debug("Using %s algorithm" % self["algorithm"])

    def control(self):
        if not self.machine.isAlive():
            self.machine.start()
            return False

    def __stop__ (self):
        self.log.debug('Attempting to stop machine')
        self.shutdown()
        self.log.debug('Machine stopped')
        Session().commit()
        return True

    def currentProgram(self):
        return self.machine.currentProgram

    def currentAction(self):
        return self.executor.currentAction

    def start(self):
        if self.machine:
            self.machine.state(State.START)

    def stop(self):
        if self.machine:
            self.machine.state(State.STOP)

    def shutdown(self):
        if self.machine:
            self.machine.state(State.SHUTDOWN)

    def restartAllPrograms(self):
        if self.machine:
            self.machine.restartAllPrograms()

    def state(self):
        return self.machine.state()

    @event
    def programBegin(self, program):
        pass

    @event
    def programComplete(self, program, status, message=None):
        pass

    @event
    def actionBegin(self, action, message):
        pass

    @event
    def actionComplete(self, action, status, message=None):
        pass

    @event
    def stateChanged(self, newState, oldState):
        pass
Ejemplo n.º 5
0
class Scheduler(ChimeraObject):

    __config__ = {
        "telescope": "/Telescope/0",
        "camera": "/Camera/0",
        "filterwheel": "/FilterWheel/0",
        "focuser": "******",
        "dome": "/Dome/0",
        "autofocus": "/Autofocus/0",
        "point_verify": "/PointVerify/0",
        'site': '/Site/0',
        'algorithm': SchedulingAlgorithm.SEQUENTIAL
    }

    def __init__(self):
        ChimeraObject.__init__(self)

        self.executor = None
        self.scheduler = None
        self.machine = None

    def __start__(self):
        self.executor = ProgramExecutor(self)
        self.scheduler = SchedulingAlgorithms[self["algorithm"]]
        self.machine = Machine(self.scheduler, self.executor, self)

        self.log.debug("Using %s algorithm" % self["algorithm"])

    def control(self):
        if not self.machine.isAlive():
            self.machine.start()
            return False

    def __stop__(self):
        self.log.debug('Attempting to stop machine')
        self.shutdown()
        self.log.debug('Machine stopped')
        Session().commit()
        return True

    def currentProgram(self):
        return self.machine.currentProgram

    def currentAction(self):
        return self.executor.currentAction

    def start(self):
        if self.machine:
            self.machine.state(State.START)

    def stop(self):
        if self.machine:
            self.machine.state(State.STOP)

    def shutdown(self):
        if self.machine:
            self.machine.state(State.SHUTDOWN)

    def restartAllPrograms(self):
        if self.machine:
            self.machine.restartAllPrograms()

    def state(self):
        return self.machine.state()

    @event
    def programBegin(self, program):
        pass

    @event
    def programComplete(self, program, status, message=None):
        pass

    @event
    def actionBegin(self, action, message):
        pass

    @event
    def actionComplete(self, action, status, message=None):
        pass

    @event
    def stateChanged(self, newState, oldState):
        pass