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
c063e877
Commit
c063e877
authored
12 years ago
by
Tyson
Browse files
Options
Downloads
Patches
Plain Diff
Added implicit json writers for JobDescription and ExecutorRunner
parent
2e914d99
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/main/scala/spark/deploy/JsonProtocol.scala
+22
-1
22 additions, 1 deletion
core/src/main/scala/spark/deploy/JsonProtocol.scala
with
22 additions
and
1 deletion
core/src/main/scala/spark/deploy/JsonProtocol.scala
+
22
−
1
View file @
c063e877
package
spark.deploy
import
master.
{
JobInfo
,
WorkerInfo
}
import
worker.ExecutorRunner
import
cc.spray.json._
/**
...
...
@@ -30,6 +31,24 @@ private[spark] object JsonProtocol extends DefaultJsonProtocol {
"submitdate"
->
JsString
(
obj
.
submitDate
.
toString
))
}
implicit
object
JobDescriptionJsonFormat
extends
RootJsonWriter
[
JobDescription
]
{
def
write
(
obj
:
JobDescription
)
=
JsObject
(
"name"
->
JsString
(
obj
.
name
),
"cores"
->
JsNumber
(
obj
.
cores
),
"memoryperslave"
->
JsNumber
(
obj
.
memoryPerSlave
),
"user"
->
JsString
(
obj
.
user
)
)
}
implicit
object
ExecutorRunnerJsonFormat
extends
RootJsonWriter
[
ExecutorRunner
]
{
def
write
(
obj
:
ExecutorRunner
)
=
JsObject
(
"id"
->
JsNumber
(
obj
.
execId
),
"memory"
->
JsNumber
(
obj
.
memory
),
"jobid"
->
JsString
(
obj
.
jobId
),
"jobdesc"
->
obj
.
jobDesc
.
toJson
.
asJsObject
)
}
implicit
object
MasterStateJsonFormat
extends
RootJsonWriter
[
MasterState
]
{
def
write
(
obj
:
MasterState
)
=
JsObject
(
"url"
->
JsString
(
"spark://"
+
obj
.
uri
),
...
...
@@ -51,7 +70,9 @@ private[spark] object JsonProtocol extends DefaultJsonProtocol {
"cores"
->
JsNumber
(
obj
.
cores
),
"coresused"
->
JsNumber
(
obj
.
coresUsed
),
"memory"
->
JsNumber
(
obj
.
memory
),
"memoryused"
->
JsNumber
(
obj
.
memoryUsed
)
"memoryused"
->
JsNumber
(
obj
.
memoryUsed
),
"executors"
->
JsArray
(
obj
.
executors
.
toList
.
map
(
_
.
toJson
)),
"finishedexecutors"
->
JsArray
(
obj
.
finishedExecutors
.
toList
.
map
(
_
.
toJson
))
)
}
}
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