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
c1d44be8
Commit
c1d44be8
authored
11 years ago
by
BlackNiuza
Browse files
Options
Downloads
Patches
Plain Diff
Bug fix: SPARK-796
parent
3c131783
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/hadoop2-yarn/scala/spark/deploy/yarn/ApplicationMaster.scala
+32
-17
32 additions, 17 deletions
...oop2-yarn/scala/spark/deploy/yarn/ApplicationMaster.scala
with
32 additions
and
17 deletions
core/src/hadoop2-yarn/scala/spark/deploy/yarn/ApplicationMaster.scala
+
32
−
17
View file @
c1d44be8
...
...
@@ -27,6 +27,7 @@ class ApplicationMaster(args: ApplicationMasterArguments, conf: Configuration) e
private
val
yarnConf
:
YarnConfiguration
=
new
YarnConfiguration
(
conf
)
private
var
yarnAllocator
:
YarnAllocationHandler
=
null
private
var
isFinished
:
Boolean
=
false
def
run
()
{
...
...
@@ -68,10 +69,7 @@ class ApplicationMaster(args: ApplicationMasterArguments, conf: Configuration) e
// Wait for the user class to Finish
userThread
.
join
()
// Finish the ApplicationMaster
finishApplicationMaster
()
// TODO: Exit based on success/failure
System
.
exit
(
0
)
}
...
...
@@ -131,10 +129,17 @@ class ApplicationMaster(args: ApplicationMasterArguments, conf: Configuration) e
.
getMethod
(
"main"
,
classOf
[
Array
[
String
]])
val
t
=
new
Thread
{
override
def
run
()
{
// Copy
var
mainArgs
:
Array
[
String
]
=
new
Array
[
String
](
args
.
userArgs
.
size
())
args
.
userArgs
.
copyToArray
(
mainArgs
,
0
,
args
.
userArgs
.
size
())
mainMethod
.
invoke
(
null
,
mainArgs
)
try
{
// Copy
var
mainArgs
:
Array
[
String
]
=
new
Array
[
String
](
args
.
userArgs
.
size
())
args
.
userArgs
.
copyToArray
(
mainArgs
,
0
,
args
.
userArgs
.
size
())
mainMethod
.
invoke
(
null
,
mainArgs
)
ApplicationMaster
.
this
.
finishApplicationMaster
(
FinalApplicationStatus
.
SUCCEEDED
)
}
catch
{
case
th
:
Throwable
=>
ApplicationMaster
.
this
.
finishApplicationMaster
(
FinalApplicationStatus
.
FAILED
)
logError
(
"Finish ApplicationMaster with "
,
th
)
}
}
}
t
.
start
()
...
...
@@ -235,14 +240,22 @@ class ApplicationMaster(args: ApplicationMasterArguments, conf: Configuration) e
}
}
*/
def
finishApplicationMaster
()
{
val
finishReq
=
Records
.
newRecord
(
classOf
[
FinishApplicationMasterRequest
])
.
asInstanceOf
[
FinishApplicationMasterRequest
]
finishReq
.
setAppAttemptId
(
appAttemptId
)
// TODO: Check if the application has failed or succeeded
finishReq
.
setFinishApplicationStatus
(
FinalApplicationStatus
.
SUCCEEDED
)
resourceManager
.
finishApplicationMaster
(
finishReq
)
def
finishApplicationMaster
(
status
:
FinalApplicationStatus
)
{
synchronized
{
if
(
isFinished
){
return
}
isFinished
=
true
logInfo
(
"finishApplicationMaster with "
+
status
)
val
finishReq
=
Records
.
newRecord
(
classOf
[
FinishApplicationMasterRequest
])
.
asInstanceOf
[
FinishApplicationMasterRequest
]
finishReq
.
setAppAttemptId
(
appAttemptId
)
finishReq
.
setFinishApplicationStatus
(
status
)
resourceManager
.
finishApplicationMaster
(
finishReq
)
}
}
}
...
...
@@ -291,7 +304,9 @@ object ApplicationMaster {
logInfo
(
"Invoking sc stop from shutdown hook"
)
sc
.
stop
()
// best case ...
for
(
master
<-
applicationMasters
)
master
.
finishApplicationMaster
for
(
master
<-
applicationMasters
)
{
master
.
finishApplicationMaster
(
FinalApplicationStatus
.
KILLED
)
}
}
}
)
}
...
...
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