From 0fc4306298eadda3db96f9a8a7571a47b86d6d33 Mon Sep 17 00:00:00 2001 From: James Bourbeau Date: Wed, 5 Oct 2022 16:23:56 -0500 Subject: [PATCH 1/2] Add distributed.print and distributed.warn to API docs --- docs/source/api.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/source/api.rst b/docs/source/api.rst index 46dc4da8ba2..8da3926c829 100644 --- a/docs/source/api.rst +++ b/docs/source/api.rst @@ -66,6 +66,8 @@ The client connects to and submits computation to a Dask cluster (such as a :cla get_task_stream get_task_metadata performance_report + print + warn **Utilities** @@ -188,6 +190,8 @@ Other .. autoclass:: get_task_stream .. autoclass:: get_task_metadata .. autoclass:: performance_report +.. autofunction:: distributed.print +.. autofunction:: distributed.warn Utilities From 3cf320dba3454be2f7aaaf2fd37c67956058e4b4 Mon Sep 17 00:00:00 2001 From: James Bourbeau Date: Wed, 5 Oct 2022 19:11:40 -0500 Subject: [PATCH 2/2] Format --- distributed/worker.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/distributed/worker.py b/distributed/worker.py index e7793782258..c4a718321a5 100644 --- a/distributed/worker.py +++ b/distributed/worker.py @@ -3198,8 +3198,10 @@ def gpu_startup(worker): def print(*args, **kwargs): """Dask print function - This prints both wherever this function is run, and also in the user's - client session + + This is a wrapper around Python's built-in :external+python:py:func:`print` function + that prints both wherever this function is run, and also in the user's + client session. """ try: worker = get_worker() @@ -3217,8 +3219,10 @@ def print(*args, **kwargs): def warn(*args, **kwargs): """Dask warn function - This raises a warning both wherever this function is run, and also - in the user's client session + + This is a wrapper around Python's built-in :py:func:`warnings.warn` function + that emits a warning both wherever this function is run, and also + in the user's client session. """ try: worker = get_worker()