def test_schedule_next_run(self): act = action.Action("Test Action") jo = job.Job("Test Job", act) jo.output_dir = self.test_dir jo.node_pool = turtle.Turtle() jo.scheduler = scheduler.DailyScheduler() act.job = jo act.command = "Test command" act.node = turtle.Turtle() def call_now(time, func, next): next.start() next.runs[0].succeed() callLater = mcp.reactor.callLater mcp.reactor.callLater = call_now self.mcp.schedule_next_run(jo) mcp.reactor.callLater = callLater next = jo.runs[0] assert_equals(len(filter(lambda r: r.is_success, jo.runs)), 1) assert_equals(jo.topo_actions[0], next.runs[0].action) assert next.runs[0].is_success assert next.is_success
def build_scheduler(self): self.test_dir = tempfile.mkdtemp() self.scheduler = scheduler.DailyScheduler() self.action = action.Action("Test Action") self.job = job.Job("Test Job", self.action) self.job.node_pool = turtle.Turtle() self.job.output_dir = self.test_dir self.job.scheduler = self.scheduler self.action.job = self.job
def build_scheduler(self): self.test_dir = tempfile.mkdtemp() self.scheduler = scheduler.DailyScheduler( start_time=datetime.time(hour=16, minute=30)) self.action = action.Action("Test Action - Beer Time") self.job = job.Job("Test Job", self.action) self.job.node_pool = turtle.Turtle() self.job.output_dir = self.test_dir self.job.scheduler = self.scheduler self.action.job = self.job
def setup(self): self.test_dir = tempfile.mkdtemp() self.action = action.Action(name="Test Action") self.action.command = "Test Command" self.job = job.Job("Test Job", self.action) self.job.output_dir = self.test_dir self.job.node_pool = turtle.Turtle() self.job.scheduler = scheduler.DailyScheduler() self.action.job = self.job
def setup(self): self.test_dir = tempfile.mkdtemp() self.action = action.Action(name="Test Action", node_pool=turtle.Turtle()) self.job = job.Job("Test Job", self.action) self.job.node_pool = turtle.Turtle() self.job.output_dir = self.test_dir self.job.scheduler = scheduler.DailyScheduler() self.job.queueing = True self.action.job = self.job self.action.command = "Test command" self.job_run = self.job.next_runs()[0] self.run = self.job_run.runs[0]
def setup(self): self.test_dir = tempfile.mkdtemp() self.action1 = action.Action(name="Test Act1") self.action2 = action.Action(name="Test Act1") self.action2.required_actions.append(self.action1) self.action1.command = "Test Command" self.action2.command = "Test Command" self.job = job.Job("Test Job", self.action1) self.job.output_dir = self.test_dir self.job.topo_actions.append(self.action2) self.job.scheduler = scheduler.DailyScheduler() self.job.node_pool = turtle.Turtle() self.action1.job = self.job self.action2.job = self.job
def setup(self): self.test_dir = tempfile.mkdtemp() self.action1 = action.Action(name="Test Act1") self.action1.command = "Test Command" self.job = job.Job("Test Job", self.action1) self.job.output_dir = self.test_dir self.job.scheduler = scheduler.DailyScheduler() self.job.node_pool = turtle.Turtle() self.action1.job = self.job self.job.enable_act = action.Action(name='Enable Act') self.job.enable_act.command = 'Enable Command' self.job.enable_act.job = self.job self.job.disable_act = action.Action(name='Disable Act') self.job.disable_act.command = 'Disable Command' self.job.disable_act.job = self.job
def build_job(self): self.test_dir = tempfile.mkdtemp() self.action = action.Action(name="Test Action1") self.action.command = "Test command1" self.action.node_pool = turtle.Turtle() self.dep_action = action.Action(name="Test Action2") self.dep_action.command = "Test command2" self.dep_action.node_pool = turtle.Turtle() self.dep_action.required_actions.append(self.action) self.job = job.Job("Test Job", self.action) self.job.node_pool = turtle.Turtle() self.job.output_dir = self.test_dir self.action.job = self.job self.dep_action.job = self.job self.job.topo_actions.append(self.dep_action) self.job.scheduler = scheduler.DailyScheduler() self.job_run = self.job.next_runs()[0] self.run = self.job_run.runs[0] self.dep_run = self.job_run.runs[1]