本文整理汇总了Python中application.modules.tasks.TaskApi.stop_tasks方法的典型用法代码示例。如果您正苦于以下问题:Python TaskApi.stop_tasks方法的具体用法?Python TaskApi.stop_tasks怎么用?Python TaskApi.stop_tasks使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类application.modules.tasks.TaskApi
的用法示例。
在下文中一共展示了TaskApi.stop_tasks方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: stop
# 需要导入模块: from application.modules.tasks import TaskApi [as 别名]
# 或者: from application.modules.tasks.TaskApi import stop_tasks [as 别名]
def stop(job_id):
logging.info('Stopping job {0}'.format(job_id))
job = Job.query.get(job_id)
if job.status != 'stopped':
TaskApi.stop_tasks(job.id)
job.status = 'stopped'
db.session.add(job)
db.session.commit()
else:
pass
示例2: stop
# 需要导入模块: from application.modules.tasks import TaskApi [as 别名]
# 或者: from application.modules.tasks.TaskApi import stop_tasks [as 别名]
def stop(self, job_id):
print '[info] Stopping job', job_id
# first we delete the associated jobs (no foreign keys)
job = Job.query.get(job_id)
if job:
if job.status not in ['stopped', 'completed', 'failed']:
job.status = 'stopped'
db.session.add(job)
db.session.commit()
TaskApi.stop_tasks(job.id)
else:
print('[error] Job %d not found' % job_id)
raise KeyError
示例3: stop
# 需要导入模块: from application.modules.tasks import TaskApi [as 别名]
# 或者: from application.modules.tasks.TaskApi import stop_tasks [as 别名]
def stop(self, job_id):
logging.info("Stopped job {0}".format(job_id))
# first we stop the associated tasks (no foreign keys)
job = Job.query.get(job_id)
if job:
if job.status not in ['stopped', 'completed', 'failed']:
job.status = 'stopped'
db.session.add(job)
db.session.commit()
TaskApi.stop_tasks(job.id)
else:
logging.error("Job {0} not found".format(job_id))
raise KeyError
示例4: stop
# 需要导入模块: from application.modules.tasks import TaskApi [as 别名]
# 或者: from application.modules.tasks.TaskApi import stop_tasks [as 别名]
def stop(job_id):
logging.info("Stopped job {0}".format(job_id))
# first we stop the associated tasks (no foreign keys)
job = Job.query.get(job_id)
if job:
if job.status not in ['canceled', 'completed', 'failed']:
log = "Status changed from {0} to {1}".format(job.status, 'canceled')
job.status = 'canceled'
job.date_edit = datetime.now()
db.session.add(job)
db.session.commit()
log_to_database(job_id, 'job', log)
TaskApi.stop_tasks(job.id)
else:
logging.error("Job {0} not found".format(job_id))
raise KeyError