Ejemplo n.º 1
0
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"))
Ejemplo n.º 2
0
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"))
Ejemplo n.º 3
0
 def test_get_plugin(self):
     plugin = job_utils.get_plugin(u.create_cluster())
     self.assertEqual("vanilla", plugin.name)
Ejemplo n.º 4
0
 def __init__(self, cluster):
     self.cluster = cluster
     self.plugin = job_utils.get_plugin(self.cluster)
Ejemplo n.º 5
0
def _get_job_engine(cluster, job_execution):
    return job_utils.get_plugin(cluster).get_edp_engine(cluster,
                                                        _get_job_type(
                                                            job_execution))
Ejemplo n.º 6
0
 def test_get_plugin(self):
     plugin = job_utils.get_plugin(u.create_cluster())
     self.assertEqual("vanilla", plugin.name)
Ejemplo n.º 7
0
def _get_job_engine(cluster, job_execution):
    return job_utils.get_plugin(cluster).get_edp_engine(
        cluster, _get_job_type(job_execution))
Ejemplo n.º 8
0
def get_plugin(cluster, **kwargs):
    return job_utils.get_plugin(cluster)
Ejemplo n.º 9
0
 def __init__(self, cluster):
     self.cluster = cluster
     self.plugin = job_utils.get_plugin(self.cluster)
Ejemplo n.º 10
0
def get_plugin(cluster, **kwargs):
    return job_utils.get_plugin(cluster)