示例#1
0
def check_job_executor(data, job_id):
    job = api.get_job(job_id)
    job_type, subtype = edp.split_job_type(job.type)

    # Check if cluster contains Oozie service to run job
    main_base.check_edp_job_support(data['cluster_id'])

    # All types except Java require input and output objects
    if job_type == 'Java':
        if not _is_main_class_present(data):
            raise ex.InvalidDataException('Java job must '
                                          'specify edp.java.main_class')
    else:
        if not ('input_id' in data and 'output_id' in data):
            raise ex.InvalidDataException("%s job requires 'input_id' "
                                          "and 'output_id'" % job.type)

        b.check_data_source_exists(data['input_id'])
        b.check_data_source_exists(data['output_id'])

        b.check_data_sources_are_different(data['input_id'], data['output_id'])

        if job_type == 'MapReduce' and (
                subtype == 'Streaming' and not _streaming_present(data)):
            raise ex.InvalidDataException("%s job "
                                          "must specify streaming mapper "
                                          "and reducer" % job.type)

    main_base.check_cluster_exists(data['cluster_id'])
示例#2
0
    def test_check_edp_job_support(self, get_job, get_cluster):
        get_job.return_value = FakeJob()
        self._assert_create_object_validation(
            data={
                "cluster_id": six.text_type(uuid.uuid4()),
                "input_id": six.text_type(uuid.uuid4()),
                "output_id": six.text_type(uuid.uuid4())
            },
            bad_req_i=(1, "INVALID_COMPONENT_COUNT",
                       "Hadoop cluster should contain 1 oozie component(s). "
                       "Actual oozie count is 0"))

        ng = tu.make_ng_dict('master', 42, ['oozie'], 1,
                             instances=[tu.make_inst_dict('id', 'name')])
        get_cluster.return_value = tu.create_cluster("cluster", "tenant1",
                                                     "vanilla", "1.2.1", [ng])
        validation_base.check_edp_job_support('some_id')
示例#3
0
    def test_check_edp_job_support(self, get_job, get_cluster):
        get_job.return_value = FakeJob()
        self._assert_create_object_validation(
            data={
                "cluster_id": six.text_type(uuid.uuid4()),
                "input_id": six.text_type(uuid.uuid4()),
                "output_id": six.text_type(uuid.uuid4())
            },
            bad_req_i=(1, "INVALID_COMPONENT_COUNT",
                       "Hadoop cluster should contain 1 oozie components. "
                       "Actual oozie count is 0"))

        ng = tu.make_ng_dict('master',
                             42, ['oozie'],
                             1,
                             instances=[tu.make_inst_dict('id', 'name')])
        get_cluster.return_value = tu.create_cluster("cluster", "tenant1",
                                                     "vanilla", "1.2.1", [ng])
        validation_base.check_edp_job_support('some_id')