Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
spark
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs525-sp18-g07
spark
Commits
7e8d2e8a
Commit
7e8d2e8a
authored
11 years ago
by
Matei Zaharia
Browse files
Options
Downloads
Patches
Plain Diff
Fix Python code after change of getOrElse
parent
0f606073
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/pyspark/conf.py
+6
-1
6 additions, 1 deletion
python/pyspark/conf.py
python/pyspark/context.py
+8
-6
8 additions, 6 deletions
python/pyspark/context.py
with
14 additions
and
7 deletions
python/pyspark/conf.py
+
6
−
1
View file @
7e8d2e8a
...
...
@@ -134,7 +134,12 @@ class SparkConf(object):
def
get
(
self
,
key
,
defaultValue
=
None
):
"""
Get the configured value for some key, or return a default otherwise.
"""
return
self
.
_jconf
.
get
(
key
,
defaultValue
)
if
defaultValue
==
None
:
# Py4J doesn't call the right get() if we pass None
if
not
self
.
_jconf
.
contains
(
key
):
return
None
return
self
.
_jconf
.
get
(
key
)
else
:
return
self
.
_jconf
.
get
(
key
,
defaultValue
)
def
getAll
(
self
):
"""
Get all values as a list of key-value pairs.
"""
...
...
This diff is collapsed.
Click to expand it.
python/pyspark/context.py
+
8
−
6
View file @
7e8d2e8a
...
...
@@ -92,11 +92,13 @@ class SparkContext(object):
self
.
serializer
=
BatchedSerializer
(
self
.
_unbatched_serializer
,
batchSize
)
# Set parameters passed directly to us on the conf; these operations will be
# no-ops if the parameters were None
self
.
_conf
.
setMaster
(
master
)
self
.
_conf
.
setAppName
(
appName
)
self
.
_conf
.
setSparkHome
(
sparkHome
)
# Set any parameters passed directly to us on the conf
if
master
:
self
.
_conf
.
setMaster
(
master
)
if
appName
:
self
.
_conf
.
setAppName
(
appName
)
if
sparkHome
:
self
.
_conf
.
setSparkHome
(
sparkHome
)
if
environment
:
for
key
,
value
in
environment
.
iteritems
():
self
.
_conf
.
setExecutorEnv
(
key
,
value
)
...
...
@@ -111,7 +113,7 @@ class SparkContext(object):
# the classpath or an external config file
self
.
master
=
self
.
_conf
.
get
(
"
spark.master
"
)
self
.
appName
=
self
.
_conf
.
get
(
"
spark.app.name
"
)
self
.
sparkHome
=
self
.
_conf
.
get
OrElse
(
"
spark.home
"
,
None
)
self
.
sparkHome
=
self
.
_conf
.
get
(
"
spark.home
"
,
None
)
for
(
k
,
v
)
in
self
.
_conf
.
getAll
():
if
k
.
startswith
(
"
spark.executorEnv.
"
):
varName
=
k
[
len
(
"
spark.executorEnv.
"
):]
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment