/**
* 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 com.datatorrent.stram.cli;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.lang.management.ManagementFactory;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URLEncoder;
import java.security.PrivilegedExceptionAction;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import javax.validation.constraints.NotNull;
import javax.ws.rs.core.MediaType;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jettison.json.JSONArray;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.commons.cli.BasicParser;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.HelpFormatter;
import org.apache.commons.cli.Option;
import org.apache.commons.cli.OptionBuilder;
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;
import org.apache.commons.cli.PosixParser;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.apache.commons.lang.math.NumberUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeysPublic;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
import org.apache.hadoop.yarn.client.api.YarnClient;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.log4j.Appender;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Level;
import org.apache.tools.ant.DirectoryScanner;
import com.google.common.base.Preconditions;
import com.sun.jersey.api.client.WebResource;
import com.datatorrent.api.DAG.GenericOperator;
import com.datatorrent.api.Operator;
import com.datatorrent.api.StreamingApplication;
import com.datatorrent.stram.StramUtils;
import com.datatorrent.stram.client.AppPackage;
import com.datatorrent.stram.client.AppPackage.AppInfo;
import com.datatorrent.stram.client.AppPackage.PropertyInfo;
import com.datatorrent.stram.client.ConfigPackage;
import com.datatorrent.stram.client.DTConfiguration;
import com.datatorrent.stram.client.DTConfiguration.Scope;
import com.datatorrent.stram.client.RecordingsAgent;
import com.datatorrent.stram.client.RecordingsAgent.RecordingInfo;
import com.datatorrent.stram.client.StramAgent;
import com.datatorrent.stram.client.StramAppLauncher;
import com.datatorrent.stram.client.StramAppLauncher.AppFactory;
import com.datatorrent.stram.client.StramClientUtils;
import com.datatorrent.stram.client.StramClientUtils.ClientRMHelper;
import com.datatorrent.stram.codec.LogicalPlanSerializer;
import com.datatorrent.stram.plan.logical.LogicalPlan;
import com.datatorrent.stram.plan.logical.LogicalPlanConfiguration;
import com.datatorrent.stram.plan.logical.requests.AddStreamSinkRequest;
import com.datatorrent.stram.plan.logical.requests.CreateOperatorRequest;
import com.datatorrent.stram.plan.logical.requests.CreateStreamRequest;
import com.datatorrent.stram.plan.logical.requests.LogicalPlanRequest;
import com.datatorrent.stram.plan.logical.requests.RemoveOperatorRequest;
import com.datatorrent.stram.plan.logical.requests.RemoveStreamRequest;
import com.datatorrent.stram.plan.logical.requests.SetOperatorAttributeRequest;
import com.datatorrent.stram.plan.logical.requests.SetOperatorPropertyRequest;
import com.datatorrent.stram.plan.logical.requests.SetPortAttributeRequest;
import com.datatorrent.stram.plan.logical.requests.SetStreamAttributeRequest;
import com.datatorrent.stram.security.StramUserLogin;
import com.datatorrent.stram.util.JSONSerializationProvider;
import com.datatorrent.stram.util.LoggerUtil;
import com.datatorrent.stram.util.SecurityUtils;
import com.datatorrent.stram.util.VersionInfo;
import com.datatorrent.stram.util.WebServicesClient;
import com.datatorrent.stram.webapp.OperatorDiscoverer;
import com.datatorrent.stram.webapp.StramWebServices;
import com.datatorrent.stram.webapp.TypeDiscoverer;
import jline.console.ConsoleReader;
import jline.console.completer.AggregateCompleter;
import jline.console.completer.ArgumentCompleter;
import jline.console.completer.Completer;
import jline.console.completer.FileNameCompleter;
import jline.console.completer.StringsCompleter;
import jline.console.history.FileHistory;
import jline.console.history.History;
import jline.console.history.MemoryHistory;
import sun.misc.Signal;
import sun.misc.SignalHandler;
/**
* Provides command line interface for a streaming application on hadoop (yarn)
* <p>
*
* @since 0.3.2
*/
@SuppressWarnings("UseOfSystemOutOrSystemErr")
public class ApexCli
{
private static final Logger LOG = LoggerFactory.getLogger(ApexCli.class);
private static String CONFIG_EXCLUSIVE = "exclusive";
private static String CONFIG_INCLUSIVE = "inclusive";
private static final String COLOR_RED = "\033[38;5;196m";
private static final String COLOR_YELLOW = "\033[0;93m";
private static final String FORMAT_BOLD = "\033[1m";
private static final String COLOR_RESET = "\033[0m";
private static final String ITALICS = "\033[3m";
private static final String APEX_HIGHLIGHT_COLOR_PROPERTY_NAME = "apex.cli.color.highlight";
private static final String APEX_HIGHLIGHT_COLOR_ENV_VAR_NAME = "APEX_HIGHLIGHT_COLOR";
protected Configuration conf;
private FileSystem fs;
private StramAgent stramAgent;
private YarnClient yarnClient = null;
private ApplicationReport currentApp = null;
private boolean consolePresent;
private String[] commandsToExecute;
private final Map<String, CommandSpec> globalCommands = new TreeMap<>();
private final Map<String, CommandSpec> connectedCommands = new TreeMap<>();
private final Map<String, CommandSpec> logicalPlanChangeCommands = new TreeMap<>();
private final Map<String, String> aliases = new HashMap<>();
private final Map<String, List<String>> macros = new HashMap<>();
private boolean changingLogicalPlan = false;
private final List<LogicalPlanRequest> logicalPlanRequestQueue = new ArrayList<>();
private FileHistory topLevelHi
没有合适的资源?快使用搜索试试~ 我知道了~
Apache Apex 是一个用于大数据流和批处理的统一平台 使用案例包括摄取、ETL、实时分析、警报和实时操作
共617个文件
java:474个
xml:46个
md:20个
需积分: 5 0 下载量 152 浏览量
2024-10-20
17:59:54
上传
评论
收藏 1.97MB ZIP 举报
温馨提示
Apache Apex 是一个用于大数据流和批处理的统一平台。使用案例包括摄取、ETL、实时分析、警报和实时操作。Apex 是 Hadoop 原生 YARN 实现,默认使用 HDFS。它通过缩短上市时间来简化 Hadoop 应用程序的开发和产品化。主要功能包括企业级可操作性与容错能力、状态管理、事件处理保证、无数据丢失、内存性能和可扩展性以及原生窗口支持。
资源推荐
资源详情
资源评论
收起资源包目录
Apache Apex 是一个用于大数据流和批处理的统一平台 使用案例包括摄取、ETL、实时分析、警报和实时操作 (617个子文件)
apex.1 10KB
apex 4KB
jvm.config 64B
org.apache.apex.engine.api.plugin.DAGExecutionPlugin 832B
Dockerfile 1KB
org.apache.apex.api.EmbeddedAppLauncher 837B
.gitignore 184B
ExtRes.html 843B
favicon.ico 25KB
apex-importorder.importorder 119B
apex-style.jar 1KB
ApexCli.java 152KB
StreamingContainerManager.java 134KB
PhysicalPlanTest.java 104KB
LogicalPlanConfiguration.java 95KB
LogicalPlan.java 87KB
PhysicalPlan.java 75KB
LogicalPlanConfigurationTest.java 69KB
StreamingContainer.java 68KB
FastPublisher.java 66KB
StreamCodecTest.java 60KB
StreamingContainerManagerTest.java 52KB
StreamingAppMasterService.java 51KB
LogicalPlanTest.java 46KB
TypeGraph.java 39KB
DataList.java 38KB
OperatorDiscoveryTest.java 38KB
StramClientUtils.java 38KB
StreamPersistanceTests.java 36KB
StramWebServices.java 36KB
OiOStreamTest.java 35KB
OperatorDiscoverer.java 33KB
GenericNode.java 33KB
StramClient.java 32KB
Context.java 30KB
Server.java 29KB
GenericNodeTest.java 29KB
TestModuleExpansion.java 27KB
StramRecoveryTest.java 26KB
StramAppLauncher.java 25KB
RecordingsAgent.java 24KB
Node.java 24KB
StramMiniClusterTest.java 23KB
CheckpointTest.java 23KB
AbstractReservoir.java 19KB
PartitioningTest.java 19KB
DelayOperatorTest.java 19KB
AppPackage.java 19KB
StramTestSupport.java 19KB
StramLocalCluster.java 19KB
LogicalPlanModificationTest.java 18KB
StreamingContainerAgent.java 18KB
LoggerUtil.java 18KB
TupleRecorderCollection.java 17KB
StramWebServicesTest.java 17KB
StramClientUtilsTest.java 16KB
StramLocalClusterTest.java 16KB
LogicalPlanSerializer.java 16KB
TupleRecorder.java 16KB
StringCodec.java 16KB
StramAgent.java 15KB
StreamMapping.java 15KB
AutoMetricTest.java 15KB
ServerTest.java 15KB
StramEvent.java 15KB
LaunchContainerRunnable.java 14KB
AbstractReservoirTest.java 14KB
HostLocalTest.java 14KB
StatsAgent.java 14KB
TupleRecorderTest.java 14KB
ResourceRequestHandler.java 13KB
PTOperator.java 13KB
BufferServerSubscriber.java 13KB
Operator.java 13KB
LoggerUtilTest.java 12KB
PubSubWebSocketServlet.java 12KB
WindowGeneratorTest.java 12KB
DAG.java 12KB
AppDataPushAgent.java 12KB
DTConfiguration.java 12KB
ProcessingModeTests.java 11KB
StramAppLauncherTest.java 11KB
TypeDiscoveryTest.java 11KB
CustomControlTupleTest.java 11KB
StreamingContainerUmbilicalProtocol.java 11KB
InjectConfigTest.java 11KB
StatsTest.java 11KB
PubSubWebSocketClient.java 11KB
LogicalNode.java 11KB
WindowGenerator.java 10KB
NodeTest.java 10KB
StatelessPartitioner.java 10KB
TypeDiscoverer.java 10KB
ApexCliTest.java 10KB
WebServicesClient.java 10KB
Attribute.java 9KB
JarHelper.java 9KB
FSStatsRecorder.java 9KB
PlanModifier.java 9KB
AppPackageTest.java 9KB
共 617 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
Java程序员-张凯
- 粉丝: 1w+
- 资源: 7394
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功