-
Notifications
You must be signed in to change notification settings - Fork 13k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FLINK-4505] [cluster mngt] Separate TaskManager service configuratio…
…n from TaskManagerConfiguration; Implement TaskManagerRunner Refactors the startup logic so that is easier to reuse. This closes #2461.
- Loading branch information
1 parent
df25f0a
commit 5513fe6
Showing
19 changed files
with
1,195 additions
and
942 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
...rc/main/java/org/apache/flink/runtime/highavailability/HighAvailabilityServicesUtils.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,41 @@ | ||
/* | ||
* 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://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.highavailability; | ||
|
||
import org.apache.flink.configuration.Configuration; | ||
import org.apache.flink.runtime.jobmanager.HighAvailabilityMode; | ||
import org.apache.flink.runtime.util.LeaderRetrievalUtils; | ||
|
||
public class HighAvailabilityServicesUtils { | ||
|
||
public static HighAvailabilityServices createHighAvailabilityServices(Configuration configuration) throws Exception { | ||
HighAvailabilityMode highAvailabilityMode = LeaderRetrievalUtils.getRecoveryMode(configuration); | ||
|
||
switch(highAvailabilityMode) { | ||
case NONE: | ||
final String resourceManagerAddress = null; | ||
return new NonHaServices(resourceManagerAddress); | ||
case ZOOKEEPER: | ||
throw new UnsupportedOperationException("ZooKeeper high availability services " + | ||
"have not been implemented yet."); | ||
default: | ||
throw new Exception("Recovery mode " + highAvailabilityMode + " is not supported."); | ||
} | ||
} | ||
} |
73 changes: 73 additions & 0 deletions
73
flink-runtime/src/main/java/org/apache/flink/runtime/rpc/RpcServiceUtils.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,73 @@ | ||
/* | ||
* 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://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.rpc; | ||
|
||
import akka.actor.ActorSystem; | ||
import com.typesafe.config.Config; | ||
import org.apache.flink.api.common.time.Time; | ||
import org.apache.flink.configuration.Configuration; | ||
import org.apache.flink.runtime.akka.AkkaUtils; | ||
import org.apache.flink.runtime.rpc.akka.AkkaRpcService; | ||
import org.apache.flink.util.NetUtils; | ||
import org.jboss.netty.channel.ChannelException; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.IOException; | ||
|
||
public class RpcServiceUtils { | ||
private static final Logger LOG = LoggerFactory.getLogger(RpcServiceUtils.class); | ||
|
||
/** | ||
* Utility method to create RPC service from configuration and hostname, port. | ||
* | ||
* @param hostname The hostname/address that describes the TaskManager's data location. | ||
* @param port If true, the TaskManager will not initiate the TCP network stack. | ||
* @param configuration The configuration for the TaskManager. | ||
* @return The rpc service which is used to start and connect to the TaskManager RpcEndpoint . | ||
* @throws IOException Thrown, if the actor system can not bind to the address | ||
* @throws Exception Thrown is some other error occurs while creating akka actor system | ||
*/ | ||
public static RpcService createRpcService(String hostname, int port, Configuration configuration) throws Exception { | ||
LOG.info("Starting AkkaRpcService at {}.", NetUtils.hostAndPortToUrlString(hostname, port)); | ||
|
||
final ActorSystem actorSystem; | ||
|
||
try { | ||
Config akkaConfig = AkkaUtils.getAkkaConfig(configuration, hostname, port); | ||
|
||
LOG.debug("Using akka configuration \n {}.", akkaConfig); | ||
|
||
actorSystem = AkkaUtils.createActorSystem(akkaConfig); | ||
} catch (Throwable t) { | ||
if (t instanceof ChannelException) { | ||
Throwable cause = t.getCause(); | ||
if (cause != null && t.getCause() instanceof java.net.BindException) { | ||
String address = NetUtils.hostAndPortToUrlString(hostname, port); | ||
throw new IOException("Unable to bind AkkaRpcService actor system to address " + | ||
address + " - " + cause.getMessage(), t); | ||
} | ||
} | ||
throw new Exception("Could not create TaskManager actor system", t); | ||
} | ||
|
||
final Time timeout = Time.milliseconds(AkkaUtils.getTimeout(configuration).toMillis()); | ||
return new AkkaRpcService(actorSystem, timeout); | ||
} | ||
} |
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
142 changes: 0 additions & 142 deletions
142
...untime/src/main/java/org/apache/flink/runtime/taskexecutor/TaskExecutorConfiguration.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.