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

[Ray] Implements get_total_n_cpu for Ray execution context #3059

Conversation

fyrestone
Copy link
Contributor

What do these changes do?

  • Implements get_total_n_cpu for Ray execution context.

Related issue number

#2893

Check code requirements

  • tests added / passed (if needed)
  • Ensure all linting tests pass, see here for how to run them

@fyrestone fyrestone self-assigned this May 20, 2022
@fyrestone fyrestone changed the title Implements get_total_n_cpu for Ray execution context [Ray] Implements get_total_n_cpu for Ray execution context May 20, 2022
@fyrestone fyrestone marked this pull request as ready for review May 20, 2022 11:31
@fyrestone fyrestone requested a review from a team as a code owner May 20, 2022 11:31
@implements(Context.get_total_n_cpu)
def get_total_n_cpu(self) -> int:
# TODO(fyrestone): Support auto scaling.
return self._config.get_n_cpu() * self._config.get_n_worker()
Copy link
Contributor

Choose a reason for hiding this comment

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

  • What happed if n_cpu and n_worker not configured into ray config?
  • Seems no case cover this

Copy link
Contributor

Choose a reason for hiding this comment

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

Why mars doesn't need to implement get_total_n_cpu?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  • What happed if n_cpu and n_worker not configured into ray config?
  • Seems no case cover this

The n_cpu and n_worker will be set when starting local cluster: https://github.com/mars-project/mars/blob/master/mars/deploy/oscar/local.py#L162. If these fields are not set, there should be a bug.

Mars backend has implemented the get_total_n_cpu API: https://github.com/mars-project/mars/blob/master/mars/services/context.py#L113

Copy link
Contributor

@zhongchun zhongchun left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Collaborator

@qinxuye qinxuye left a comment

Choose a reason for hiding this comment

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

LGTM

@qinxuye qinxuye merged commit 660098c into mars-project:master May 23, 2022
@wjsi wjsi added to be backported Indicate that the PR need to be backported to stable branch mod: ray integration labels May 24, 2022
@qinxuye qinxuye added the type: enhancement request label May 28, 2022
@qinxuye qinxuye added this to the v0.10.0a1 milestone May 28, 2022
qinxuye pushed a commit to qinxuye/mars that referenced this pull request Jun 1, 2022
wjsi pushed a commit that referenced this pull request Jun 1, 2022
@wjsi wjsi added backported already PR has been backported and removed to be backported Indicate that the PR need to be backported to stable branch labels Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants