Skip to content
This repository was archived by the owner on Jan 9, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
7570eab
[SPARK-22788][STREAMING] Use correct hadoop config for fs append supp…
Dec 20, 2017
7798c9e
[SPARK-22824] Restore old offset for binary compatibility
jose-torres Dec 20, 2017
d762d11
[SPARK-22832][ML] BisectingKMeans unpersist unused datasets
zhengruifeng Dec 20, 2017
c89b431
[SPARK-22849] ivy.retrieve pattern should also consider `classifier`
gatorsmile Dec 20, 2017
792915c
[SPARK-22830] Scala Coding style has been improved in Spark Examples
chetkhatri Dec 20, 2017
b176014
[SPARK-22847][CORE] Remove redundant code in AppStatusListener while …
Ngone51 Dec 20, 2017
0114c89
[SPARK-22845][SCHEDULER] Modify spark.kubernetes.allocation.batch.del…
foxish Dec 21, 2017
fb0562f
[SPARK-22810][ML][PYSPARK] Expose Python API for LinearRegression wit…
yanboliang Dec 21, 2017
9c289a5
[SPARK-22387][SQL] Propagate session configs to data source read/writ…
jiangxb1987 Dec 21, 2017
d3ae3e1
[SPARK-19634][SQL][ML][FOLLOW-UP] Improve interface of dataframe vect…
WeichenXu123 Dec 21, 2017
cb9fc8d
[SPARK-22848][SQL] Eliminate mutable state from Stack
kiszk Dec 21, 2017
59d5263
[SPARK-22324][SQL][PYTHON] Upgrade Arrow to 0.8.0
BryanCutler Dec 21, 2017
0abaf31
[SPARK-22852][BUILD] Exclude -Xlint:unchecked from sbt javadoc flags
easel Dec 21, 2017
4c2efde
[SPARK-22855][BUILD] Add -no-java-comments to sbt docs/scalacOptions
easel Dec 21, 2017
8a0ed5a
[SPARK-22668][SQL] Ensure no global variables in arguments of method …
cloud-fan Dec 21, 2017
d3a1d95
[SPARK-22786][SQL] only use AppStatusPlugin in history server
cloud-fan Dec 21, 2017
4e107fd
[SPARK-22822][TEST] Basic tests for WindowFrameCoercion and DecimalPr…
wangyum Dec 21, 2017
fe65361
[SPARK-22042][FOLLOW-UP][SQL] ReorderJoinPredicates can break when ch…
tejasapatil Dec 21, 2017
7beb375
[SPARK-22861][SQL] SQLAppStatusListener handles multi-job executions.
squito Dec 21, 2017
7ab165b
[SPARK-22648][K8S] Spark on Kubernetes - Documentation
foxish Dec 22, 2017
c0abb1d
[SPARK-22854][UI] Read Spark version from event logs.
Dec 22, 2017
c6f01ca
[SPARK-22750][SQL] Reuse mutable states when possible
mgaido91 Dec 22, 2017
a36b78b
[SPARK-22450][CORE][MLLIB][FOLLOWUP] safely register class for mllib …
zhengruifeng Dec 22, 2017
22e1849
[SPARK-22866][K8S] Fix path issue in Kubernetes dockerfile
foxish Dec 22, 2017
8df1da3
[SPARK-22862] Docs on lazy elimination of columns missing from an enc…
marmbrus Dec 22, 2017
13190a4
[SPARK-22874][PYSPARK][SQL] Modify checking pandas version to use Loo…
ueshin Dec 22, 2017
d23dc5b
[SPARK-22346][ML] VectorSizeHint Transformer for using VectorAssemble…
MrBago Dec 22, 2017
d3cbbdd
[SPARK-22757][Kubernetes] Enable use of remote dependencies in Kubern…
liyinan926 Dec 12, 2017
5d2cbc8
Addressed first round of comments
liyinan926 Dec 15, 2017
4ee76af
Addressed the second round of comments
liyinan926 Dec 16, 2017
9c8051a
Create one task per jar/file to download in the init-container
liyinan926 Dec 16, 2017
1f65417
More review comments
liyinan926 Dec 18, 2017
109ad80
Shorten variable names
liyinan926 Dec 19, 2017
c21fdcf
Removed traits that have only a single implementation
liyinan926 Dec 19, 2017
a3cd71d
Remove unused class arguments
liyinan926 Dec 19, 2017
23c5cd9
Improved documentation
liyinan926 Dec 19, 2017
2ec15c4
Addressed latest round of comments
liyinan926 Dec 20, 2017
5d1f889
Addressed more comments
liyinan926 Dec 21, 2017
9d9c841
Updated names of two configuration properties
liyinan926 Dec 22, 2017
c51bc56
Addressed more comments
liyinan926 Dec 25, 2017
28343fb
Addressed one more comment
liyinan926 Dec 26, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Shorten variable names
  • Loading branch information
liyinan926 committed Dec 23, 2017
commit 109ad800de609f05ead87f9d2b1a99b683bfc335
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,23 @@ private[spark] trait InitContainerBootstrap {
/**
* Bootstraps an init-container that downloads dependencies to be used by a main container.
*/
def bootstrapInitContainer(
originalPodWithInitContainer: PodWithDetachedInitContainer)
: PodWithDetachedInitContainer
def bootstrapInitContainer(original: PodWithDetachedInitContainer): PodWithDetachedInitContainer
}

private[spark] class InitContainerBootstrapImpl(
initContainerImage: String,
dockerImagePullPolicy: String,
imagePullPolicy: String,
jarsDownloadPath: String,
filesDownloadPath: String,
downloadTimeoutMinutes: Long,
initContainerConfigMapName: String,
initContainerConfigMapKey: String,
configMapName: String,
configMapKey: String,
sparkRole: String,
sparkConf: SparkConf)
extends InitContainerBootstrap {

override def bootstrapInitContainer(
podWithDetachedInitContainer: PodWithDetachedInitContainer): PodWithDetachedInitContainer = {
original: PodWithDetachedInitContainer): PodWithDetachedInitContainer = {
val sharedVolumeMounts = Seq[VolumeMount](
new VolumeMountBuilder()
.withName(INIT_CONTAINER_DOWNLOAD_JARS_VOLUME_NAME)
Expand All @@ -61,25 +59,23 @@ private[spark] class InitContainerBootstrapImpl(
.withMountPath(filesDownloadPath)
.build())

val initContainerCustomEnvVarKeyPrefix = sparkRole match {
val customEnvVarKeyPrefix = sparkRole match {
case SPARK_POD_DRIVER_ROLE => KUBERNETES_DRIVER_ENV_KEY
case SPARK_POD_EXECUTOR_ROLE => "spark.executorEnv."
case _ => throw new SparkException(s"$sparkRole is not a valid Spark pod role")
}
val initContainerCustomEnvVars = sparkConf.getAllWithPrefix(initContainerCustomEnvVarKeyPrefix)
.toSeq
.map { env =>
new EnvVarBuilder()
.withName(env._1)
.withValue(env._2)
.build()
}
val customEnvVars = sparkConf.getAllWithPrefix(customEnvVarKeyPrefix).toSeq.map { env =>
new EnvVarBuilder()
.withName(env._1)
.withValue(env._2)
.build()
}

val initContainer = new ContainerBuilder(podWithDetachedInitContainer.initContainer)
val initContainer = new ContainerBuilder(original.initContainer)
.withName("spark-init")
.withImage(initContainerImage)
.withImagePullPolicy(dockerImagePullPolicy)
.addAllToEnv(initContainerCustomEnvVars.asJava)
.withImagePullPolicy(imagePullPolicy)
.addAllToEnv(customEnvVars.asJava)
.addNewVolumeMount()
.withName(INIT_CONTAINER_PROPERTIES_FILE_VOLUME)
.withMountPath(INIT_CONTAINER_PROPERTIES_FILE_DIR)
Expand All @@ -88,14 +84,14 @@ private[spark] class InitContainerBootstrapImpl(
.addToArgs(INIT_CONTAINER_PROPERTIES_FILE_PATH)
.build()

val podWithBasicVolumes = new PodBuilder(podWithDetachedInitContainer.pod)
val podWithBasicVolumes = new PodBuilder(original.pod)
.editSpec()
.addNewVolume()
.withName(INIT_CONTAINER_PROPERTIES_FILE_VOLUME)
.withNewConfigMap()
.withName(initContainerConfigMapName)
.withName(configMapName)
.addNewItem()
.withKey(initContainerConfigMapKey)
.withKey(configMapKey)
.withPath(INIT_CONTAINER_PROPERTIES_FILE_NAME)
.endItem()
.endConfigMap()
Expand All @@ -111,8 +107,8 @@ private[spark] class InitContainerBootstrapImpl(
.endSpec()
.build()

val mainContainerWithMountedFiles = new ContainerBuilder(
podWithDetachedInitContainer.mainContainer)
val mainContainer = new ContainerBuilder(
original.mainContainer)
.addToVolumeMounts(sharedVolumeMounts: _*)
.addNewEnv()
.withName(ENV_MOUNTED_FILES_DIR)
Expand All @@ -123,6 +119,6 @@ private[spark] class InitContainerBootstrapImpl(
PodWithDetachedInitContainer(
podWithBasicVolumes,
initContainer,
mainContainerWithMountedFiles)
mainContainer)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private[spark] class DriverConfigOrchestrator(
appName: String,
mainClass: String,
appArgs: Array[String],
submissionSparkConf: SparkConf) {
sparkConf: SparkConf) {

// The resource name prefix is derived from the Spark application name, making it easy to connect
// the names of the Kubernetes resources from e.g. kubectl or the Kubernetes dashboard to the
Expand All @@ -51,14 +51,14 @@ private[spark] class DriverConfigOrchestrator(
s"$appName-$uuid".toLowerCase.replaceAll("\\.", "-")
}

private val imagePullPolicy = submissionSparkConf.get(CONTAINER_IMAGE_PULL_POLICY)
private val imagePullPolicy = sparkConf.get(CONTAINER_IMAGE_PULL_POLICY)
private val initContainerConfigMapName = s"$kubernetesResourceNamePrefix-init-config"
private val jarsDownloadPath = submissionSparkConf.get(JARS_DOWNLOAD_LOCATION)
private val filesDownloadPath = submissionSparkConf.get(FILES_DOWNLOAD_LOCATION)
private val jarsDownloadPath = sparkConf.get(JARS_DOWNLOAD_LOCATION)
private val filesDownloadPath = sparkConf.get(FILES_DOWNLOAD_LOCATION)

def getAllConfigurationSteps(): Seq[DriverConfigurationStep] = {
def getAllConfigurationSteps: Seq[DriverConfigurationStep] = {
val driverCustomLabels = ConfigurationUtils.parsePrefixedKeyValuePairs(
submissionSparkConf,
sparkConf,
KUBERNETES_DRIVER_LABEL_PREFIX)
require(!driverCustomLabels.contains(SPARK_APP_ID_LABEL), "Label with key " +
s"$SPARK_APP_ID_LABEL is not allowed as it is reserved for Spark bookkeeping " +
Expand All @@ -67,8 +67,8 @@ private[spark] class DriverConfigOrchestrator(
s"$SPARK_ROLE_LABEL is not allowed as it is reserved for Spark bookkeeping " +
"operations.")

val driverSecretNamesToMountPaths = ConfigurationUtils.parsePrefixedKeyValuePairs(
submissionSparkConf,
val secretNamesToMountPaths = ConfigurationUtils.parsePrefixedKeyValuePairs(
sparkConf,
KUBERNETES_DRIVER_SECRETS_PREFIX)

val allDriverLabels = driverCustomLabels ++ Map(
Expand All @@ -83,16 +83,16 @@ private[spark] class DriverConfigOrchestrator(
appName,
mainClass,
appArgs,
submissionSparkConf)
sparkConf)

val driverAddressStep = new DriverServiceBootstrapStep(
kubernetesResourceNamePrefix,
allDriverLabels,
submissionSparkConf,
sparkConf,
new SystemClock)

val kubernetesCredentialsStep = new DriverKubernetesCredentialsStep(
submissionSparkConf, kubernetesResourceNamePrefix)
sparkConf, kubernetesResourceNamePrefix)

val additionalMainAppJar = if (mainAppResource.nonEmpty) {
val mayBeResource = mainAppResource.get match {
Expand All @@ -105,11 +105,11 @@ private[spark] class DriverConfigOrchestrator(
None
}

val sparkJars = submissionSparkConf.getOption("spark.jars")
val sparkJars = sparkConf.getOption("spark.jars")
.map(_.split(","))
.getOrElse(Array.empty[String]) ++
additionalMainAppJar.toSeq
val sparkFiles = submissionSparkConf.getOption("spark.files")
val sparkFiles = sparkConf.getOption("spark.files")
.map(_.split(","))
.getOrElse(Array.empty[String])

Expand All @@ -136,9 +136,9 @@ private[spark] class DriverConfigOrchestrator(
allDriverLabels,
initContainerConfigMapName,
INIT_CONTAINER_PROPERTIES_FILE_NAME,
submissionSparkConf)
sparkConf)
val bootstrapStep = new DriverInitContainerBootstrapStep(
orchestrator.getAllConfigurationSteps(),
orchestrator.getAllConfigurationSteps,
initContainerConfigMapName,
INIT_CONTAINER_PROPERTIES_FILE_NAME)

Expand All @@ -147,8 +147,8 @@ private[spark] class DriverConfigOrchestrator(
None
}

val mayBeMountSecretsStep = if (driverSecretNamesToMountPaths.nonEmpty) {
val mountSecretsBootstrap = new MountSecretsBootstrapImpl(driverSecretNamesToMountPaths)
val mayBeMountSecretsStep = if (secretNamesToMountPaths.nonEmpty) {
val mountSecretsBootstrap = new MountSecretsBootstrapImpl(secretNamesToMountPaths)
Some(new DriverMountSecretsStep(mountSecretsBootstrap))
} else {
None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,22 +80,22 @@ private[spark] object ClientArguments {
* spark.kubernetes.submission.waitAppCompletion is true.
*
* @param submissionSteps steps that collectively configure the driver
* @param submissionSparkConf the submission client Spark configuration
* @param sparkConf the submission client Spark configuration
* @param kubernetesClient the client to talk to the Kubernetes API server
* @param waitForAppCompletion a flag indicating whether the client should wait for the application
* to complete
* @param appName the application name
* @param loggingPodStatusWatcher a watcher that monitors and logs the application status
* @param watcher a watcher that monitors and logs the application status
*/
private[spark] class Client(
submissionSteps: Seq[DriverConfigurationStep],
submissionSparkConf: SparkConf,
sparkConf: SparkConf,
kubernetesClient: KubernetesClient,
waitForAppCompletion: Boolean,
appName: String,
loggingPodStatusWatcher: LoggingPodStatusWatcher) extends Logging {
watcher: LoggingPodStatusWatcher) extends Logging {

private val driverJavaOptions = submissionSparkConf.get(
private val driverJavaOptions = sparkConf.get(
org.apache.spark.internal.config.DRIVER_JAVA_OPTIONS)

/**
Expand All @@ -104,7 +104,7 @@ private[spark] class Client(
* will be used to build the Driver Container, Driver Pod, and Kubernetes Resources
*/
def run(): Unit = {
var currentDriverSpec = KubernetesDriverSpec.initialSpec(submissionSparkConf)
var currentDriverSpec = KubernetesDriverSpec.initialSpec(sparkConf)
// submissionSteps contain steps necessary to take, to resolve varying
// client arguments that are passed in, created by orchestrator
for (nextStep <- submissionSteps) {
Expand Down Expand Up @@ -141,7 +141,7 @@ private[spark] class Client(
kubernetesClient
.pods()
.withName(resolvedDriverPod.getMetadata.getName)
.watch(loggingPodStatusWatcher)) { _ =>
.watch(watcher)) { _ =>
val createdDriverPod = kubernetesClient.pods().create(resolvedDriverPod)
try {
if (currentDriverSpec.otherKubernetesResources.nonEmpty) {
Expand All @@ -157,7 +157,7 @@ private[spark] class Client(

if (waitForAppCompletion) {
logInfo(s"Waiting for application $appName to finish...")
loggingPodStatusWatcher.awaitCompletion()
watcher.awaitCompletion()
logInfo(s"Application $appName finished.")
} else {
logInfo(s"Deployed Spark application $appName into Kubernetes.")
Expand Down Expand Up @@ -207,10 +207,9 @@ private[spark] class KubernetesClientApplication extends SparkApplication {
val master = sparkConf.get("spark.master").substring("k8s://".length)
val loggingInterval = if (waitForAppCompletion) Some(sparkConf.get(REPORT_INTERVAL)) else None

val loggingPodStatusWatcher = new LoggingPodStatusWatcherImpl(
kubernetesAppId, loggingInterval)
val watcher = new LoggingPodStatusWatcherImpl(kubernetesAppId, loggingInterval)

val configurationStepsOrchestrator = new DriverConfigOrchestrator(
val orchestrator = new DriverConfigOrchestrator(
namespace,
kubernetesAppId,
launchTime,
Expand All @@ -228,12 +227,12 @@ private[spark] class KubernetesClientApplication extends SparkApplication {
None,
None)) { kubernetesClient =>
val client = new Client(
configurationStepsOrchestrator.getAllConfigurationSteps(),
orchestrator.getAllConfigurationSteps,
sparkConf,
kubernetesClient,
waitForAppCompletion,
appName,
loggingPodStatusWatcher)
watcher)
client.run()
}
}
Expand Down
Loading