Ejemplo n.º 1
0
    def run_exp(self):
        self.__check_system()

        succ = False
        try:
            self.__setup()

            try:
                self.__run_tasks()
                self.log("Saving results in %s" % self.finished_dir)
                succ = True
            except:
                traceback.print_exc()
                self.__kill_all()
                raise ExperimentFailed(self.name)
            finally:
                self.__teardown()
        finally:
            self.log("Switching to Linux scheduler")

            # Give the tasks 10 seconds to finish before bailing
            start = time.time()
            while lu.all_tasks() > 0:
                if time.time() - start < 10.0:
                    raise SystemCorrupted("%d tasks still running!" %
                                          lu.all_tasks())

            lu.switch_scheduler("Linux")

        if succ:
            self.__save_results()
            self.log("Experiment done!")
Ejemplo n.º 2
0
    def __check_system(self):
        running = lu.all_tasks()
        if running:
            raise SystemCorrupted("%d tasks already running!" % running)

        sched = lu.scheduler()
        if sched != "Linux":
            raise SystemCorrupted("Scheduler is %s, should be Linux" % sched)
Ejemplo n.º 3
0
    def __to_linux(self):
        msgs = []

        sched = lu.scheduler()
        if sched != "Linux":
            self.log("Switching back to Linux scheduler")
            try:
                lu.switch_scheduler("Linux")
            except:
                msgs += ["Scheduler is %s, cannot switch to Linux!" % sched]

        running = lu.all_tasks()
        if running:
            msgs += ["%d real-time tasks still running!" % running]

        if msgs:
            raise SystemCorrupted("\n".join(msgs))
Ejemplo n.º 4
0
    def __to_linux(self):
        msgs = []

        sched = lu.scheduler()
        if sched != "Linux":
            self.log("Switching back to Linux scheduler")
            try:
                lu.switch_scheduler("Linux")
            except:
                msgs += ["Scheduler is %s, cannot switch to Linux!" % sched]

        running = lu.all_tasks()
        if running:
            msgs += ["%d real-time tasks still running!" % running]

        if msgs:
            raise SystemCorrupted("\n".join(msgs))