示例#1
0
 def test_job_started_queued(self):
     run_name = 'test_job_started_queued'
     run = Run(run_name)
     job_id = '42'
     job = Job(dict(name=run_name, job_id=job_id, status='queued'), run)
     job.update(dict(status='running'))
     assert job.started is not None
示例#2
0
 def test_run_status_queued_to_running(self):
     run_name = "run_status_queued_to_running"
     new_run = Run(run_name)
     job = Job(dict(job_id=1, status='queued'), new_run)
     Job(dict(job_id=2, status='queued'), new_run)
     job.update(dict(status='running'))
     assert new_run.status == 'running'
示例#3
0
文件: test_jobs.py 项目: ceph/paddles
 def test_job_started_queued(self):
     run_name = 'test_job_started_queued'
     run = Run(run_name)
     job_id = '42'
     job = Job(dict(name=run_name, job_id=job_id, status='queued'), run)
     job.update(dict(status='running'))
     assert job.started is not None
示例#4
0
文件: test_jobs.py 项目: ceph/paddles
 def test_success_updates_status(self):
     run_name = 'test_success_updates_status'
     run = Run(run_name)
     job_id = '27'
     job = Job(dict(name=run_name, job_id=job_id, status='running'), run)
     models.commit()
     job.update(dict(success=True))
     models.commit()
     assert job.status == 'pass'
示例#5
0
 def test_success_updates_status(self):
     run_name = 'test_success_updates_status'
     run = Run(run_name)
     job_id = '27'
     job = Job(dict(name=run_name, job_id=job_id, status='running'), run)
     models.commit()
     job.update(dict(success=True))
     models.commit()
     assert job.status == 'pass'
示例#6
0
文件: test_jobs.py 项目: ceph/paddles
 def test_status_dead_ignored_when_success_true(self):
     run_name = 'test_status_dead_ignored_when_success_set'
     run = Run(run_name)
     job_id = '27'
     job = Job(dict(name=run_name, job_id=job_id, status='running'), run)
     models.commit()
     job.update(dict(success=True))
     models.commit()
     job.update(dict(status='dead'))
     models.commit()
     assert job.status == 'pass'
示例#7
0
 def test_status_dead_ignored_when_success_true(self):
     run_name = 'test_status_dead_ignored_when_success_set'
     run = Run(run_name)
     job_id = '27'
     job = Job(dict(name=run_name, job_id=job_id, status='running'), run)
     models.commit()
     job.update(dict(success=True))
     models.commit()
     job.update(dict(status='dead'))
     models.commit()
     assert job.status == 'pass'
示例#8
0
文件: test_jobs.py 项目: ceph/paddles
 def test_statsd_update(self, m_get_client):
     m_client = Mock()
     m_counter = Mock()
     m_client.get_counter.return_value = m_counter
     m_get_client.return_value = m_client
     run_name = 'test_statsd_update'
     run = Run(run_name)
     job_id = '27'
     job = Job(dict(name=run_name, job_id=job_id, status='running'), run)
     models.commit()
     job.update({'status': 'pass'})
     models.commit()
     assert job.status == 'pass'
     assert m_get_client.called_once_with()
     assert m_client.get_counter.called_once_with('jobs.status')
     assert m_counter.increment.called_once_with('pass')
示例#9
0
 def test_statsd_update(self, m_get_client):
     m_client = Mock()
     m_counter = Mock()
     m_client.get_counter.return_value = m_counter
     m_get_client.return_value = m_client
     run_name = 'test_statsd_update'
     run = Run(run_name)
     job_id = '27'
     job = Job(dict(name=run_name, job_id=job_id, status='running'), run)
     models.commit()
     job.update({'status': 'pass'})
     models.commit()
     assert job.status == 'pass'
     assert m_get_client.called_once_with()
     assert m_client.get_counter.called_once_with('jobs.status')
     assert m_counter.increment.called_once_with('pass')