def check_job_status_update(job_execution_id, data): ctx = context.ctx() job_execution = conductor.job_execution_get(ctx, job_execution_id) # check we are updating status if 'info' in data: if 'status' in data['info']: if len(data) != 1: raise ex.InvalidJobStatus(_("Invalid status parameter")) cluster = conductor.cluster_get(ctx, job_execution.cluster_id) engine = j_u.get_plugin(cluster).get_edp_engine( cluster, conductor.job_get(ctx, job_execution_id).type) if cluster is None or cluster.status != c_u.CLUSTER_STATUS_ACTIVE: raise ex.InvalidDataException( _("Suspending operation can not be performed on an inactive or " "non-existent cluster")) if not (engine.does_engine_implement('suspend_job')): raise ex.InvalidReferenceException( _("Engine doesn't support suspending job feature"))
def test_get_plugin(self): plugin = job_utils.get_plugin(u.create_cluster()) self.assertEqual("vanilla", plugin.name)
def __init__(self, cluster): self.cluster = cluster self.plugin = job_utils.get_plugin(self.cluster)
def _get_job_engine(cluster, job_execution): return job_utils.get_plugin(cluster).get_edp_engine(cluster, _get_job_type( job_execution))
def _get_job_engine(cluster, job_execution): return job_utils.get_plugin(cluster).get_edp_engine( cluster, _get_job_type(job_execution))
def get_plugin(cluster, **kwargs): return job_utils.get_plugin(cluster)