Skip to content

Commit

Permalink
[Core] Adding image_uri to docstring of runtime_env (#48884)
Browse files Browse the repository at this point in the history
Signed-off-by: Japneet Singh <[email protected]>
  • Loading branch information
japneet-anyscale authored Dec 4, 2024
1 parent 80e698d commit 53233d9
Showing 1 changed file with 25 additions and 17 deletions.
42 changes: 25 additions & 17 deletions python/ray/runtime_env/runtime_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,21 +180,21 @@ class RuntimeEnv(dict):
.. code-block:: python
from ray.runtime_env import RuntimeEnv
# Invoke a remote task that will run in a specified runtime environment.
# Invoke a remote task that runs in a specified runtime environment.
f.options(runtime_env=RuntimeEnv(...)).remote()
# Instantiate an actor that will run in a specified runtime environment.
# Instantiate an actor that runs in a specified runtime environment.
actor = SomeClass.options(runtime_env=RuntimeEnv(...)).remote()
# Specify a runtime environment in the task definition. Future invocations via
# `g.remote()` will use this runtime environment unless overridden by using
# `g.remote()` use this runtime environment unless overridden by using
# `.options()` as above.
@ray.remote(runtime_env=RuntimeEnv(...))
def g():
pass
# Specify a runtime environment in the actor definition. Future instantiations
# via `MyClass.remote()` will use this runtime environment unless overridden by
# via `MyClass.remote()` use this runtime environment unless overridden by
# using `.options()` as above.
@ray.remote(runtime_env=RuntimeEnv(...))
class MyClass:
Expand Down Expand Up @@ -222,36 +222,41 @@ class MyClass:
pip={"packages":["tensorflow", "requests"], "pip_check": False,
"pip_version": "==22.0.2;python_version=='3.8.11'"})
# Example for using image_uri
RuntimeEnv(
image_uri="rayproject/ray:2.39.0-py312-cu123")
Args:
py_modules: List of URIs (either in the GCS or external
storage), each of which is a zip file that will be unpacked and
inserted into the PYTHONPATH of the workers.
storage), each of which is a zip file that Ray unpacks and
inserts into the PYTHONPATH of the workers.
working_dir: URI (either in the GCS or external storage) of a zip
file that will be unpacked in the directory of each task/actor.
file that Ray unpacks in the directory of each task/actor.
pip: Either a list of pip packages, a string
containing the path to a pip requirements.txt file, or a python
containing the path to a pip requirements.txt file, or a Python
dictionary that has three fields: 1) ``packages`` (required, List[str]): a
list of pip packages, 2) ``pip_check`` (optional, bool): whether enable
pip check at the end of pip install, defaults to False.
3) ``pip_version`` (optional, str): the version of pip, Ray will spell
3) ``pip_version`` (optional, str): the version of pip, Ray prepends
the package name "pip" in front of the ``pip_version`` to form the final
requirement string, the syntax of a requirement specifier is defined in
full in PEP 508.
uv: Either a list of pip packages, or a python dictionary that has one field:
uv: Either a list of pip packages, or a Python dictionary that has one field:
1) ``packages`` (required, List[str]).
conda: Either the conda YAML config, the name of a
local conda env (e.g., "pytorch_p36"), or the path to a conda
environment.yaml file.
The Ray dependency will be automatically injected into the conda
env to ensure compatibility with the cluster Ray. The conda name
may be mangled automatically to avoid conflicts between runtime
envs.
This field cannot be specified at the same time as the 'pip' field.
To use pip with conda, please specify your pip dependencies within
Ray automatically injects the dependency into the conda
env to ensure compatibility with the cluster Ray. Ray may automatically
mangle the conda name to avoid conflicts between runtime envs.
This field can't be specified at the same time as the 'pip' field.
To use pip with conda, specify your pip dependencies within
the conda YAML config:
https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#create-env-file-manually
container: Require a given (Docker) container image,
The Ray worker process will run in a container with this image.
The Ray worker process runs in a container with this image.
This parameter only works alone, or with the ``config`` or
``env_vars`` parameters.
The `run_options` list spec is here:
https://docs.docker.com/engine/reference/run/
env_vars: Environment variables to set.
Expand All @@ -266,6 +271,9 @@ class MyClass:
config: config for runtime environment. Either
a dict or a RuntimeEnvConfig. Field: (1) setup_timeout_seconds, the
timeout of runtime environment creation, timeout is in seconds.
image_uri: URI to a container image. The Ray worker process runs
in a container with this image. This parameter only works alone,
or with the ``config`` or ``env_vars`` parameters.
"""

known_fields: Set[str] = {
Expand Down

0 comments on commit 53233d9

Please sign in to comment.