Github user tillrohrmann commented on a diff in the pull request:
https://github.com/apache/flink/pull/1741#discussion_r56855904
--- Diff:
flink-runtime/src/main/scala/org/apache/flink/runtime/jobmanager/JobManager.scala
---
@@ -886,10 +957,42 @@ class JobManager(
if (instanceManager.isRegistered(taskManager)) {
log.info(s"Task manager ${taskManager.path} wants to disconnect,
because $msg.")
- instanceManager.unregisterTaskManager(taskManager, false)
+ instanceManager.unregisterTaskManager(taskManager, false)
context.unwatch(taskManager)
}
+ case msg: StopCluster =>
+
+ log.info(s"Stopping JobManager with final application status
${msg.finalStatus()} " +
+ s"and diagnostics: ${msg.message()}")
+
+ val respondTo = sender()
+
+ // stop all task managers
+ instanceManager.getAllRegisteredInstances.asScala foreach {
+ instance =>
+ instance.getActorGateway.tell(msg)
+ }
+
+ // send resource manager the ok
+ currentResourceManager match {
+ case Some(rm) =>
+
+ // inform rm
+ rm ! decorateMessage(msg)
+
+ respondTo ! decorateMessage(StopClusterSuccessful.get())
+
+ // trigger shutdown
+ shutdown()
+
+ case None =>
+ // retry
+ context.system.scheduler.scheduleOnce(
+ 2 seconds, self, decorateMessage(msg)
+ )(context.dispatcher)
--- End diff --
What if we will never establish a connection to the RM again for some
reason? Wouldn't that mean that we will never shutdown the JM?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---