api/server/swagger_server/controllers_impl/component_service_controller_impl.py
def download_component_files(id, include_generated_code=None):  # noqa: E501
    """
    Returns the component artifacts compressed into a .tgz (.tar.gz) file.

    :param id:
    :type id: str
    :param include_generated_code: Include generated run script in download
    :type include_generated_code: bool

    :rtype: file | binary
    """
    tar, bytes_io = create_tarfile(bucket_name="mlpipeline", prefix=f"components/{id}/",
                                   file_extensions=[".yaml", ".yml", ".py", ".md"],
                                   keep_open=include_generated_code)

    if len(tar.members) == 0:
        return f"Could not find component with id '{id}'", 404

    if include_generated_code:
        generate_code_response, api_status = generate_component_code(id)

        if api_status == 200:
            file_content = generate_code_response.script
            file_name = f"run_component.py"

            if file_name in tar.getnames():
                file_name = file_name.replace(".py", "_generated.py")

            tarinfo = tarfile.TarInfo(name=file_name)
            tarinfo.size = len(file_content)
            file_obj = BytesIO(file_content.encode('utf-8'))

            tar.addfile(tarinfo, file_obj)

        tar.close()

    return bytes_io.getvalue(), 200, {"Content-Disposition": f"attachment; filename={id}.tgz"}

    Returns the component artifacts compressed into a .tgz (.tar.gz) file.

    :param id:
    :type id: str
    :param include_generated_code: Include generated run script in download
    :type include_generated_code: bool

    :rtype: file | binary
    
Returns the component artifacts compressed into a .tgz (.tar.gz) file.
Returns the component artifacts compressed into a . tgz ( . tar . gz ) file .
def download_component_files(id, include_generated_code=None):  
    tar, bytes_io = create_tarfile(bucket_name="mlpipeline", prefix=f"components/{id}/",
                                   file_extensions=[".yaml", ".yml", ".py", ".md"],
                                   keep_open=include_generated_code)
    if len(tar.members) == 0:
        return f"Could not find component with id '{id}'", 404
    if include_generated_code:
        generate_code_response, api_status = generate_component_code(id)
        if api_status == 200:
            file_content = generate_code_response.script
            file_name = f"run_component.py"
            if file_name in tar.getnames():
                file_name = file_name.replace(".py", "_generated.py")
            tarinfo = tarfile.TarInfo(name=file_name)
            tarinfo.size = len(file_content)
            file_obj = BytesIO(file_content.encode('utf-8'))
            tar.addfile(tarinfo, file_obj)
        tar.close()
    return bytes_io.getvalue(), 200, {"Content-Disposition": f"attachment; filename={id}.tgz"}
def download_component_files ( id , include_generated_code = None ) : tar , bytes_io = create_tarfile ( bucket_name = "mlpipeline" , prefix = f"components/{id}/" , file_extensions = [ ".yaml" , ".yml" , ".py" , ".md" ] , keep_open = include_generated_code ) if len ( tar . members ) == 0 : return f"Could not find component with id '{id}'" , 404 if include_generated_code : generate_code_response , api_status = generate_component_code ( id ) if api_status == 200 : file_content = generate_code_response . script file_name = f"run_component.py" if file_name in tar . getnames ( ) : file_name = file_name . replace ( ".py" , "_generated.py" ) tarinfo = tarfile . TarInfo ( name = file_name ) tarinfo . size = len ( file_content ) file_obj = BytesIO ( file_content . encode ( 'utf-8' ) ) tar . addfile ( tarinfo , file_obj ) tar . close ( ) return bytes_io . getvalue ( ) , 200 , { "Content-Disposition" : f"attachment; filename={id}.tgz" }
Returns the component artifacts compressed into a .tgz (.tar.gz) file.
Returns the component artifacts compressed into a . tgz ( . tar . gz ) file .
# noqa: E501 """
    Returns the component artifacts compressed into a .tgz (.tar.gz) file.

    :param id:
    :type id: str
    :param include_generated_code: Include generated run script in download
    :type include_generated_code: bool

    :rtype: file | binary
    """
None
file | binary
id
None
include_generated_code
Include generated run script in download
Include generated run script in download