本文整理汇总了Python中openquake.job.Job.is_job_completed方法的典型用法代码示例。如果您正苦于以下问题:Python Job.is_job_completed方法的具体用法?Python Job.is_job_completed怎么用?Python Job.is_job_completed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openquake.job.Job
的用法示例。
在下文中一共展示了Job.is_job_completed方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_is_job_completed
# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import is_job_completed [as 别名]
def test_is_job_completed(self):
job_id = Job.from_file(helpers.get_data_path(CONFIG_FILE), 'db').job_id
session = get_db_session("reslt", "writer")
pairs = [('pending', False), ('running', False),
('succeeded', True), ('failed', True)]
for status, is_completed in pairs:
session.query(OqJob).update({'status': status})
session.commit()
self.assertEqual(Job.is_job_completed(job_id), is_completed)
示例2: test_is_job_completed
# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import is_job_completed [as 别名]
def test_is_job_completed(self):
job_id = Job.from_file(helpers.get_data_path(CONFIG_FILE), 'db').job_id
row = OqJob.objects.get(id=job_id)
pairs = [('pending', False), ('running', False),
('succeeded', True), ('failed', True)]
for status, is_completed in pairs:
row.status = status
row.save()
self.assertEqual(Job.is_job_completed(job_id), is_completed)
示例3: check_job_status
# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import is_job_completed [as 别名]
def check_job_status(job_id):
"""
Helper function which is intended to be run by celery task functions.
:raises JobCompletedError:
If :meth:`~openquake.job.Job.is_job_completed` returns ``True``
for ``job_id``.
"""
if Job.is_job_completed(job_id):
raise JobCompletedError(job_id)
示例4: check_job_status
# 需要导入模块: from openquake.job import Job [as 别名]
# 或者: from openquake.job.Job import is_job_completed [as 别名]
def check_job_status(job_id):
"""
Helper function which is intended to be run by celery task functions.
:raises JobCompletedError:
If :meth:`~openquake.job.Job.is_job_completed` returns ``True``
for ``job_id``.
"""
job = Job.from_kvs(job_id)
level = job.params.get('debug') if job and job.params else 'warn'
logs.init_logs_amqp_send(level=level, job_id=job_id)
if Job.is_job_completed(job_id):
raise JobCompletedError(job_id)