python/ray/_private/runtime_env/packaging.py
def _store_package_in_gcs(
    pkg_uri: str,
    data: bytes,
    logger: Optional[logging.Logger] = default_logger,
) -> int:
    """Stores package data in the Global Control Store (GCS).

    Args:
        pkg_uri (str): The GCS key to store the data in.
        data (bytes): The serialized package's bytes to store in the GCS.
        logger (Optional[logging.Logger]): The logger used by this function.

    Return:
        int: Size of data

    Raises:
        RuntimeError: If the upload to the GCS fails.
        ValueError: If the data's size exceeds GCS_STORAGE_MAX_SIZE.
    """

    file_size = len(data)
    size_str = _mib_string(file_size)
    if len(data) >= GCS_STORAGE_MAX_SIZE:
        raise ValueError(
            f"Package size ({size_str}) exceeds the maximum size of "
            f"{_mib_string(GCS_STORAGE_MAX_SIZE)}. You can exclude large "
            "files using the 'excludes' option to the runtime_env."
        )

    logger.info(f"Pushing file package '{pkg_uri}' ({size_str}) to Ray cluster...")
    try:
        _internal_kv_put(pkg_uri, data)
    except Exception as e:
        raise RuntimeError(
            "Failed to store package in the GCS.\n"
            f"  - GCS URI: {pkg_uri}\n"
            f"  - Package data ({size_str}): {data[:15]}...\n"
        ) from e
    logger.info(f"Successfully pushed file package '{pkg_uri}'.")
    return len(data)
Stores package data in the Global Control Store (GCS).

    Args:
        pkg_uri (str): The GCS key to store the data in.
        data (bytes): The serialized package's bytes to store in the GCS.
        logger (Optional[logging.Logger]): The logger used by this function.

    Return:
        int: Size of data

    Raises:
        RuntimeError: If the upload to the GCS fails.
        ValueError: If the data's size exceeds GCS_STORAGE_MAX_SIZE.
    
Stores package data in the Global Control Store (GCS).
Stores package data in the Global Control Store ( GCS ) .
def _store_package_in_gcs(
    pkg_uri: str,
    data: bytes,
    logger: Optional[logging.Logger] = default_logger,
) -> int:
    file_size = len(data)
    size_str = _mib_string(file_size)
    if len(data) >= GCS_STORAGE_MAX_SIZE:
        raise ValueError(
            f"Package size ({size_str}) exceeds the maximum size of "
            f"{_mib_string(GCS_STORAGE_MAX_SIZE)}. You can exclude large "
            "files using the 'excludes' option to the runtime_env."
        )
    logger.info(f"Pushing file package '{pkg_uri}' ({size_str}) to Ray cluster...")
    try:
        _internal_kv_put(pkg_uri, data)
    except Exception as e:
        raise RuntimeError(
            "Failed to store package in the GCS.\n"
            f"  - GCS URI: {pkg_uri}\n"
            f"  - Package data ({size_str}): {data[:15]}...\n"
        ) from e
    logger.info(f"Successfully pushed file package '{pkg_uri}'.")
    return len(data)
def _store_package_in_gcs ( pkg_uri : str , data : bytes , logger : Optional [ logging . Logger ] = default_logger , ) -> int : file_size = len ( data ) size_str = _mib_string ( file_size ) if len ( data ) >= GCS_STORAGE_MAX_SIZE : raise ValueError ( f"Package size ({size_str}) exceeds the maximum size of " f"{_mib_string(GCS_STORAGE_MAX_SIZE)}. You can exclude large " "files using the 'excludes' option to the runtime_env." ) logger . info ( f"Pushing file package '{pkg_uri}' ({size_str}) to Ray cluster..." ) try : _internal_kv_put ( pkg_uri , data ) except Exception as e : raise RuntimeError ( "Failed to store package in the GCS.\n" f"  - GCS URI: {pkg_uri}\n" f"  - Package data ({size_str}): {data[:15]}...\n" ) from e logger . info ( f"Successfully pushed file package '{pkg_uri}'." ) return len ( data )
Stores package data in the Global Control Store (GCS).
Stores package data in the Global Control Store ( GCS ) .
"""Stores package data in the Global Control Store (GCS).

    Args:
        pkg_uri (str): The GCS key to store the data in.
        data (bytes): The serialized package's bytes to store in the GCS.
        logger (Optional[logging.Logger]): The logger used by this function.

    Return:
        int: Size of data

    Raises:
        RuntimeError: If the upload to the GCS fails.
        ValueError: If the data's size exceeds GCS_STORAGE_MAX_SIZE.
    """
If the upload to the GCS fails.
If the upload to the GCS fails .
RuntimeError
If the data's size exceeds GCS_STORAGE_MAX_SIZE.
If the data ' s size exceeds GCS_STORAGE_MAX_SIZE .
ValueError
pkg_uri
str
The GCS key to store the data in.
The GCS key to store the data in .
data
bytes
The serialized package's bytes to store in the GCS.
The serialized package ' s bytes to store in the GCS .
logger
Optional[logging.Logger]
The logger used by this function.
The logger used by this function .