Beispiel #1
0
def stop_task(job_id, component_name, task_id, task_version, role, party_id,
              stop_status):
    tasks = JobSaver.query_task(job_id=job_id,
                                task_id=task_id,
                                task_version=task_version,
                                role=role,
                                party_id=int(party_id))
    kill_status = True
    for task in tasks:
        kill_status = kill_status & TaskController.stop_task(
            task=task, stop_status=stop_status)
    return get_json_result(
        retcode=RetCode.SUCCESS if kill_status else RetCode.EXCEPTION_ERROR,
        retmsg='success' if kill_status else 'failed')
Beispiel #2
0
 def stop_job(cls, job, stop_status):
     tasks = JobSaver.query_task(job_id=job.f_job_id,
                                 role=job.f_role,
                                 party_id=job.f_party_id,
                                 reverse=True)
     kill_status = True
     kill_details = {}
     for task in tasks:
         kill_task_status = TaskController.stop_task(
             task=task, stop_status=stop_status)
         kill_status = kill_status & kill_task_status
         kill_details[
             task.f_task_id] = 'success' if kill_task_status else 'failed'
     if kill_status:
         job_info = job.to_human_model_dict(only_primary_with=["status"])
         job_info["status"] = stop_status
         JobController.update_job_status(job_info)
     return kill_status, kill_details