Skip to content

get sparkhome from sparkconf Preferentially#615

Closed
scwf wants to merge 4 commits intoapache:masterfrom
scwf:fixsparkhome
Closed

get sparkhome from sparkconf Preferentially#615
scwf wants to merge 4 commits intoapache:masterfrom
scwf:fixsparkhome

Conversation

@scwf
Copy link
Contributor

@scwf scwf commented May 2, 2014

No description provided.

@AmplabJenkins
Copy link

Can one of the admins verify this patch?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just wondering, could you describe the use case where you want to set this via a Spark property and not by setting SPARK_HOME on the cluster?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since spark provide sparkconf to manage it's config system, we should first get option from sparkconf, then system env(compatible with old version). And we‘d better avoid using system env.
Actually in sparkcontext it get sparkhome like this

private[spark] def getSparkHome(): Option[String] = {
conf.getOption("spark.home").orElse(Option(System.getenv("SPARK_HOME")))
}
also, we keep consistent.

Copy link
Contributor

Choose a reason for hiding this comment

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

SparkConf is intended for application-wide configurations. SPARK_HOME is actually a node-dependent configuration, so we'd prefer to keep it outside of Spark conf. If you look we've done this for other node-specific configs like SPARK_LOCAL_DIR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, sparkconf for application-wide configuration is sensible

@scwf scwf closed this May 2, 2014
@scwf scwf deleted the fixsparkhome branch August 22, 2014 15:27
bzhaoopenstack pushed a commit to bzhaoopenstack/spark that referenced this pull request Sep 11, 2019
scala -version will raise on 2.11.0 even there is no error.
Ignore the error.
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.

3 participants