本文整理汇总了Python中job.Job.run_started_on方法的典型用法代码示例。如果您正苦于以下问题:Python Job.run_started_on方法的具体用法?Python Job.run_started_on怎么用?Python Job.run_started_on使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类job.Job
的用法示例。
在下文中一共展示了Job.run_started_on方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_run_timeout
# 需要导入模块: from job import Job [as 别名]
# 或者: from job.Job import run_started_on [as 别名]
def test_run_timeout(self):
from job_dictator import JobDictator
from job import Job
from worker import Worker
dictator = JobDictator()
dictator.client = mock.MagicMock()
dictator.client.keys.return_value = ["job-", "jm-"]
job = Job("running", "something")
job.run_started_on = datetime.now() - timedelta(minutes=10)
worker = Worker("job-", None)
dictator.client.get.side_effect = [pickle.dumps(job), pickle.dumps(worker)]
self.request_mock.get = mock.MagicMock()
dictator.settings = mock.MagicMock()
dictator.settings.job_timeout = 1
dictator.headers = mock.MagicMock()
returner = mock.MagicMock()
returner.content = "status:ok"
self.request_mock.get.return_value = returner
dictator.pull = mock.MagicMock()
dictator.aladeen()
assert dictator.client.keys.call_count == 2
assert dictator.client.get.call_count == 2
assert dictator.client.set.call_count == 1
assert dictator.client.publish.call_count == 1
assert dictator.pull.call_count == 0
assert pickle.loads(dictator.client.set.call_args_list[0][0][1]).state == "broken"