This repository was archived by the owner on Jan 9, 2020. It is now read-only.
forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 117
Spark on Kubernetes - basic submission client #545
Closed
Closed
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
999ec13
[SPARK-22570][SQL] Avoid to create a lot of global variables by using…
kiszk 6ac57fd
[SPARK-21417][SQL] Infer join conditions using propagated constraints
bcceab6
[SPARK-22489][SQL] Shouldn't change broadcast join buildSide if user …
wangyum f5f8e84
[SPARK-22614] Dataset API: repartitionByRange(...)
adrian-ionescu 7e5f669
[SPARK-22428][DOC] Add spark application garbage collector configurat…
gaborgsomogyi 7da1f57
[SPARK-22373] Bump Janino dependency version to fix thread safety issue…
Victsm dc36542
[SPARK-22653] executorAddress registered in CoarseGrainedSchedulerBac…
tgravescs 16adaf6
[SPARK-22601][SQL] Data load is getting displayed successful on provi…
sujith71955 9d06a9e
[SPARK-22393][SPARK-SHELL] spark-shell can't find imported types in c…
mpetruska ee10ca7
[SPARK-22638][SS] Use a separate queue for StreamingQueryListenerBus
zsxwing aa4cf2b
[SPARK-22651][PYTHON][ML] Prevent initiating multiple Hive clients fo…
HyukjinKwon d2cf95a
[SPARK-22634][BUILD] Update Bouncy Castle to 1.58
srowen f23dddf
[SPARK-20682][SPARK-15474][SPARK-21791] Add new ORCFileFormat based o…
dongjoon-hyun 2c16267
[SPARK-22669][SQL] Avoid unnecessary function calls in code generation
mgaido91 dff440f
[SPARK-22626][SQL] deals with wrong Hive's statistics (zero rowCount)
wangyum 4131ad0
[SPARK-22489][DOC][FOLLOWUP] Update broadcast behavior changes in mig…
wangyum 3927bb9
[SPARK-22473][FOLLOWUP][TEST] Remove deprecated Date functions
mgaido91 f81401e
[SPARK-22162] Executors and the driver should use consistent JobIDs i…
e1dd03e
[SPARK-22372][CORE, YARN] Make cluster submission use SparkApplication.
dcaac45
Spark on Kubernetes - basic submission client
liyinan926 27c67ff
Addressed first round of review comments
liyinan926 6d597d0
Made Client implement the SparkApplication trait
liyinan926 5b9fa39
Addressed the second round of comments
liyinan926 5ccadb5
Added missing step for supporting local:// dependencies and addressed…
liyinan926 12f2797
Fixed Scala style check errors
liyinan926 c35fe48
Addressed another round of comments
liyinan926 faa2849
Rebased on master and added a constant val for the Client class
liyinan926 347ed69
Addressed another major round of comments
liyinan926 0e8ca01
Addressed one more round of comments
liyinan926 3a0b8e3
Removed mentioning of kubernetes-namespace
liyinan926 83d0b9c
Fixed a couple of bugs found during manual tests
liyinan926 44c40b1
Guard against client mode in SparkContext
liyinan926 67bc847
Added libc6-compat into the base docker image
liyinan926 7d2b303
Addressed latest comments
liyinan926 caf2206
Addressed docs comments
liyinan926 2e7810b
Fixed a comment
liyinan926 cbcd30e
Addressed latest comments
liyinan926 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
Added missing step for supporting local:// dependencies and addressed…
… more comments
- Loading branch information
commit 5ccadb5b29de157219a388fef28bcbd44e3ec788
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
104 changes: 0 additions & 104 deletions
104
.../kubernetes/core/src/main/scala/org/apache/spark/deploy/k8s/KubernetesClientFactory.scala
This file was deleted.
Oops, something went wrong.
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
67 changes: 67 additions & 0 deletions
67
...bernetes/core/src/main/scala/org/apache/spark/deploy/k8s/submit/KubernetesFileUtils.scala
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,67 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
| package org.apache.spark.deploy.k8s.submit | ||
|
|
||
| import java.io.File | ||
|
|
||
| import org.apache.spark.util.Utils | ||
|
|
||
| private[spark] object KubernetesFileUtils { | ||
|
|
||
| /** | ||
| * For the given collection of file URIs, resolves them as follows: | ||
| * - File URIs with scheme file:// are resolved to the given download path. | ||
| * - File URIs with scheme local:// resolve to just the path of the URI. | ||
| * - Otherwise, the URIs are returned as-is. | ||
| */ | ||
| def resolveSubmittedUris(fileUris: Iterable[String], fileDownloadPath: String) | ||
| : Iterable[String] = { | ||
| fileUris.map { uri => | ||
| val fileUri = Utils.resolveURI(uri) | ||
| val fileScheme = Option(fileUri.getScheme).getOrElse("file") | ||
| fileScheme match { | ||
| case "file" => | ||
| val fileName = new File(fileUri.getPath).getName | ||
| s"$fileDownloadPath/$fileName" | ||
| case "local" => | ||
| fileUri.getPath | ||
| case _ => uri | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * If any file uri has any scheme other than local:// it is mapped as if the file | ||
| * was downloaded to the file download path. Otherwise, it is mapped to the path | ||
| * part of the URI. | ||
| */ | ||
| def resolveFilePaths(fileUris: Iterable[String], fileDownloadPath: String): Iterable[String] = { | ||
| fileUris.map { uri => | ||
| resolveFilePath(uri, fileDownloadPath) | ||
| } | ||
| } | ||
|
|
||
| private def resolveFilePath(uri: String, fileDownloadPath: String): String = { | ||
| val fileUri = Utils.resolveURI(uri) | ||
| if (Option(fileUri.getScheme).getOrElse("file") == "local") { | ||
| fileUri.getPath | ||
| } else { | ||
| val fileName = new File(fileUri.getPath).getName | ||
| s"$fileDownloadPath/$fileName" | ||
| } | ||
| } | ||
| } |
62 changes: 62 additions & 0 deletions
62
...re/src/main/scala/org/apache/spark/deploy/k8s/submit/steps/DependencyResolutionStep.scala
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,62 @@ | ||
| /* | ||
| * 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. | ||
| */ | ||
| package org.apache.spark.deploy.k8s.submit.steps | ||
|
|
||
| import java.io.File | ||
|
|
||
| import io.fabric8.kubernetes.api.model.ContainerBuilder | ||
|
|
||
| import org.apache.spark.deploy.k8s.Constants._ | ||
| import org.apache.spark.deploy.k8s.submit.{KubernetesDriverSpec, KubernetesFileUtils} | ||
|
|
||
| /** | ||
| * Step that configures the classpath, spark.jars, and spark.files for the driver given that the | ||
| * user may provide remote files or files with local:// schemes. | ||
| */ | ||
| private[spark] class DependencyResolutionStep( | ||
| sparkJars: Seq[String], | ||
| sparkFiles: Seq[String], | ||
| jarsDownloadPath: String, | ||
| localFilesDownloadPath: String) extends DriverConfigurationStep { | ||
|
|
||
| override def configureDriver(driverSpec: KubernetesDriverSpec): KubernetesDriverSpec = { | ||
| val resolvedSparkJars = KubernetesFileUtils.resolveSubmittedUris(sparkJars, jarsDownloadPath) | ||
| val resolvedSparkFiles = KubernetesFileUtils.resolveSubmittedUris( | ||
| sparkFiles, localFilesDownloadPath) | ||
| val sparkConfResolvedSparkDependencies = driverSpec.driverSparkConf.clone() | ||
| if (resolvedSparkJars.nonEmpty) { | ||
| sparkConfResolvedSparkDependencies.set("spark.jars", resolvedSparkJars.mkString(",")) | ||
| } | ||
| if (resolvedSparkFiles.nonEmpty) { | ||
| sparkConfResolvedSparkDependencies.set("spark.files", resolvedSparkFiles.mkString(",")) | ||
| } | ||
| val resolvedClasspath = KubernetesFileUtils.resolveFilePaths(sparkJars, jarsDownloadPath) | ||
| val driverContainerWithResolvedClasspath = if (resolvedClasspath.nonEmpty) { | ||
| new ContainerBuilder(driverSpec.driverContainer) | ||
| .addNewEnv() | ||
| .withName(ENV_MOUNTED_CLASSPATH) | ||
| .withValue(resolvedClasspath.mkString(File.pathSeparator)) | ||
| .endEnv() | ||
| .build() | ||
| } else { | ||
| driverSpec.driverContainer | ||
| } | ||
| driverSpec.copy( | ||
| driverContainer = driverContainerWithResolvedClasspath, | ||
| driverSparkConf = sparkConfResolvedSparkDependencies) | ||
| } | ||
| } |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This particular line does not read well because the word "KubernetesClient" appears here twice meaning two different things. The reader may fail to distinguish "Spark client" (
SparkKubernetesClientFactory), vs "K8s API client" (createKubernetesClient).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renamed
SparkKubernetesClientFactorytoKubernetesClientFactoryand renamed the method tocreate.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. I myself misread. The two clients meant the same thing :-)