forked from apache/flink
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-1629][FLINK-1630][FLINK-1547] Add option to start Flink on YAR…
…N in a detached mode. YARN container reallocation. This commit is changing: [FLINK-1629]: users can now "fire and forget" jobs to YARN or YARN sessions to there. (Detached mode) [FLINK-1630]: YARN is now reallocating failed YARN containers during the lifetime of a YARN session. [FLINK-1547]: Users can now specify if they want the ApplicationMaster (= the JobManager = the entire YARN session) to restart on failure, and how often. After the first restart, the session will behave like a detached session. There is now backup of state between the old and the new AM. The whole resource negotiation process between the RM and the AM has been reworked. Flink is now much more flexible when requesting new containers and also giving back uneeded containers. A new test case is testing the container restart. It is also verifying that the web frontend is proplery started, that the logfile access is possible and that the configuration values the user specifies when starting the YARN session are visible in the web frontend. This closes apache#468
- Loading branch information
Showing
24 changed files
with
1,291 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
flink-runtime/src/main/java/org/apache/flink/runtime/util/SignalHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http:https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.apache.flink.runtime.util; | ||
|
||
import org.slf4j.Logger; | ||
import sun.misc.Signal; | ||
|
||
/** | ||
* This signal handler / signal logger is based on Apache Hadoops org.apache.hadoop.util.SignalLogger. | ||
*/ | ||
public class SignalHandler { | ||
private static boolean registered = false; | ||
|
||
/** | ||
* Our signal handler. | ||
*/ | ||
private static class Handler implements sun.misc.SignalHandler { | ||
final private Logger LOG; | ||
final private sun.misc.SignalHandler prevHandler; | ||
|
||
Handler(String name, Logger LOG) { | ||
this.LOG = LOG; | ||
prevHandler = Signal.handle(new Signal(name), this); | ||
} | ||
|
||
/** | ||
* Handle an incoming signal. | ||
* | ||
* @param signal The incoming signal | ||
*/ | ||
@Override | ||
public void handle(Signal signal) { | ||
LOG.error("RECEIVED SIGNAL " + signal.getNumber() + ": SIG" + signal.getName()); | ||
prevHandler.handle(signal); | ||
} | ||
} | ||
|
||
/** | ||
* Register some signal handlers. | ||
* | ||
* @param LOG The slf4j logger | ||
*/ | ||
public static void register(final Logger LOG) { | ||
if (registered) { | ||
throw new IllegalStateException("Can't re-install the signal handlers."); | ||
} | ||
registered = true; | ||
StringBuilder bld = new StringBuilder(); | ||
bld.append("registered UNIX signal handlers for ["); | ||
final String[] SIGNALS = { "TERM", "HUP", "INT" }; | ||
String separator = ""; | ||
for (String signalName : SIGNALS) { | ||
try { | ||
new Handler(signalName, LOG); | ||
bld.append(separator); | ||
bld.append(signalName); | ||
separator = ", "; | ||
} catch (Exception e) { | ||
LOG.debug("Error while registering signal handler", e); | ||
} | ||
} | ||
bld.append("]"); | ||
LOG.info(bld.toString()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.