python/ray/_private/runtime_env/packaging.py
def upload_package_if_needed(
    pkg_uri: str,
    base_directory: str,
    directory: str,
    include_parent_dir: bool = False,
    excludes: Optional[List[str]] = None,
    logger: Optional[logging.Logger] = default_logger,
) -> bool:
    """Upload the contents of the directory under the given URI.

    This will first create a temporary zip file under the passed
    base_directory.

    If the package already exists in storage, this is a no-op.

    Args:
        pkg_uri: URI of the package to upload.
        base_directory: Directory where package files are stored.
        directory: Directory to be uploaded.
        include_parent_dir: If true, includes the top-level directory as a
            directory inside the zip file.
        excludes: List specifying files to exclude.
    """
    if excludes is None:
        excludes = []

    if logger is None:
        logger = default_logger

    if package_exists(pkg_uri):
        return False

    package_file = Path(_get_local_path(base_directory, pkg_uri))
    create_package(
        directory,
        package_file,
        include_parent_dir=include_parent_dir,
        excludes=excludes,
    )

    upload_package_to_gcs(pkg_uri, package_file.read_bytes())

    # Remove the local file to avoid accumulating temporary zip files.
    package_file.unlink()

    return True
Upload the contents of the directory under the given URI.

    This will first create a temporary zip file under the passed
    base_directory.

    If the package already exists in storage, this is a no-op.

    Args:
        pkg_uri: URI of the package to upload.
        base_directory: Directory where package files are stored.
        directory: Directory to be uploaded.
        include_parent_dir: If true, includes the top-level directory as a
            directory inside the zip file.
        excludes: List specifying files to exclude.
    
Upload the contents of the directory under the given URI.
This will first create a temporary zip file under the passed
base_directory.

If the package already exists in storage, this is a no-op.
Upload the contents of the directory under the given URI . This will first create a temporary zip file under the passed base_directory . If the package already exists in storage this is a no - op .
def upload_package_if_needed(
    pkg_uri: str,
    base_directory: str,
    directory: str,
    include_parent_dir: bool = False,
    excludes: Optional[List[str]] = None,
    logger: Optional[logging.Logger] = default_logger,
) -> bool:
    if excludes is None:
        excludes = []
    if logger is None:
        logger = default_logger
    if package_exists(pkg_uri):
        return False
    package_file = Path(_get_local_path(base_directory, pkg_uri))
    create_package(
        directory,
        package_file,
        include_parent_dir=include_parent_dir,
        excludes=excludes,
    )
    upload_package_to_gcs(pkg_uri, package_file.read_bytes())
    package_file.unlink()
    return True
def upload_package_if_needed ( pkg_uri : str , base_directory : str , directory : str , include_parent_dir : bool = False , excludes : Optional [ List [ str ] ] = None , logger : Optional [ logging . Logger ] = default_logger , ) -> bool : if excludes is None : excludes = [ ] if logger is None : logger = default_logger if package_exists ( pkg_uri ) : return False package_file = Path ( _get_local_path ( base_directory , pkg_uri ) ) create_package ( directory , package_file , include_parent_dir = include_parent_dir , excludes = excludes , ) upload_package_to_gcs ( pkg_uri , package_file . read_bytes ( ) ) package_file . unlink ( ) return True
Upload the contents of the directory under the given URI.
Upload the contents of the directory under the given URI .
"""Upload the contents of the directory under the given URI.

    This will first create a temporary zip file under the passed
    base_directory.

    If the package already exists in storage, this is a no-op.

    Args:
        pkg_uri: URI of the package to upload.
        base_directory: Directory where package files are stored.
        directory: Directory to be uploaded.
        include_parent_dir: If true, includes the top-level directory as a
            directory inside the zip file.
        excludes: List specifying files to exclude.
    """ # Remove the local file to avoid accumulating temporary zip files.
pkg_uri
str
URI of the package to upload.
URI of the package to upload .
base_directory
str
Directory where package files are stored.
Directory where package files are stored .
directory
str
Directory to be uploaded.
Directory to be uploaded .
include_parent_dir
bool
If true, includes the top-level directory as a
directory inside the zip file.
If true includes the top - level directory as a directory inside the zip file .
excludes
Optional[List[str]]
List specifying files to exclude.
List specifying files to exclude .
logger
Optional[logging.Logger]