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

[Doc] Revamp ray core design patterns doc [11/n]: limit running tasks #29046

Merged
merged 12 commits into from
Oct 6, 2022

Conversation

jjyao
Copy link
Collaborator

@jjyao jjyao commented Oct 4, 2022

Signed-off-by: Jiajun Yao [email protected]

Why are these changes needed?

Create a new design pattern for limiting the number of running tasks. Also distinguish it from an existing pattern of limiting pending tasks given there are confusions about these two patterns.

Related issue number

#27048

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
  • 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
    • Unit tests
    • Release tests
    • This PR is not tested :(

@jjyao jjyao marked this pull request as ready for review October 4, 2022 22:53
@jjyao jjyao requested a review from a team as a code owner October 4, 2022 22:53
@jjyao jjyao requested a review from jianoaix October 4, 2022 22:53
Copy link
Member

@Yard1 Yard1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, 2 nits

Signed-off-by: Jiajun Yao <[email protected]>
Copy link
Contributor

@jianoaix jianoaix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Jiajun for making this more clear!


.. note::

If you submit a finite number of tasks, it's unlikely that you will hit the issue mentioned above since each task only uses a small amount of memory in the queue.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"each task" -> "each task spec" (or whatever we call it)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

task spec is internal implementation details. I feel just calling task is better. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice to make it clear the memory usage at this point is only for bookkeeping of tasks, not the memory actually used by tasks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.

doc/source/ray-core/patterns/limit-pending-tasks.rst Outdated Show resolved Hide resolved
doc/source/ray-core/patterns/limit-running-tasks.rst Outdated Show resolved Hide resolved
Signed-off-by: Jiajun Yao <[email protected]>
doc/source/ray-core/patterns/limit-pending-tasks.rst Outdated Show resolved Hide resolved
doc/source/ray-core/patterns/limit-pending-tasks.rst Outdated Show resolved Hide resolved
doc/source/ray-core/patterns/limit-running-tasks.rst Outdated Show resolved Hide resolved

You have a data processing workload that processes each input file independently using Ray :ref:`remote functions <ray-remote-functions>`.
Since each task needs to load the input data into heap memory and do the processing, running too many of them can cause OOM.
In this case, you can use the ``memory`` resource to limit the number of concurrently running tasks (usage of other resources like ``num_cpus`` can achieve the same goal as well).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably add a note to clarify that memory is a logical resource.

Also, it would be nice to link or mention @clarng's ongoing memory monitor work.

Signed-off-by: Jiajun Yao <[email protected]>
Copy link
Contributor

@stephanie-wang stephanie-wang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last comments!

doc/source/ray-core/patterns/limit-running-tasks.rst Outdated Show resolved Hide resolved

.. note::

There is active work ongoing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops. Yea, I was trying to link to @clarng' work but seems that part of doc is not checked in yet. So I'll leave it out for now.

@jjyao jjyao merged commit b9a8e8f into ray-project:master Oct 6, 2022
@jjyao jjyao deleted the jjyao/limiting branch October 6, 2022 06:41
WeichenXu123 pushed a commit to WeichenXu123/ray that referenced this pull request Dec 19, 2022
…ray-project#29046)

Create a new design pattern for limiting the number of running tasks. Also distinguish it from an existing pattern of limiting pending tasks given there are confusions about these two patterns.

Signed-off-by: Jiajun Yao <[email protected]>
Signed-off-by: Stephanie Wang <[email protected]>
Co-authored-by: Stephanie Wang <[email protected]>
Signed-off-by: Weichen Xu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants