def kill_batch(batch_id): batch = BPBatch() batch.select(batch_id) jobs = batch.select_jobs(by_status = [JS_SUBMITTED, JS_RUNNING]) bputilities.kill_jobs([job.job_id for run, job, status in jobs]) for run, job, status in jobs: job.update_status(JS_ABORTED)
def kill_one(run): batch = BPBatch() batch.select(run.batch_id) jobs = batch.select_jobs(by_status = [JS_SUBMITTED, JS_RUNNING], by_run=run.run_id) bputilities.kill_jobs([job.job_id for run, job, status in jobs]) for job in jobs: job.update_status(JS_ABORTED)
def kill_batch(batch_id): batch = BPBatch.select(batch_id) tasks = batch.select_queued_tasks() jobs = {} for task in tasks: if task.job.job_id not in jobs: jobs[task.job.job_id] = task.job bputilities.kill_jobs(jobs.keys()) with bpcursor() as cursor: for task in tasks: BPJobTaskStatus.create(cursor, task, JS_ABORTED)
def kill_job(job): bputilities.kill_jobs([job.job_id]) with bpcursor() as cursor: for task in job.select_queued_tasks(): BPJobTaskStatus.create(cursor, task, JS_ABORTED)
def kill_job(job): bputilities.kill_jobs([job.job_id]) job.update_status(JS_ABORTED)