Esempio n. 1
0
 def test_job(self):
     sched = MockSchduler()
     tasks = [MockTask(i) for i in range(10)]
     job = SimpleJob(sched, tasks, 1, 10)
     ts = [job.slaveOffer('localhost') for i in range(10)]
     assert len(ts) == 10
     assert job.tasksLaunched == 10
     assert job.slaveOffer('localhost') is None
     [job.statusUpdate(t.id, 0, 'TASK_FINISHED') for t in ts]
     assert job.tasksFinished == 10
Esempio n. 2
0
 def test_job(self):
     sched = MockSchduler()
     tasks = [MockTask(i) for i in range(10)]
     job = SimpleJob(sched, tasks, 1, 10)
     ts = [job.slaveOffer('localhost') for i in range(10)]
     assert len(ts) == 10
     assert job.tasksLaunched == 10
     assert job.slaveOffer('localhost') is None
     [job.statusUpdate(t.id, 0, 'TASK_FINISHED') for t in ts]
     assert job.tasksFinished == 10
Esempio n. 3
0
 def test_retry(self):
     sched = MockSchduler()
     tasks = [MockTask(i) for i in range(10)]
     job = SimpleJob(sched, tasks)
     ts = [job.slaveOffer('localhost') for i in range(10)]
     [job.statusUpdate(t.id, 0, 'TASK_FINISHED') for t in ts[1:]]
     assert job.tasksFinished == 9
     job.statusUpdate(ts[0].id, 0, 'TASK_FAILED')
     t = job.slaveOffer('localhost1')
     assert t.id == 0
     assert job.slaveOffer('localhost') is None
     assert job.tasksLaunched == 10
     job.statusUpdate(t.id, 1, 'TASK_FINISHED')
     assert job.tasksFinished == 10
Esempio n. 4
0
 def test_retry(self):
     sched = MockSchduler()
     tasks = [MockTask(i) for i in range(10)]
     job = SimpleJob(sched, tasks)
     ts = [job.slaveOffer('localhost') for i in range(10)]
     [job.statusUpdate(t.id, 0, 'TASK_FINISHED') for t in ts[1:]]
     assert job.tasksFinished == 9
     job.statusUpdate(ts[0].id, 0, 'TASK_FAILED')
     t = job.slaveOffer('localhost1')
     assert t.id == 0
     assert job.slaveOffer('localhost') is None
     assert job.tasksLaunched == 10
     job.statusUpdate(t.id, 1, 'TASK_FINISHED')
     assert job.tasksFinished == 10