This is an automated email from the ASF dual-hosted git repository. trohrmann pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/flink.git
commit 2a798e471db68c360d23d7d9284cee652997e5d9 Author: Till Rohrmann <[email protected]> AuthorDate: Mon Sep 24 09:57:38 2018 +0200 [hotfix] Remove TaskManagerProcess --- .../runtime/testutils/TaskManagerProcess.java | 132 --------------------- 1 file changed, 132 deletions(-) diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/testutils/TaskManagerProcess.java b/flink-runtime/src/test/java/org/apache/flink/runtime/testutils/TaskManagerProcess.java deleted file mode 100644 index b381f62..0000000 --- a/flink-runtime/src/test/java/org/apache/flink/runtime/testutils/TaskManagerProcess.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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.testutils; - -import org.apache.flink.api.java.utils.ParameterTool; -import org.apache.flink.configuration.Configuration; -import org.apache.flink.configuration.TaskManagerOptions; -import org.apache.flink.runtime.clusterframework.types.ResourceID; -import org.apache.flink.runtime.taskmanager.TaskManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.Map; -import java.util.concurrent.CountDownLatch; - -import static org.apache.flink.util.Preconditions.checkArgument; -import static org.apache.flink.util.Preconditions.checkNotNull; - -/** - * A {@link TaskManager} instance running in a separate JVM. - */ -public class TaskManagerProcess extends TestJvmProcess { - - /** ID for this TaskManager */ - private final int id; - - /** The configuration for the TaskManager */ - private final Configuration config; - - /** Configuration parsed as args for {@link TaskManagerProcess.TaskManagerProcessEntryPoint} */ - private final String[] jvmArgs; - - public TaskManagerProcess(int id, Configuration config) throws Exception { - checkArgument(id >= 0, "Negative ID"); - this.id = id; - this.config = checkNotNull(config, "Configuration"); - - ArrayList<String> args = new ArrayList<>(); - - for (Map.Entry<String, String> entry : config.toMap().entrySet()) { - args.add("--" + entry.getKey()); - args.add(entry.getValue()); - } - - this.jvmArgs = new String[args.size()]; - args.toArray(jvmArgs); - } - - @Override - public String getName() { - return "TaskManager " + id; - } - - @Override - public String[] getJvmArgs() { - return jvmArgs; - } - - @Override - public String getEntryPointClassName() { - return TaskManagerProcessEntryPoint.class.getName(); - } - - public int getId() { - return id; - } - - @Override - public String toString() { - return String.format("TaskManagerProcess(id=%d)", id); - } - - /** - * Entry point for the TaskManager process. - */ - public static class TaskManagerProcessEntryPoint { - - private static final Logger LOG = LoggerFactory.getLogger(TaskManagerProcessEntryPoint.class); - - /** - * All arguments are parsed to a {@link Configuration} and passed to the Taskmanager, - * for instance: <code>--high-availability ZOOKEEPER --high-availability.zookeeper.quorum "xyz:123:456"</code>. - */ - public static void main(String[] args) throws Exception { - try { - Configuration config = ParameterTool.fromArgs(args).getConfiguration(); - - if (!config.contains(TaskManagerOptions.MANAGED_MEMORY_SIZE)) { - config.setString(TaskManagerOptions.MANAGED_MEMORY_SIZE, "4m"); - } - - if (!config.contains(TaskManagerOptions.NETWORK_NUM_BUFFERS)) { - config.setInteger(TaskManagerOptions.NETWORK_NUM_BUFFERS, 100); - } - - - LOG.info("Configuration: {}.", config); - - // Run the TaskManager - TaskManager.selectNetworkInterfaceAndRunTaskManager( - config, - ResourceID.generate(), - TaskManager.class); - - // Run forever - new CountDownLatch(1).await(); - } - catch (Throwable t) { - LOG.error("Failed to start TaskManager process", t); - System.exit(1); - } - } - } - -}
