Beispiel #1
0
def upload_pipeline_to_kfp(uploadfile: str, name: str = None) -> ApiPipeline:

    config = UploadClientConfig()
    config.host = _pipeline_service_url
    api_client = UploadApiClient(configuration=config)
    api_instance = PipelineUploadServiceApi(api_client=api_client)

    try:
        kfp_pipeline: KfpPipeline = api_instance.upload_pipeline(uploadfile=uploadfile, name=name)
        api_pipeline: ApiPipeline = ApiPipeline.from_dict(kfp_pipeline.to_dict())
        api_pipeline.status = kfp_pipeline.error
        return api_pipeline

    except PipelineUploadApiException as e:
        kfp_host = api_instance.api_client.configuration.host

        print(f"Error calling PipelineServiceApi ({kfp_host}) -> upload_pipeline(name='{name}'): {e}")

        error_body = json.loads(e.body) or {"error_message": str(e)}
        error_msg = error_body["error_message"]
        status_code = 409 if "already exist. Please specify a new name" in error_msg else e.status

        raise ApiError(error_msg, status_code)

    return None
Beispiel #2
0
def upload_pipeline_to_kfp(uploadfile: str,
                           name: str = None,
                           description: str = None) -> ApiPipeline:

    kfp_client = KfpClient()

    try:
        kfp_pipeline: KfpPipeline = kfp_client.upload_pipeline(
            pipeline_package_path=uploadfile,
            pipeline_name=name,
            description=description)
        api_pipeline: ApiPipeline = ApiPipeline.from_dict(
            kfp_pipeline.to_dict())
        api_pipeline.status = kfp_pipeline.error
        return api_pipeline

    except PipelineApiException as e:
        kfp_host = _pipeline_service_url

        print(
            f"Error calling PipelineServiceApi ({kfp_host}) -> upload_pipeline(name='{name}'): {e}"
        )

        error_body = json.loads(e.body) or {"error_message": str(e)}
        error_msg = error_body["error_message"]
        status_code = 409 if "already exist. Please specify a new name" in error_msg else e.status

        raise ApiError(error_msg, status_code)

    return None
def create_pipeline(body):  # noqa: E501
    """create_pipeline

    :param body: 
    :type body: dict | bytes

    :rtype: ApiPipeline
    """
    if connexion.request.is_json:
        body = ApiPipeline.from_dict(connexion.request.get_json())  # noqa: E501

    return "Not implemented, yet", 501
def create_pipeline(body):  # noqa: E501
    """create_pipeline

     # noqa: E501

    :param body: 
    :type body: dict | bytes

    :rtype: ApiPipeline
    """
    if connexion.request.is_json:
        body = ApiPipeline.from_dict(connexion.request.get_json())  # noqa: E501
    return util.invoke_controller_impl()