Skip to content

Commit

Permalink
[Placement Group] [Doc] Fix PG doc display problem. (#14665)
Browse files Browse the repository at this point in the history
  • Loading branch information
clay4megtr authored Mar 15, 2021
1 parent d90cd54 commit ef0c91f
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions doc/source/placement-group.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,25 +148,25 @@ Let's create a placement group. Recall that each bundle is a collection of resou
# Will be scheduled because 2 cpus are reserved by the placement group.
f.options(placement_group=pg).remote()
.. code-block:: python
.. note::

gpu_bundle = {"GPU": 2}
extra_resource_bundle = {"extra_resource": 2}
When using placement groups, users should ensure that their placement groups are ready (by calling ``ray.get(pg.ready())``)
and have the proper resources. Ray assumes that the placement group will be properly created and does *not*
print a warning about infeasible tasks.

# Reserve bundles with strict pack strategy.
# It means Ray will reserve 2 "GPU" and 2 "extra_resource" on the same node (strict pack) within a Ray cluster.
# Using this placement group for scheduling actors or tasks will guarantee that they will
# be colocated on the same node.
pg = placement_group([gpu_bundle, extra_resource_bundle], strategy="STRICT_PACK")
.. code-block:: python
# Wait until placement group is created.
ray.get(pg.ready())
gpu_bundle = {"GPU": 2}
extra_resource_bundle = {"extra_resource": 2}
.. note::
# Reserve bundles with strict pack strategy.
# It means Ray will reserve 2 "GPU" and 2 "extra_resource" on the same node (strict pack) within a Ray cluster.
# Using this placement group for scheduling actors or tasks will guarantee that they will
# be colocated on the same node.
pg = placement_group([gpu_bundle, extra_resource_bundle], strategy="STRICT_PACK")
When using placement groups, users should ensure that their placement groups are ready (by calling ``ray.get(pg.ready())``)
and have the proper resources. Ray assumes that the placement group will be properly created and does *not*
print a warning about infeasible tasks.
# Wait until placement group is created.
ray.get(pg.ready())
Now let's define an actor that uses GPU. We'll also define a task that use ``extra_resources``.

Expand Down

0 comments on commit ef0c91f

Please sign in to comment.