-
Notifications
You must be signed in to change notification settings - Fork 29.3k
[SPARK-29641][PYTHON][CORE] Stage Level Sched: Add python api's and tests #28085
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
Closed
Closed
Changes from 10 commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
acdf6e8
Stage level scheduling python api support
tgravescs 24c1a96
revert pom changes
tgravescs 5647535
Fix log messages
tgravescs af69e4b
Try changing way we pass pyspark memory
tgravescs 4a7f39a
Change to use local property to pass pyspark memory
tgravescs 27e1a10
add missing api to get java map
tgravescs af602b6
Add java api test
tgravescs 2b515c8
cleanup
tgravescs a052427
fix indentation
tgravescs 6a90fbe
fix newline around markup in python
tgravescs 2d754f7
Update the version added for rdd api's
tgravescs 1071f40
make java return values immutable
tgravescs e81a480
Try reverting java api suite
tgravescs ae8e312
Fix minor review comments
tgravescs 0d7c79f
Update to pass the executor cores into PythonRunner
tgravescs 956dc84
move python files to resources module and misc fixes
tgravescs 32bca95
Fix how we pass the pyspark memory and cores
tgravescs e494c05
Fix python imports
tgravescs 3e15ed9
Fix java api suite test from hanging
tgravescs c3c885a
change test to not rely on being able to set pyspark memory after
tgravescs 3562539
Add in pyspark.resource module
tgravescs 544119e
review comments
tgravescs 8469038
Changes to allow using resource apis without SparkContext
tgravescs a0b9137
More changes to call without SparkContext
tgravescs 2235654
cleanup
tgravescs bf1a215
fix style issues
tgravescs 62cb02c
Change getResourceProfile to return None to match scala side
tgravescs a6e9ac2
Change to make python versions do same thing as the scala versions as
tgravescs 528094c
add pyspark resource module to testing module
tgravescs 89be02e
Update names of function/variable
tgravescs 354fb0c
Other variable name changes
tgravescs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
|
||
|
|
||
| class ExecutorResourceRequest(object): | ||
| """ | ||
| .. note:: Evolving | ||
|
HyukjinKwon marked this conversation as resolved.
Outdated
|
||
|
|
||
| An Executor resource request. This is used in conjunction with the ResourceProfile to | ||
| programmatically specify the resources needed for an RDD that will be applied at the | ||
| stage level. | ||
|
|
||
| This is used to specify what the resource requirements are for an Executor and how | ||
| Spark can find out specific details about those resources. Not all the parameters are | ||
| required for every resource type. Resources like GPUs are supported and have same limitations | ||
| as using the global spark configs spark.executor.resource.gpu.*. The amount, discoveryScript, | ||
| and vendor parameters for resources are all the same parameters a user would specify through the | ||
| configs: spark.executor.resource.{resourceName}.{amount, discoveryScript, vendor}. | ||
|
|
||
| For instance, a user wants to allocate an Executor with GPU resources on YARN. The user has | ||
| to specify the resource name (gpu), the amount or number of GPUs per Executor, | ||
| the discovery script would be specified so that when the Executor starts up it can | ||
| discovery what GPU addresses are available for it to use because YARN doesn't tell | ||
| Spark that, then vendor would not be used because its specific for Kubernetes. | ||
|
|
||
| See the configuration and cluster specific docs for more details. | ||
|
|
||
| Use ExecutorResourceRequests class as a convenience API. | ||
|
tgravescs marked this conversation as resolved.
Outdated
|
||
|
|
||
| :param resourceName: Name of the resource | ||
| :param amount: Amount requesting | ||
| :param discoveryScript: Optional script used to discover the resources. This is required on some | ||
| cluster managers that don't tell Spark the addresses of the resources | ||
| allocated. The script runs on Executors startup to discover the addresses | ||
| of the resources available. | ||
| :param vendor: Vendor, required for some cluster managers | ||
| """ | ||
|
|
||
| def __init__(self, resourceName, amount, discoveryScript="", vendor=""): | ||
| """Create a new ExecutorResourceRequest that wraps the underlying JVM object.""" | ||
| from pyspark.context import SparkContext | ||
| self._jExecRequest = SparkContext._jvm.org.apache.spark.resource.ExecutorResourceRequest( | ||
| resourceName, amount, discoveryScript, vendor) | ||
|
|
||
| @property | ||
| def resourceName(self): | ||
| return self._jExecRequest.resourceName() | ||
|
|
||
| @property | ||
| def amount(self): | ||
| return self._jExecRequest.amount() | ||
|
|
||
| @property | ||
| def discoveryScript(self): | ||
| return self._jExecRequest.discoveryScript() | ||
|
|
||
| @property | ||
| def vendor(self): | ||
| return self._jExecRequest.vendor() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
|
||
| from pyspark.executorresourcerequest import ExecutorResourceRequest | ||
|
|
||
|
|
||
| class ExecutorResourceRequests(object): | ||
|
|
||
| """ | ||
| .. note:: Evolving | ||
|
|
||
| A set of Executor resource requests. This is used in conjunction with the | ||
| ResourceProfileBuilder to programmatically specify the resources needed for an RDD | ||
| that will be applied at the stage level. | ||
| """ | ||
|
|
||
| def __init__(self): | ||
| """Create a new ExecutorResourceRequests that wraps the underlying JVM object.""" | ||
| from pyspark import SparkContext | ||
| self._javaExecutorResourceRequests \ | ||
| = SparkContext._jvm.org.apache.spark.resource.ExecutorResourceRequests() | ||
|
|
||
| def memory(self, amount): | ||
| self._javaExecutorResourceRequests.memory(amount) | ||
| return self | ||
|
|
||
| def memoryOverhead(self, amount): | ||
| self._javaExecutorResourceRequests.memoryOverhead(amount) | ||
| return self | ||
|
|
||
| def pysparkMemory(self, amount): | ||
| self._javaExecutorResourceRequests.pysparkMemory(amount) | ||
| return self | ||
|
|
||
| def cores(self, amount): | ||
| self._javaExecutorResourceRequests.cores(amount) | ||
| return self | ||
|
|
||
| def resource(self, resourceName, amount, discoveryScript="", vendor=""): | ||
| self._javaExecutorResourceRequests.resource(resourceName, amount, discoveryScript, vendor) | ||
| return self | ||
|
|
||
| @property | ||
| def requests(self): | ||
| execRes = self._javaExecutorResourceRequests.requestsJMap() | ||
| result = {} | ||
| # convert back to python ExecutorResourceRequest | ||
| for k, v in execRes.items(): | ||
| result[k] = ExecutorResourceRequest(v.resourceName(), v.amount(), | ||
| v.discoveryScript(), v.vendor()) | ||
| return result |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.