Exemple #1
0
 def run(self):
     time.sleep(5)
     jobs = job_utils.query_job(status='running', is_initiator=1)
     job_ids = set([job.f_job_id for job in jobs])
     for job_id in job_ids:
         schedule_logger(job_id).info('fate flow server start clean job')
         TaskScheduler.stop(job_id, JobStatus.FAILED)
Exemple #2
0
def stop_job():
    job_id = request.json.get('job_id')
    response = TaskScheduler.stop(job_id=job_id, end_status=JobStatus.CANCELED)
    if not response:
        TaskScheduler.stop(job_id=request.json.get('job_id', ''),
                           end_status=JobStatus.FAILED)
        return get_json_result(retcode=0, retmsg='kill job success')
    return get_json_result(retcode=0, retmsg='cancel job success')
Exemple #3
0
def stop_job():
    job_id = request.json.get('job_id')
    operate = request.json.get('operate')
    if operate == 'kill':
        TaskScheduler.stop(job_id=job_id, end_status=JobStatus.FAILED)
    else:
        response = TaskScheduler.stop(job_id=job_id,
                                      end_status=JobStatus.CANCELED)
        operate = 'cancel'
        if not response:
            TaskScheduler.stop(job_id=job_id, end_status=JobStatus.FAILED)
            operate = 'kill'
    return get_json_result(retcode=0, retmsg='{} job success'.format(operate))