api/server/swagger_server/controllers_impl/dataset_service_controller_impl.py
def generate_dataset_code(id):  # noqa: E501
    """generate_dataset_code

    Generate sample code to use dataset in a pipeline.

    :param id:
    :type id: str

    :rtype: ApiGenerateCodeResponse
    """
    api_datasets: [ApiDataset] = load_data(ApiDataset, filter_dict={"id": id})

    if not api_datasets:
        return f"Dataset with id '{id}' does not exist", 404

    api_dataset = api_datasets[0]

    # TODO: could there be multiple pipeline DSL scripts, how to choose
    source_code = retrieve_file_content(bucket_name="mlpipeline", prefix=f"datasets/{id}/", file_extensions=[".py"])

    if not source_code:
        api_template, _ = get_dataset_template(id)
        source_code = generate_dataset_run_script(api_dataset, api_template.url)

    if source_code:
        generate_code_response = ApiGenerateCodeResponse(script=source_code)
        return generate_code_response, 200

    return f"Could not generate source code for dataset {id}", 500
generate_dataset_code

    Generate sample code to use dataset in a pipeline.

    :param id:
    :type id: str

    :rtype: ApiGenerateCodeResponse
    
generate_dataset_code
Generate sample code to use dataset in a pipeline.
generate_dataset_code Generate sample code to use dataset in a pipeline .
def generate_dataset_code(id):  
    api_datasets: [ApiDataset] = load_data(ApiDataset, filter_dict={"id": id})
    if not api_datasets:
        return f"Dataset with id '{id}' does not exist", 404
    api_dataset = api_datasets[0]
    source_code = retrieve_file_content(bucket_name="mlpipeline", prefix=f"datasets/{id}/", file_extensions=[".py"])
    if not source_code:
        api_template, _ = get_dataset_template(id)
        source_code = generate_dataset_run_script(api_dataset, api_template.url)
    if source_code:
        generate_code_response = ApiGenerateCodeResponse(script=source_code)
        return generate_code_response, 200
    return f"Could not generate source code for dataset {id}", 500
def generate_dataset_code ( id ) : api_datasets : [ ApiDataset ] = load_data ( ApiDataset , filter_dict = { "id" : id } ) if not api_datasets : return f"Dataset with id '{id}' does not exist" , 404 api_dataset = api_datasets [ 0 ] source_code = retrieve_file_content ( bucket_name = "mlpipeline" , prefix = f"datasets/{id}/" , file_extensions = [ ".py" ] ) if not source_code : api_template , _ = get_dataset_template ( id ) source_code = generate_dataset_run_script ( api_dataset , api_template . url ) if source_code : generate_code_response = ApiGenerateCodeResponse ( script = source_code ) return generate_code_response , 200 return f"Could not generate source code for dataset {id}" , 500
generate_dataset_code
Generate sample code to use dataset in a pipeline.
generate_dataset_code Generate sample code to use dataset in a pipeline .
# noqa: E501 """generate_dataset_code

    Generate sample code to use dataset in a pipeline.

    :param id:
    :type id: str

    :rtype: ApiGenerateCodeResponse
    """ # TODO: could there be multiple pipeline DSL scripts, how to choose
None
ApiGenerateCodeResponse
id
None