예제 #1
0
파일: job_test.py 프로젝트: atallahade/Tron
 def setup_job(self):
     self.scheduler = scheduler.ConstantScheduler()
     mock_graph = mock.Mock(autospec=True)
     mock_graph.get_action_map.return_value = {}
     mock_graph.action_map = {}
     self.job = mock.Mock(autospec=True)
     self.job.allow_overlap = False
     self.job.max_runtime = datetime.timedelta(days=1)
     self.job_scheduler = JobScheduler(job=self.job)
예제 #2
0
 def build_job(self):
     self.test_dir = tempfile.mkdtemp()
     self.action = action.Action(name="Test Action")
     self.action.command = "Test Action Command"
     self.job = job.Job("Test Job", self.action)
     self.job.node_pool = node.NodePool("host")
     self.job.output_dir = self.test_dir
     self.action.job = self.job
     self.job.scheduler = scheduler.ConstantScheduler()
예제 #3
0
 def build_scheduler(self):
     self.test_dir = tempfile.mkdtemp()
     self.scheduler = scheduler.ConstantScheduler()
     self.action = action.Action("Test Action")
     self.action.command = "Test Command"
     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
예제 #4
0
    def test_next_run(self):
        assert_equals(self.job.next_runs(), [])
        
        self.action.scheduler = turtle.Turtle()
        self.action.scheduler.next_run = lambda j:None

        assert_equals(self.job.next_runs(), [])
        assert_equals(get_num_runs_by_state(self.job, action.ACTION_RUN_SCHEDULED), 0)

        self.job.scheduler = scheduler.ConstantScheduler()
        assert self.job.next_runs()[0]
        assert_equals(get_num_runs_by_state(self.job, action.ACTION_RUN_SCHEDULED), 1)
예제 #5
0
 def build_scheduler(self):
     self.scheduler = scheduler.ConstantScheduler()