[47/74] [abbrv] hadoop git commit: YARN-7091. Rename application to service in yarn-native-services. Contributed by Jian He
http://git-wip-us.apache.org/repos/asf/hadoop/blob/e94f23ee/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SerializedApplicationReport.java -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SerializedApplicationReport.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SerializedApplicationReport.java deleted file mode 100644 index 405f690..000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SerializedApplicationReport.java +++ /dev/null @@ -1,98 +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.hadoop.yarn.service.utils; - -import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; -import org.apache.hadoop.yarn.api.records.ApplicationReport; -import org.apache.hadoop.yarn.api.records.FinalApplicationStatus; -import org.apache.hadoop.yarn.service.utils.ApplicationReportSerDeser; -import org.codehaus.jackson.annotate.JsonIgnoreProperties; -import org.codehaus.jackson.map.annotate.JsonSerialize; - -import java.io.IOException; - -/** - * Serialized form of an application report which can be persisted - * and then parsed. It can not be converted back into a - * real YARN application report - * - * Useful for testing - */ - -@JsonIgnoreProperties(ignoreUnknown = true) -@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL) - -public class SerializedApplicationReport { - - public String applicationId; - public String applicationAttemptId; - public String name; - public String applicationType; - public String user; - public String queue; - public String host; - public Integer rpcPort; - public String state; - public String diagnostics; - public String url; - /** - * This value is non-null only when a report is generated from a submission context. - * The YARN {@link ApplicationReport} structure does not propagate this value - * from the RM. - */ - public Long submitTime; - public Long startTime; - public Long finishTime; - public String finalStatus; - public String origTrackingUrl; - public Float progress; - - public SerializedApplicationReport() { - } - - public SerializedApplicationReport(ApplicationReport report) { -this.applicationId = report.getApplicationId().toString(); -ApplicationAttemptId attemptId = report.getCurrentApplicationAttemptId(); -this.applicationAttemptId = attemptId != null ? attemptId.toString() : "N/A"; -this.name = report.getName(); -this.applicationType = report.getApplicationType(); -this.user = report.getUser(); -this.queue = report.getQueue(); -this.host = report.getHost(); -this.rpcPort = report.getRpcPort(); -this.state = report.getYarnApplicationState().toString(); -this.diagnostics = report.getDiagnostics(); -this.startTime = report.getStartTime(); -this.finishTime = report.getFinishTime(); -FinalApplicationStatus appStatus = report.getFinalApplicationStatus(); -this.finalStatus = appStatus == null ? "" : appStatus.toString(); -this.progress = report.getProgress(); -this.url = report.getTrackingUrl(); -this.origTrackingUrl= report.getOriginalTrackingUrl(); - } - - @Override - public String toString() { -try { - return ApplicationReportSerDeser.toString(this); -} catch (IOException e) { - return super.toString(); -} - } -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/e94f23ee/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java -- diff --git
[47/74] [abbrv] hadoop git commit: YARN-7091. Rename application to service in yarn-native-services. Contributed by Jian He
http://git-wip-us.apache.org/repos/asf/hadoop/blob/c07469f9/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ZookeeperUtils.java -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ZookeeperUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ZookeeperUtils.java deleted file mode 100644 index 1fa07ce..000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ZookeeperUtils.java +++ /dev/null @@ -1,146 +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.hadoop.yarn.service.utils; - -import com.google.common.net.HostAndPort; -import org.apache.hadoop.util.StringUtils; -import org.apache.hadoop.yarn.service.exceptions.BadConfigException; - -import java.util.ArrayList; -import java.util.List; - -public class ZookeeperUtils { - public static final int DEFAULT_PORT = 2181; - - public static String buildConnectionString(String zkHosts, int port) { -String zkPort = Integer.toString(port); -//parse the hosts -String[] hostlist = zkHosts.split(",", 0); -String quorum = SliderUtils.join(hostlist, ":" + zkPort + ",", false); -return quorum; - } - - /** - * Take a quorum list and split it to (trimmed) pairs - * @param hostPortQuorumList list of form h1:port, h2:port2,... - * @return a possibly empty list of values between commas. They may not be - * valid hostname:port pairs - */ - public static List splitToPairs(String hostPortQuorumList) { -// split an address hot -String[] strings = StringUtils.getStrings(hostPortQuorumList); -int len = 0; -if (strings != null) { - len = strings.length; -} -List tuples = new ArrayList(len); -if (strings != null) { - for (String s : strings) { -tuples.add(s.trim()); - } -} -return tuples; - } - - /** - * Split a quorum list into a list of hostnames and ports - * @param hostPortQuorumList split to a list of hosts and ports - * @return a list of values - */ - public static List splitToHostsAndPorts(String hostPortQuorumList) { -// split an address hot -String[] strings = StringUtils.getStrings(hostPortQuorumList); -int len = 0; -if (strings != null) { - len = strings.length; -} -List list = new ArrayList(len); -if (strings != null) { - for (String s : strings) { - list.add(HostAndPort.fromString(s.trim()).withDefaultPort(DEFAULT_PORT)); - } -} -return list; - } - - /** - * Build up to a hosts only list - * @param hostAndPorts - * @return a list of the hosts only - */ - public static String buildHostsOnlyList(List hostAndPorts) { -StringBuilder sb = new StringBuilder(); -for (HostAndPort hostAndPort : hostAndPorts) { - sb.append(hostAndPort.getHostText()).append(","); -} -if (sb.length() > 0) { - sb.delete(sb.length() - 1, sb.length()); -} -return sb.toString(); - } - - public static String buildQuorumEntry(HostAndPort hostAndPort, -int defaultPort) { -String s = hostAndPort.toString(); -if (hostAndPort.hasPort()) { - return s; -} else { - return s + ":" + defaultPort; -} - } - - /** - * Build a quorum list, injecting a ":defaultPort" ref if needed on - * any entry without one - * @param hostAndPorts - * @param defaultPort - * @return - */ - public static String buildQuorum(List hostAndPorts, int defaultPort) { -List entries = new ArrayList(hostAndPorts.size()); -for (HostAndPort hostAndPort : hostAndPorts) { - entries.add(buildQuorumEntry(hostAndPort, defaultPort)); -} -return SliderUtils.join(entries, ",", false); - } - - public static String convertToHostsOnlyList(String quorum) throws - BadConfigException { -List