Search in sources :

Example 1 with HaLeadershipControl

use of org.apache.flink.runtime.highavailability.nonha.embedded.HaLeadershipControl in project flink by apache.

the class FileSourceTextLinesITCase method triggerJobManagerFailover.

private static void triggerJobManagerFailover(JobID jobId, Runnable afterFailAction, MiniCluster miniCluster) throws Exception {
    final HaLeadershipControl haLeadershipControl = miniCluster.getHaLeadershipControl().get();
    haLeadershipControl.revokeJobMasterLeadership(jobId).get();
    afterFailAction.run();
    haLeadershipControl.grantJobMasterLeadership(jobId).get();
}
Also used : HaLeadershipControl(org.apache.flink.runtime.highavailability.nonha.embedded.HaLeadershipControl)

Example 2 with HaLeadershipControl

use of org.apache.flink.runtime.highavailability.nonha.embedded.HaLeadershipControl in project flink by apache.

the class HybridSourceITCase method triggerJobManagerFailover.

private static void triggerJobManagerFailover(JobID jobId, Runnable afterFailAction, MiniCluster miniCluster) throws Exception {
    final HaLeadershipControl haLeadershipControl = miniCluster.getHaLeadershipControl().get();
    haLeadershipControl.revokeJobMasterLeadership(jobId).get();
    afterFailAction.run();
    haLeadershipControl.grantJobMasterLeadership(jobId).get();
}
Also used : HaLeadershipControl(org.apache.flink.runtime.highavailability.nonha.embedded.HaLeadershipControl)

Example 3 with HaLeadershipControl

use of org.apache.flink.runtime.highavailability.nonha.embedded.HaLeadershipControl in project flink by apache.

the class MiniClusterTestEnvironment method triggerJobManagerFailover.

@Override
public void triggerJobManagerFailover(JobClient jobClient, Runnable afterFailAction) throws ExecutionException, InterruptedException {
    final Optional<HaLeadershipControl> controlOptional = miniCluster.getMiniCluster().getHaLeadershipControl();
    if (!controlOptional.isPresent()) {
        throw new UnsupportedOperationException("This MiniCluster does not support JobManager HA");
    }
    final HaLeadershipControl haLeadershipControl = controlOptional.get();
    haLeadershipControl.revokeJobMasterLeadership(jobClient.getJobID()).get();
    afterFailAction.run();
    haLeadershipControl.grantJobMasterLeadership(jobClient.getJobID()).get();
}
Also used : HaLeadershipControl(org.apache.flink.runtime.highavailability.nonha.embedded.HaLeadershipControl)

Aggregations

HaLeadershipControl (org.apache.flink.runtime.highavailability.nonha.embedded.HaLeadershipControl)3