def test_failed_to_cancel_job(self, time_get, cluster_get, job_exec_get, job_get, job_execution_update_get): info = {"status": edp.JOB_STATUS_RUNNING} job, job_exec = u.create_job_exec(edp.JOB_TYPE_PIG, None, False, info) job_exec_get.return_value = job_exec job_get.return_value = job cluster = u.create_cluster() cluster.status = c_u.CLUSTER_STATUS_ACTIVE cluster_get.return_value = cluster time_get.return_value = 10000 job_execution_update_get.return_value = job_exec with testtools.ExpectedException(ex.CancelingFailed): job_manager.cancel_job(job_exec.id)
def test_failed_to_cancel_job(self, time_get, cluster_get, job_exec_get, job_get, job_execution_update_get): info = {'status': edp.JOB_STATUS_RUNNING} job, job_exec = u.create_job_exec(edp.JOB_TYPE_PIG, None, False, info) job_exec_get.return_value = job_exec job_get.return_value = job cluster = u.create_cluster() cluster.status = c_u.CLUSTER_STATUS_ACTIVE cluster_get.return_value = cluster time_get.return_value = 10000 job_execution_update_get.return_value = job_exec with testtools.ExpectedException(ex.CancelingFailed): job_manager.cancel_job(job_exec.id)
def _delete_job_execution(job_execution_id): try: job_execution = job_manager.cancel_job(job_execution_id) if not job_execution: # job_execution was deleted already, nothing to do return except exceptions.CancelingFailed: LOG.error("Job execution can't be cancelled in time. " "Deleting it anyway.") conductor.job_execution_destroy(context.ctx(), job_execution_id)
def _cancel_job_execution(job_execution_id): job_manager.cancel_job(job_execution_id)
def cancel_job_execution(id): return manager.cancel_job(id)