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
b5e93c12
"src/Configuration.cpp" did not exist on "d06c3934e8729e30575d01eb522e90146dea0fa8"
Commit
b5e93c12
authored
11 years ago
by
Harvey Feng
Browse files
Options
Downloads
Patches
Plain Diff
Fix API changes; lines > 100 chars.
parent
7d06bdde
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
core/src/main/scala/org/apache/spark/SparkContext.scala
+10
-7
10 additions, 7 deletions
core/src/main/scala/org/apache/spark/SparkContext.scala
core/src/main/scala/org/apache/spark/rdd/HadoopRDD.scala
+8
-8
8 additions, 8 deletions
core/src/main/scala/org/apache/spark/rdd/HadoopRDD.scala
with
18 additions
and
15 deletions
core/src/main/scala/org/apache/spark/SparkContext.scala
+
10
−
7
View file @
b5e93c12
...
...
@@ -84,9 +84,11 @@ class SparkContext(
val
sparkHome
:
String
=
null
,
val
jars
:
Seq
[
String
]
=
Nil
,
val
environment
:
Map
[
String
,
String
]
=
Map
(),
// This is used only by yarn for now, but should be relevant to other cluster types (mesos, etc) too.
// This is typically generated from InputFormatInfo.computePreferredLocations .. host, set of data-local splits on host
val
preferredNodeLocationData
:
scala.collection.Map
[
String
,
scala.collection.Set
[
SplitInfo
]]
=
scala
.
collection
.
immutable
.
Map
())
// This is used only by yarn for now, but should be relevant to other cluster types (mesos, etc)
// too. This is typically generated from InputFormatInfo.computePreferredLocations .. host, set
// of data-local splits on host
val
preferredNodeLocationData
:
scala.collection.Map
[
String
,
scala.collection.Set
[
SplitInfo
]]
=
scala
.
collection
.
immutable
.
Map
())
extends
Logging
{
// Ensure logging is initialized before we spawn any threads
...
...
@@ -239,7 +241,8 @@ class SparkContext(
val
env
=
SparkEnv
.
get
val
conf
=
env
.
hadoop
.
newConfiguration
()
// Explicitly check for S3 environment variables
if
(
System
.
getenv
(
"AWS_ACCESS_KEY_ID"
)
!=
null
&&
System
.
getenv
(
"AWS_SECRET_ACCESS_KEY"
)
!=
null
)
{
if
(
System
.
getenv
(
"AWS_ACCESS_KEY_ID"
)
!=
null
&&
System
.
getenv
(
"AWS_SECRET_ACCESS_KEY"
)
!=
null
)
{
conf
.
set
(
"fs.s3.awsAccessKeyId"
,
System
.
getenv
(
"AWS_ACCESS_KEY_ID"
))
conf
.
set
(
"fs.s3n.awsAccessKeyId"
,
System
.
getenv
(
"AWS_ACCESS_KEY_ID"
))
conf
.
set
(
"fs.s3.awsSecretAccessKey"
,
System
.
getenv
(
"AWS_SECRET_ACCESS_KEY"
))
...
...
@@ -332,15 +335,15 @@ class SparkContext(
* etc).
*/
def
hadoopRDD
[
K
,
V
](
jobC
onf
:
JobConf
,
c
onf
:
JobConf
,
inputFormatClass
:
Class
[
_
<:
InputFormat
[
K
,
V
]],
keyClass
:
Class
[
K
],
valueClass
:
Class
[
V
],
minSplits
:
Int
=
defaultMinSplits
)
:
RDD
[(
K
,
V
)]
=
{
// Add necessary security credentials to the JobConf before broadcasting it.
SparkEnv
.
get
.
hadoop
.
addCredentials
(
jobC
onf
)
new
HadoopRDD
(
this
,
jobC
onf
,
inputFormatClass
,
keyClass
,
valueClass
,
minSplits
)
SparkEnv
.
get
.
hadoop
.
addCredentials
(
c
onf
)
new
HadoopRDD
(
this
,
c
onf
,
inputFormatClass
,
keyClass
,
valueClass
,
minSplits
)
}
/** Get an RDD for a Hadoop file with an arbitrary InputFormat */
...
...
This diff is collapsed.
Click to expand it.
core/src/main/scala/org/apache/spark/rdd/HadoopRDD.scala
+
8
−
8
View file @
b5e93c12
...
...
@@ -43,18 +43,18 @@ import org.apache.hadoop.conf.{Configuration, Configurable}
class
HadoopFileRDD
[
K
,
V
](
sc
:
SparkContext
,
path
:
String
,
confB
roadcast
:
Broadcast
[
SerializableWritable
[
Configuration
]],
b
roadcast
edConf
:
Broadcast
[
SerializableWritable
[
Configuration
]],
inputFormatClass
:
Class
[
_
<:
InputFormat
[
K
,
V
]],
keyClass
:
Class
[
K
],
valueClass
:
Class
[
V
],
minSplits
:
Int
)
extends
HadoopRDD
[
K
,
V
](
sc
,
confB
roadcast
,
inputFormatClass
,
keyClass
,
valueClass
,
minSplits
)
{
extends
HadoopRDD
[
K
,
V
](
sc
,
b
roadcast
edConf
,
inputFormatClass
,
keyClass
,
valueClass
,
minSplits
)
{
override
def
getJobConf
()
:
JobConf
=
{
if
(
HadoopRDD
.
containsCachedMetadata
(
jobConfCacheKey
))
{
return
HadoopRDD
.
getCachedMetadata
(
jobConfCacheKey
).
asInstanceOf
[
JobConf
]
}
else
{
val
newJobConf
=
new
JobConf
(
confB
roadcast
.
value
.
value
)
val
newJobConf
=
new
JobConf
(
b
roadcast
edConf
.
value
.
value
)
FileInputFormat
.
setInputPaths
(
newJobConf
,
path
)
HadoopRDD
.
putCachedMetadata
(
jobConfCacheKey
,
newJobConf
)
return
newJobConf
...
...
@@ -80,7 +80,7 @@ private[spark] class HadoopPartition(rddId: Int, idx: Int, @transient s: InputSp
*/
class
HadoopRDD
[
K
,
V
](
sc
:
SparkContext
,
confB
roadcast
:
Broadcast
[
SerializableWritable
[
Configuration
]],
b
roadcast
edConf
:
Broadcast
[
SerializableWritable
[
Configuration
]],
inputFormatClass
:
Class
[
_
<:
InputFormat
[
K
,
V
]],
keyClass
:
Class
[
K
],
valueClass
:
Class
[
V
],
...
...
@@ -89,14 +89,14 @@ class HadoopRDD[K, V](
def
this
(
sc
:
SparkContext
,
jobC
onf
:
JobConf
,
c
onf
:
JobConf
,
inputFormatClass
:
Class
[
_
<:
InputFormat
[
K
,
V
]],
keyClass
:
Class
[
K
],
valueClass
:
Class
[
V
],
minSplits
:
Int
)
=
{
this
(
sc
,
sc
.
broadcast
(
new
SerializableWritable
(
jobC
onf
))
sc
.
broadcast
(
new
SerializableWritable
(
c
onf
))
.
asInstanceOf
[
Broadcast
[
SerializableWritable
[
Configuration
]]],
inputFormatClass
,
keyClass
,
...
...
@@ -110,13 +110,13 @@ class HadoopRDD[K, V](
// Returns a JobConf that will be used on slaves to obtain input splits for Hadoop reads.
protected
def
getJobConf
()
:
JobConf
=
{
val
conf
:
Configuration
=
confB
roadcast
.
value
.
value
val
conf
:
Configuration
=
b
roadcast
edConf
.
value
.
value
if
(
conf
.
isInstanceOf
[
JobConf
])
{
return
conf
.
asInstanceOf
[
JobConf
]
}
else
if
(
HadoopRDD
.
containsCachedMetadata
(
jobConfCacheKey
))
{
return
HadoopRDD
.
getCachedMetadata
(
jobConfCacheKey
).
asInstanceOf
[
JobConf
]
}
else
{
val
newJobConf
=
new
JobConf
(
confB
roadcast
.
value
.
value
)
val
newJobConf
=
new
JobConf
(
b
roadcast
edConf
.
value
.
value
)
HadoopRDD
.
putCachedMetadata
(
jobConfCacheKey
,
newJobConf
)
return
newJobConf
}
...
...
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