コード例 #1
0
        def process():

            # session to be used by executor and handlers
            session = Session()

            task = session.merge(program)

            log.debug("[start] %s" % str(task))

            site = Site()
            nowmjd = site.MJD()
            log.debug("[start] Current MJD is %f", nowmjd)
            if program.startAt:
                waittime = (program.startAt - nowmjd) * 86.4e3
                if waittime > 0.0:
                    log.debug("[start] Waiting until MJD %f to start slewing",
                              program.startAt)
                    log.debug("[start] Will wait for %f seconds", waittime)
                    time.sleep(waittime)
                else:
                    if program.validFor >= 0.0:
                        if -waittime > program.validFor:
                            log.debug("[start] Program is not valid anymore",
                                      program.startAt, program.validFor)
                            self.controller.programComplete(
                                program, SchedulerStatus.OK,
                                "Program not valid anymore.")
                    else:
                        log.debug(
                            "[start] Specified slew start MJD %s has already passed; proceeding without waiting",
                            program.startAt)
            else:
                log.debug("[start] No slew time specified, so no waiting")
            log.debug("[start] Current MJD is %f", site.MJD())
            log.debug("[start] Proceeding since MJD %f should have passed",
                      program.startAt)
            self.controller.programBegin(program)

            try:
                self.executor.execute(task)
                log.debug("[finish] %s" % str(task))
                self.scheduler.done(task)
                self.controller.programComplete(program, SchedulerStatus.OK)
                self.state(State.IDLE)
            except ProgramExecutionException as e:
                self.scheduler.done(task, error=e)
                self.controller.programComplete(program, SchedulerStatus.ERROR,
                                                str(e))
                self.state(State.IDLE)
                log.debug("[error] %s (%s)" % (str(task), str(e)))
            except ProgramExecutionAborted as e:
                self.scheduler.done(task, error=e)
                self.controller.programComplete(program,
                                                SchedulerStatus.ABORTED,
                                                "Aborted by user.")
                self.state(State.OFF)
                log.debug("[aborted by user] %s" % str(task))

            session.commit()
コード例 #2
0
ファイル: machine.py プロジェクト: astroufsc/chimera
        def process ():

            # session to be used by executor and handlers
            session = Session()

            task = session.merge(program)

            log.debug("[start] %s" % str(task))

            site=Site()
            nowmjd=site.MJD()
            log.debug("[start] Current MJD is %f",nowmjd)
            if program.startAt:
                waittime=(program.startAt-nowmjd)*86.4e3
                if waittime>0.0:
                    log.debug("[start] Waiting until MJD %f to start slewing",program.startAt)
                    log.debug("[start] Will wait for %f seconds",waittime)
                    time.sleep(waittime)
                else:
                    if program.validFor >= 0.0:
                        if -waittime > program.validFor:
                            log.debug("[start] Program is not valid anymore", program.startAt, program.validFor)
                            self.controller.programComplete(program, SchedulerStatus.OK, "Program not valid anymore.")
                    else:
                        log.debug("[start] Specified slew start MJD %s has already passed; proceeding without waiting",program.startAt)
            else:
               log.debug("[start] No slew time specified, so no waiting")
            log.debug("[start] Current MJD is %f",site.MJD())
            log.debug("[start] Proceeding since MJD %f should have passed",program.startAt)
            self.controller.programBegin(program)

            try:
                self.executor.execute(task)
                log.debug("[finish] %s" % str(task))
                self.scheduler.done(task)
                self.controller.programComplete(program, SchedulerStatus.OK)
                self.state(State.IDLE)
            except ProgramExecutionException, e:
                self.scheduler.done(task, error=e)
                self.controller.programComplete(program, SchedulerStatus.ERROR, str(e))
                self.state(State.IDLE)
                log.debug("[error] %s (%s)" % (str(task), str(e)))
コード例 #3
0
ファイル: machine.py プロジェクト: carriercomm/chimera-1
        def process ():

            # session to be used by executor and handlers
            session = Session()

            task = session.merge(program)

            log.debug("[start] %s" % str(task))

            self.controller.programBegin(program)

            try:
                self.executor.execute(task)
                log.debug("[finish] %s" % str(task)) 
                self.scheduler.done(task)
                self.controller.programComplete(program, SchedulerStatus.OK)
                self.state(State.IDLE)
            except ProgramExecutionException, e:
                self.scheduler.done(task, error=e)
                self.controller.programComplete(program, SchedulerStatus.ERROR, str(e))
                self.state(State.IDLE)
                log.debug("[error] %s (%s)" % (str(task), str(e)))
コード例 #4
0
ファイル: machine.py プロジェクト: phsilva/chimera
        def process():

            # session to be used by executor and handlers
            session = Session()

            task = session.merge(program)

            log.debug("[start] %s" % str(task))

            self.controller.programBegin(program)

            try:
                self.executor.execute(task)
                log.debug("[finish] %s" % str(task))
                self.scheduler.done(task)
                self.controller.programComplete(program, SchedulerStatus.OK)
                self.state(State.IDLE)
            except ProgramExecutionException, e:
                self.scheduler.done(task, error=e)
                self.controller.programComplete(program, SchedulerStatus.ERROR,
                                                str(e))
                self.state(State.IDLE)
                log.debug("[error] %s (%s)" % (str(task), str(e)))