Exemplo n.º 1
0
    def update_cube_cost(cube_name, cost):
        cube_instance = None

        try:
            kylin_rest_api = KylinRestApi()
            response = kylin_rest_api.http_put('cubes/' + cube_name + '/cost', 'cost=' + str(cost))

            if KylinRestApi.is_response_ok(response):
                cube_instance = CubeInstance.from_json(response.json())
            else:
                print response.json()
        except Exception, ex:
            pass
Exemplo n.º 2
0
    def resume_job(job_uuid):
        job_instance = None

        try:
            kylin_rest_api = KylinRestApi()
            response = kylin_rest_api.http_put('jobs/' + job_uuid + '/resume', '')

            if KylinRestApi.is_response_ok(response):
                job_instance = JobInstance.from_json(response.json())
            else:
                print response.json()
        except Exception, ex:
            pass
Exemplo n.º 3
0
    def resume_job(job_uuid):
        job_instance = None

        try:
            kylin_rest_api = KylinRestApi()
            response = kylin_rest_api.http_put('jobs/' + job_uuid + '/resume',
                                               '')

            if KylinRestApi.is_response_ok(response):
                job_instance = JobInstance.from_json(response.json())
            else:
                print response.json()
        except Exception, ex:
            pass
Exemplo n.º 4
0
    def rebuild_cube(cube_name, job_build_request):
        job_instance = None

        try:
            Kylin_rest_api = KylinRestApi()
            response = Kylin_rest_api.http_put('cubes/' + cube_name + '/rebuild', '',
                                               payload=job_build_request.to_json())

            if KylinRestApi.is_response_ok(response):
                job_instance = JobInstance.from_json(response.json())
            else:
                print response.json()
        except Exception, ex:
            print ex
Exemplo n.º 5
0
    def rebuild_cube(cube_name, job_build_request):
        job_instance = None

        try:
            Kylin_rest_api = KylinRestApi()
            response = Kylin_rest_api.http_put(
                'cubes/' + cube_name + '/rebuild',
                '',
                payload=job_build_request.to_json())

            if KylinRestApi.is_response_ok(response):
                job_instance = JobInstance.from_json(response.json())
            else:
                print response.json()
        except Exception, ex:
            print ex
Exemplo n.º 6
0
    def disable_cube(cube_name):
        status = None

        try:
            kylin_rest_api = KylinRestApi()
            response = kylin_rest_api.http_put('cubes/' + cube_name + '/disable', '')

            if KylinRestApi.is_response_ok(response):
                status = 0
            elif response is not None and response.json() and "is DISABLED" in str(response.json()):
                status = 0
            else:
                print response.json()
                # cube_request = None
        except Exception, ex:
            pass
Exemplo n.º 7
0
    def update_cube(cube_desc, model_desc, project=None):
        cube_request_result = None

        try:
            cube_request = CubeRequest.get_cube_request_from_cube_desc(cube_desc, model_desc, project)

            kylin_rest_api = KylinRestApi()
            response = kylin_rest_api.http_put('cubes', '', payload=cube_request.to_json())

            if KylinRestApi.is_response_ok(response):
                cube_request_result = CubeRequest.from_json(response.json())
                # set result to null if the operation is not successful
                if not cube_request_result.successful:
                    cube_request_result = None
                    print response.json()
            else:
                print response.json()
                # cube_request = None
        except Exception, ex:
            pass