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

[spark] ray on spark creates spark job using stage scheduling #31397

Merged
merged 37 commits into from
Jan 24, 2023

Conversation

WeichenXu123
Copy link
Contributor

@WeichenXu123 WeichenXu123 commented Jan 3, 2023

Why are these changes needed?

  • ray on spark creates spark job using stage scheduling, so that ray cluster spark job can use different task resources config ( spark.task.cpus / spark.task.resource.gpu.amount ), otherwise it has to use spark application level config, which is inconvenient on Databricks. 2 new arguments are added: num_cpus_per_node and num_gpus_per_node

  • improve ray worker memory allocation computation.

  • refactor _init_ray_cluster interface, make it fit better for instrumentation logging patching (make arguments key value only, and adjust some arguments, make all arguments to be validated values)

Related issue number

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 :(

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Comment on lines +56 to +57
# TODO: Replace this with pyspark==3.4 once it is released.
https://ml-team-public-read.s3.us-west-2.amazonaws.com/pyspark-3.4.0.dev0.tar.gz
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note:

Spark stage scheduling feature (on standalone mode spark cluster) is introduced in apache/spark 3.4 (it will be released this month)

So for testing purpose, I built a package from apache/spark master

@ericl
Copy link
Contributor

ericl commented Jan 9, 2023

@amogkam @jjyao can you review this?

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
doc/source/ray-core/package-ref.rst Outdated Show resolved Hide resolved
python/ray/util/spark/cluster_init.py Outdated Show resolved Hide resolved
python/ray/util/spark/cluster_init.py Outdated Show resolved Hide resolved
python/ray/util/spark/cluster_init.py Outdated Show resolved Hide resolved
python/ray/util/spark/cluster_init.py Outdated Show resolved Hide resolved
python/ray/util/spark/cluster_init.py Outdated Show resolved Hide resolved
python/ray/util/spark/cluster_init.py Outdated Show resolved Hide resolved
python/ray/util/spark/utils.py Outdated Show resolved Hide resolved
python/ray/util/spark/utils.py Show resolved Hide resolved
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Copy link
Contributor

@amogkam amogkam left a comment

Choose a reason for hiding this comment

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

Thanks @weichen123! Overall lgtm- left some small comments.

Will leave to @jjyao for final approval and marge.

doc/source/ray-core/package-ref.rst Outdated Show resolved Hide resolved
python/ray/util/spark/__init__.py Show resolved Hide resolved
python/ray/util/spark/cluster_init.py Outdated Show resolved Hide resolved
python/ray/util/spark/cluster_init.py Show resolved Hide resolved
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
python/ray/util/spark/cluster_init.py Outdated Show resolved Hide resolved
python/ray/util/spark/cluster_init.py Outdated Show resolved Hide resolved
python/ray/util/spark/cluster_init.py Show resolved Hide resolved
python/ray/util/spark/cluster_init.py Outdated Show resolved Hide resolved
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
python/ray/util/spark/cluster_init.py Outdated Show resolved Hide resolved
python/ray/util/spark/cluster_init.py Outdated Show resolved Hide resolved
python/ray/util/spark/cluster_init.py Outdated Show resolved Hide resolved
python/ray/util/spark/cluster_init.py Outdated Show resolved Hide resolved
)


def get_avail_mem_per_ray_worker_node(
Copy link
Collaborator

Choose a reason for hiding this comment

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

can be addressed in a follow-up PR: we should add type annotations even to private methods.

@jjyao
Copy link
Collaborator

jjyao commented Jan 17, 2023

You will also need @ericl approval for doc changes.

Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
Signed-off-by: Weichen Xu <weichen.xu@databricks.com>
@WeichenXu123
Copy link
Contributor Author

CC @ericl Could you approve the doc part of the PR ? Thank you!

@WeichenXu123
Copy link
Contributor Author

CC @ericl Would you help approve the doc changes in the PR? Thank you!

Copy link
Contributor

@maxpumperla maxpumperla left a comment

Choose a reason for hiding this comment

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

approval for docs changes

@jjyao
Copy link
Collaborator

jjyao commented Jan 24, 2023

Failed tests are unrelated.

@jjyao jjyao merged commit aa7d5d9 into ray-project:master Jan 24, 2023
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.

6 participants