Skip to content

Commit

Permalink
[Doc] Run pre-commit on core docs (#47004)
Browse files Browse the repository at this point in the history
## Why are these changes needed?

Currently we have no linting on any part of the docs code. This PR runs
pre-commit on the core docs.

This PR fixes the following issues:

```
trim trailing whitespace.................................................Failed
- hook id: trailing-whitespace
- exit code: 1
- files were modified by this hook

Fixing doc/source/ray-core/examples/overview.rst
Fixing doc/source/ray-core/scheduling/placement-group.rst
Fixing doc/source/ray-core/doc_code/streaming_generator.py
Fixing doc/source/ray-core/tasks.rst
Fixing doc/source/ray-core/actors/terminating-actors.rst
Fixing doc/source/ray-core/scheduling/ray-oom-prevention.rst
Fixing doc/source/ray-core/objects/serialization.rst
Fixing doc/source/ray-core/using-ray-with-jupyter.rst
Fixing doc/source/ray-core/doc_code/ray-dag.py
Fixing doc/source/ray-core/fault_tolerance/tasks.rst
Fixing doc/source/ray-core/actors.rst

fix end of files.........................................................Failed
- hook id: end-of-file-fixer
- exit code: 1
- files were modified by this hook

Fixing doc/source/ray-core/user-spawn-processes.rst
Fixing doc/source/ray-core/api/cli.rst
Fixing doc/source/ray-core/images/oom_killer_example_killed_two.svg
Fixing doc/source/ray-core/examples/lm/preprocess.sh
Fixing doc/source/ray-core/examples/plot_hyperparameter.ipynb
Fixing doc/source/ray-core/patterns/concurrent-operations-async-actor.rst
Fixing doc/source/ray-core/images/oom_killer_example_killed_one.svg
Fixing doc/source/ray-core/images/memory.svg
Fixing doc/source/ray-core/actors/terminating-actors.rst
Fixing doc/source/ray-core/scheduling/resources.rst
Fixing doc/source/ray-core/images/oom_killer_example.svg
Fixing doc/source/ray-core/accelerator-types.rst
Fixing doc/source/ray-core/examples/images/batch-training.svg
Fixing doc/source/ray-core/images/physical_resources_vs_logical_resources.svg
Fixing doc/source/ray-core/images/pong-arch.svg
Fixing doc/source/ray-core/fault_tolerance/actors.rst
Fixing doc/source/ray-core/examples/images/automl.svg
Fixing doc/source/ray-core/examples/BUILD

check for added large files..............................................Passed
check python ast.........................................................Passed
check json...............................................................Passed
check toml...........................................(no files to check)Skipped
black....................................................................Passed
flake8...................................................................Passed
prettier.............................................(no files to check)Skipped
mypy.................................................(no files to check)Skipped
isort (python)...........................................................Passed
rst directives end with two colons.......................................Passed
rst ``inline code`` next to normal text..................................Failed
- hook id: rst-inline-touching-normal
- exit code: 1

doc/source/ray-core/actors.rst:427:Ray tracks all child and Actor Tasks. When the``recursive=True`` argument is given,

use logger.warning(......................................................Passed
check for not-real mock methods..........................................Passed
ShellCheck v0.9.0........................................................Passed
clang-format.........................................(no files to check)Skipped
Google Java Formatter................................(no files to check)Skipped
Check for Ray docstyle violations........................................Passed
Check for Ray import order violations....................................Passed
```



## Related issue number

Part of #42587.

## Checks

- [x] I've signed off every commit(by using the -s flag, i.e., `git
commit -s`) in this PR.
- [x] I've run `scripts/format.sh` to lint the changes in this PR.
- [x] I've included any doc changes needed for
https://docs.ray.io/en/master/.
- [ ] I've added any new APIs to the API Reference. For example, if I
added a
method in Tune, I've added it in `doc/source/tune/api/` under the
           corresponding `.rst` file.
- [x] I've made sure the tests are passing. Note that there might be a
few flaky tests, see the recent failures at https://flakey-tests.ray.io/
- Testing Strategy
   - [x] Unit tests
   - [ ] Release tests
   - [ ] This PR is not tested :(

Signed-off-by: pdmurray <peynmurray@gmail.com>
  • Loading branch information
peytondmurray authored Aug 27, 2024
1 parent bbef0fe commit 579995c
Show file tree
Hide file tree
Showing 28 changed files with 53 additions and 55 deletions.
2 changes: 1 addition & 1 deletion doc/source/ray-core/accelerator-types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ Accelerator Types
Ray supports the following accelerator types:

.. literalinclude:: ../../../python/ray/util/accelerators/accelerators.py
:language: python
:language: python
14 changes: 7 additions & 7 deletions doc/source/ray-core/actors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Use `ray list actors` from :ref:`State API <state-api-overview-ref>` to see acto
Stats:
------------------------------
Total: 1
Table:
------------------------------
ACTOR_ID CLASS_NAME STATE JOB_ID NAME NODE_ID PID RAY_NAMESPACE
Expand Down Expand Up @@ -403,17 +403,17 @@ Cancel Actor Tasks by calling :func:`ray.cancel() <ray.cancel>` on the returned
In Ray, Task cancellation behavior is contingent on the Task's current state:
**Unscheduled Tasks**:
If the Actor Task hasn't been scheduled yet, Ray attempts to cancel the scheduling.
When successfully cancelled at this stage, invoking ``ray.get(actor_task_ref)``
If the Actor Task hasn't been scheduled yet, Ray attempts to cancel the scheduling.
When successfully cancelled at this stage, invoking ``ray.get(actor_task_ref)``
produce a :class:`TaskCancelledError <ray.exceptions.TaskCancelledError>`.
**Running Actor Tasks (Regular Actor, Threaded Actor)**:
For tasks classified as a single-threaded Actor or a multi-threaded Actor,
Ray offers no mechanism for interruption.
**Running Async Actor Tasks**:
For Tasks classified as `async Actors <_async-actors>`, Ray seeks to cancel the associated `asyncio.Task`.
This cancellation approach aligns with the standards presented in
For Tasks classified as `async Actors <_async-actors>`, Ray seeks to cancel the associated `asyncio.Task`.
This cancellation approach aligns with the standards presented in
`asyncio task cancellation <https://docs.python.org/3/library/asyncio-task.html#task-cancellation>`__.
Note that `asyncio.Task` won't be interrupted in the middle of execution if you don't `await` within the async function.
Expand All @@ -424,7 +424,7 @@ the Task might not be cancelled.
You can check if a Task was successfully cancelled using ``ray.get(actor_task_ref)``.
**Recursive Cancellation**:
Ray tracks all child and Actor Tasks. When the``recursive=True`` argument is given,
Ray tracks all child and Actor Tasks. When the ``recursive=True`` argument is given,
it cancels all child and Actor Tasks.
Scheduling
Expand Down Expand Up @@ -466,7 +466,7 @@ define can run. This also implies that tasks are scheduled more flexibly,
and that if you don't need the stateful part of an actor, you're mostly
better off using tasks.
Task Events
Task Events
-----------
By default, Ray traces the execution of actor tasks, reporting task status events and profiling events
Expand Down
6 changes: 3 additions & 3 deletions doc/source/ray-core/actors/terminating-actors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ Use `ray list actors --detail` from :ref:`State API <state-api-overview-ref>` to
serialized_runtime_env: '{}'
required_resources: {}
death_cause:
actor_died_error_context: # <---- You could see the error message w.r.t why the actor exits.
actor_died_error_context: # <---- You could see the error message w.r.t why the actor exits.
error_message: The actor is dead because `ray.kill` killed it.
owner_id: 01000000ffffffffffffffffffffffffffffffffffffffffffffffff
owner_ip_address: 127.0.0.1
Expand Down Expand Up @@ -153,7 +153,7 @@ Note that this method of termination waits until any previously submitted
tasks finish executing and then exits the process gracefully with sys.exit.



You could see the actor is dead as a result of the user's `exit_actor()` call:

.. code-block:: bash
Expand Down Expand Up @@ -190,4 +190,4 @@ You could see the actor is dead as a result of the user's `exit_actor()` call:
never_started: false
is_detached: false
placement_group_id: null
repr_name: ''
repr_name: ''
2 changes: 1 addition & 1 deletion doc/source/ray-core/api/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,4 @@ This section contains commands to enable/disable :ref:`Ray usage stats <ref-usag

.. click:: ray.scripts.scripts:enable_usage_stats
:prog: ray enable-usage-stats
:show-nested:
:show-nested:
4 changes: 2 additions & 2 deletions doc/source/ray-core/doc_code/ray-dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,10 @@ def __init__(self):
def forward(self, input_data: int):
self.forwarded += 1
return input_data + 1

def num_forwarded(self):
return self.forwarded

# Create an actor via ``remote`` API not ``bind`` API to avoid
# killing actors when a DAG is finished.
worker = Worker.remote()
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/doc_code/streaming_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def task():
assert len(unready) == 0
next(gen)

# Because the second yield hasn't happened yet,
# Because the second yield hasn't happened yet,
ready, unready = ray.wait([gen], timeout=0)
print("Wait for 0 seconds. The next item is not ready.")
print(ready, unready)
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/examples/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ filegroup(
name = "core_examples",
srcs = glob(["*.ipynb"]),
visibility = ["//doc:__subpackages__"]
)
)
2 changes: 1 addition & 1 deletion doc/source/ray-core/examples/images/automl.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion doc/source/ray-core/examples/images/batch-training.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion doc/source/ray-core/examples/lm/preprocess.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ fairseq-preprocess \
--validpref wikitext-103-raw/wiki.valid.bpe \
--testpref wikitext-103-raw/wiki.test.bpe \
--destdir data-bin/wikitext-103 \
--workers 60
--workers 60
4 changes: 2 additions & 2 deletions doc/source/ray-core/examples/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Beginner
* - :doc:`A Gentle Introduction to Ray Core by Example <gentle_walkthrough>`
* - :doc:`Using Ray for Highly Parallelizable Tasks <highly_parallel>`
* - :doc:`Monte Carlo Estimation of π <monte_carlo_pi>`


Intermediate
------------
Expand All @@ -37,7 +37,7 @@ Advanced
--------

.. list-table::

* - :doc:`Build Simple AutoML for Time Series Using Ray <automl_for_time_series>`
* - :doc:`Build Batch Prediction Using Ray <batch_prediction>`
* - :doc:`Build a Simple Parameter Server Using Ray <plot_parameter_server>`
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/examples/plot_hyperparameter.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -314,4 +314,4 @@
},
"nbformat": 4,
"nbformat_minor": 5
}
}
1 change: 0 additions & 1 deletion doc/source/ray-core/fault_tolerance/actors.rst
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,3 @@ Retry behavior depends on the value you set ``retry_exceptions`` to:
- The default value,`0`.

For example, if a method sets `max_task_retries=5` and `retry_exceptions=True`, and the actor sets `max_restarts=2`, Ray executes the method up to 6 times: once for the initial invocation, and 5 additional retries. The 6 invocations may include 2 actor crashes. After the 6th invocation, a `ray.get` call to the result Ray ObjectRef raises the exception raised in the last invocation, or `ray.exceptions.RayActorError` if the actor crashed in the last invocation.

2 changes: 1 addition & 1 deletion doc/source/ray-core/fault_tolerance/tasks.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Use `ray list tasks` from :ref:`State API CLI <state-api-overview-ref>` to query
.. code-block:: bash
# This API is only available when you download Ray via `pip install "ray[default]"`
ray list tasks
ray list tasks
.. code-block:: bash
Expand Down
2 changes: 1 addition & 1 deletion doc/source/ray-core/images/memory.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion doc/source/ray-core/images/oom_killer_example.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion doc/source/ray-core/images/pong-arch.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 579995c

Please sign in to comment.