Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[autoscaler] Try to improve the request_resources() documentation #12465

Merged
merged 7 commits into from
Dec 1, 2020
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions python/ray/autoscaler/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,18 +183,28 @@ def get_worker_node_ips(cluster_config: Union[dict, str]) -> List[str]:

def request_resources(num_cpus: Optional[int] = None,
bundles: Optional[List[dict]] = None) -> None:
"""Remotely request some CPU or GPU resources from the autoscaler.
"""Command the autoscaler to scale to accommodate the specified requests.

This function is to be called e.g. on a node before submitting a bunch of
ray.remote calls to ensure that resources rapidly become available.
The cluster will immediately attempt to scale to accommodate the requested
resources, bypassing normal upscaling speed constraints. This takes into
account existing resource usage.

For example, suppose you call ``request_resources(num_cpus=100)`` and
there are 45 currently running tasks, each requiring 1 CPU. Then, enough
nodes will be added so up to 100 tasks can run concurrently. It does
**not** add enough nodes so that 145 tasks can run.

This call is only a hint to the autoscaler. The actual resulting cluster
size may be slightly larger or smaller than expected depending on the
internal bin packing algorithm and max worker count restrictions.

Args:
num_cpus (int): Scale the cluster to ensure this number of CPUs are
available. This request is persistent until another call to
request_resources() is made.
request_resources() is made to override.
bundles (List[ResourceDict]): Scale the cluster to ensure this set of
resource shapes can fit. This request is persistent until another
call to request_resources() is made.
call to request_resources() is made to override.

Examples:
>>> # Request 1000 CPUs.
Expand Down