diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/server/application_history_server.proto hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/server/application_history_server.proto
index 5b2f4f0..2f3c643 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/server/application_history_server.proto
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/server/application_history_server.proto
@@ -36,6 +36,23 @@ message ApplicationHistoryDataProto {
optional FinalApplicationStatusProto final_application_status = 10;
}
+message ApplicationStartDataProto {
+ optional ApplicationIdProto application_id = 1;
+ optional string application_name = 2;
+ optional string application_type = 3;
+ optional string user = 4;
+ optional string queue = 5;
+ optional int64 submit_time = 6;
+ optional int64 start_time = 7;
+}
+
+message ApplicationFinishDataProto {
+ optional ApplicationIdProto application_id = 1;
+ optional int64 finish_time = 2;
+ optional string diagnostics_info = 3;
+ optional FinalApplicationStatusProto final_application_status = 4;
+}
+
message ApplicationAttemptHistoryDataProto {
optional ApplicationAttemptIdProto application_attempt_id = 1;
optional string host = 2;
@@ -46,6 +63,20 @@ message ApplicationAttemptHistoryDataProto {
optional ContainerIdProto master_container_id = 7;
}
+message ApplicationAttemptStartDataProto {
+ optional ApplicationAttemptIdProto application_attempt_id = 1;
+ optional string host = 2;
+ optional int32 rpc_port = 3;
+ optional ContainerIdProto master_container_id = 4;
+}
+
+message ApplicationAttemptFinishDataProto {
+ optional ApplicationAttemptIdProto application_attempt_id = 1;
+ optional string tracking_url = 2;
+ optional string diagnostics_info = 3;
+ optional FinalApplicationStatusProto final_application_status = 4;
+}
+
message ContainerHistoryDataProto {
optional ContainerIdProto container_id = 1;
optional ResourceProto allocated_resource = 2;
@@ -55,5 +86,21 @@ message ContainerHistoryDataProto {
optional int64 finish_time = 6;
optional string diagnostics_info = 7;
optional string log_url = 8;
- optional ContainerStateProto final_container_status = 9;
+ optional int32 container_exit_status = 9;
+}
+
+message ContainerStartDataProto {
+ optional ContainerIdProto container_id = 1;
+ optional ResourceProto allocated_resource = 2;
+ optional NodeIdProto assigned_node_id = 3;
+ optional PriorityProto priority = 4;
+ optional int64 start_time = 5;
+}
+
+message ContainerFinishDataProto {
+ optional ContainerIdProto container_id = 1;
+ optional int64 finish_time = 2;
+ optional string diagnostics_info = 3;
+ optional string log_url = 4;
+ optional int32 container_exit_status = 5;
}
\ No newline at end of file
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationAttemptFinishData.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationAttemptFinishData.java
new file mode 100644
index 0000000..86c5d0f
--- /dev/null
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationAttemptFinishData.java
@@ -0,0 +1,86 @@
+/**
+ * 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.server.applicationhistoryservice.records;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * The class contains the fields that can be determined when
+ * RMAppAttempt finishes, and that need to be stored persistently.
+ */
+@Public
+@Unstable
+public abstract class ApplicationAttemptFinishData {
+
+ @Public
+ @Unstable
+ public static ApplicationAttemptFinishData newInstance(
+ ApplicationAttemptId appAttemptId, String host, int rpcPort,
+ ContainerId masterContainerId, String diagnosticsInfo,
+ String trackingURL,
+ FinalApplicationStatus finalApplicationStatus) {
+ ApplicationAttemptFinishData appAttemptFD =
+ Records.newRecord(ApplicationAttemptFinishData.class);
+ appAttemptFD.setApplicationAttemptId(appAttemptId);
+ appAttemptFD.setDiagnosticsInfo(diagnosticsInfo);
+ appAttemptFD.setTrackingURL(trackingURL);
+ appAttemptFD.setFinalApplicationStatus(finalApplicationStatus);
+ return appAttemptFD;
+ }
+
+ @Public
+ @Unstable
+ public abstract ApplicationAttemptId getApplicationAttemptId();
+
+ @Public
+ @Unstable
+ public abstract void setApplicationAttemptId(
+ ApplicationAttemptId applicationAttemptId);
+
+ @Public
+ @Unstable
+ public abstract String getTrackingURL();
+
+ @Public
+ @Unstable
+ public abstract void setTrackingURL(String trackingURL);
+
+ @Public
+ @Unstable
+ public abstract String getDiagnosticsInfo();
+
+ @Public
+ @Unstable
+ public abstract void setDiagnosticsInfo(String diagnosticsInfo);
+
+ @Public
+ @Unstable
+ public abstract FinalApplicationStatus getFinalApplicationStatus();
+
+ @Public
+ @Unstable
+ public abstract void setFinalApplicationStatus(
+ FinalApplicationStatus finalApplicationStatus);
+
+}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationAttemptHistoryData.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationAttemptHistoryData.java
index 0c3afa3..b4d8acc 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationAttemptHistoryData.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationAttemptHistoryData.java
@@ -23,69 +23,91 @@
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
+import org.apache.hadoop.yarn.util.Records;
/**
- * The class contains all the fields that need to be stored persistently for
+ * The class contains all the fields that are stored persistently for
* RMAppAttempt.
*/
@Public
@Unstable
-public interface ApplicationAttemptHistoryData {
+public abstract class ApplicationAttemptHistoryData {
@Public
@Unstable
- ApplicationAttemptId getApplicationAttemptId();
+ public static ApplicationAttemptHistoryData newInstance(
+ ApplicationAttemptId appAttemptId, String host, int rpcPort,
+ ContainerId masterContainerId, String diagnosticsInfo,
+ String trackingURL,
+ FinalApplicationStatus finalApplicationStatus) {
+ ApplicationAttemptHistoryData appAttemptHD =
+ Records.newRecord(ApplicationAttemptHistoryData.class);
+ appAttemptHD.setApplicationAttemptId(appAttemptId);
+ appAttemptHD.setHost(host);
+ appAttemptHD.setRPCPort(rpcPort);
+ appAttemptHD.setMasterContainerId(masterContainerId);
+ appAttemptHD.setDiagnosticsInfo(diagnosticsInfo);
+ appAttemptHD.setTrackingURL(trackingURL);
+ appAttemptHD.setFinalApplicationStatus(finalApplicationStatus);
+ return appAttemptHD;
+ }
@Public
@Unstable
- void setApplicationAttemptId(ApplicationAttemptId applicationAttemptId);
+ public abstract ApplicationAttemptId getApplicationAttemptId();
@Public
@Unstable
- String getHost();
+ public abstract void setApplicationAttemptId(
+ ApplicationAttemptId applicationAttemptId);
@Public
@Unstable
- void setHost(String host);
+ public abstract String getHost();
@Public
@Unstable
- int getRPCPort();
+ public abstract void setHost(String host);
@Public
@Unstable
- void setRPCPort(int rpcPort);
+ public abstract int getRPCPort();
@Public
@Unstable
- String getTrackingURL();
+ public abstract void setRPCPort(int rpcPort);
@Public
@Unstable
- void setTrackingURL(String trackingURL);
+ public abstract String getTrackingURL();
@Public
@Unstable
- String getDiagnosticsInfo();
+ public abstract void setTrackingURL(String trackingURL);
@Public
@Unstable
- void setDiagnosticsInfo(String diagnosticsInfo);
+ public abstract String getDiagnosticsInfo();
@Public
@Unstable
- FinalApplicationStatus getFinalApplicationStatus();
+ public abstract void setDiagnosticsInfo(String diagnosticsInfo);
@Public
@Unstable
- void setFinalApplicationStatus(FinalApplicationStatus finalApplicationStatus);
+ public abstract FinalApplicationStatus getFinalApplicationStatus();
@Public
@Unstable
- ContainerId getMasterContainerId();
+ public abstract void setFinalApplicationStatus(
+ FinalApplicationStatus finalApplicationStatus);
@Public
@Unstable
- void setMasterContainerId(ContainerId masterContainerId);
+ public abstract ContainerId getMasterContainerId();
+
+ @Public
+ @Unstable
+ public abstract void setMasterContainerId(ContainerId masterContainerId);
}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationAttemptStartData.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationAttemptStartData.java
new file mode 100644
index 0000000..7ca43fa
--- /dev/null
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationAttemptStartData.java
@@ -0,0 +1,82 @@
+/**
+ * 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.server.applicationhistoryservice.records;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * The class contains the fields that can be determined when
+ * RMAppAttempt starts, and that need to be stored persistently.
+ */
+@Public
+@Unstable
+public abstract class ApplicationAttemptStartData {
+
+ @Public
+ @Unstable
+ public static ApplicationAttemptStartData newInstance(
+ ApplicationAttemptId appAttemptId, String host, int rpcPort,
+ ContainerId masterContainerId) {
+ ApplicationAttemptStartData appAttemptSD =
+ Records.newRecord(ApplicationAttemptStartData.class);
+ appAttemptSD.setApplicationAttemptId(appAttemptId);
+ appAttemptSD.setHost(host);
+ appAttemptSD.setRPCPort(rpcPort);
+ appAttemptSD.setMasterContainerId(masterContainerId);
+ return appAttemptSD;
+ }
+
+ @Public
+ @Unstable
+ public abstract ApplicationAttemptId getApplicationAttemptId();
+
+ @Public
+ @Unstable
+ public abstract void setApplicationAttemptId(
+ ApplicationAttemptId applicationAttemptId);
+
+ @Public
+ @Unstable
+ public abstract String getHost();
+
+ @Public
+ @Unstable
+ public abstract void setHost(String host);
+
+ @Public
+ @Unstable
+ public abstract int getRPCPort();
+
+ @Public
+ @Unstable
+ public abstract void setRPCPort(int rpcPort);
+
+ @Public
+ @Unstable
+ public abstract ContainerId getMasterContainerId();
+
+ @Public
+ @Unstable
+ public abstract void setMasterContainerId(ContainerId masterContainerId);
+
+}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationFinishData.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationFinishData.java
new file mode 100644
index 0000000..b9b7d3b
--- /dev/null
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationFinishData.java
@@ -0,0 +1,82 @@
+/**
+ * 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.server.applicationhistoryservice.records;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * The class contains the fields that can be determined when
+ * RMApp finishes, and that need to be stored persistently.
+ */
+@Public
+@Unstable
+public abstract class ApplicationFinishData {
+
+ @Public
+ @Unstable
+ public static ApplicationFinishData newInstance(ApplicationId applicationId,
+ long finishTime, String diagnosticsInfo,
+ FinalApplicationStatus finalApplicationStatus) {
+ ApplicationFinishData appFD =
+ Records.newRecord(ApplicationFinishData.class);
+ appFD.setApplicationId(applicationId);
+ appFD.setFinishTime(finishTime);
+ appFD.setDiagnosticsInfo(diagnosticsInfo);
+ appFD.setFinalApplicationStatus(finalApplicationStatus);
+ return appFD;
+ }
+
+ @Public
+ @Unstable
+ public abstract ApplicationId getApplicationId();
+
+ @Public
+ @Unstable
+ public abstract void setApplicationId(ApplicationId applicationId);
+
+ @Public
+ @Unstable
+ public abstract long getFinishTime();
+
+ @Public
+ @Unstable
+ public abstract void setFinishTime(long finishTime);
+
+ @Public
+ @Unstable
+ public abstract String getDiagnosticsInfo();
+
+ @Public
+ @Unstable
+ public abstract void setDiagnosticsInfo(String diagnosticInfo);
+
+ @Public
+ @Unstable
+ public abstract FinalApplicationStatus getFinalApplicationStatus();
+
+ @Public
+ @Unstable
+ public abstract void setFinalApplicationStatus(
+ FinalApplicationStatus finalApplicationStatus);
+
+}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationHistoryData.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationHistoryData.java
index 1512864..b2826d7 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationHistoryData.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationHistoryData.java
@@ -22,93 +22,116 @@
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
+import org.apache.hadoop.yarn.util.Records;
/**
- * The class contains all the fields that need to be stored persistently for
+ * The class contains all the fields that are stored persistently for
* RMApp.
*/
@Public
@Unstable
-public interface ApplicationHistoryData {
+public abstract class ApplicationHistoryData {
@Public
@Unstable
- ApplicationId getApplicationId();
+ public static ApplicationHistoryData newInstance(ApplicationId applicationId,
+ String applicationName, String applicationType, String queue,
+ String user, long submitTime, long startTime, long finishTime,
+ String diagnosticsInfo, FinalApplicationStatus finalApplicationStatus) {
+ ApplicationHistoryData appHD =
+ Records.newRecord(ApplicationHistoryData.class);
+ appHD.setApplicationId(applicationId);
+ appHD.setApplicationName(applicationName);
+ appHD.setApplicationType(applicationType);
+ appHD.setQueue(queue);
+ appHD.setUser(user);
+ appHD.setSubmitTime(submitTime);
+ appHD.setStartTime(startTime);
+ appHD.setFinishTime(finishTime);
+ appHD.setDiagnosticsInfo(diagnosticsInfo);
+ appHD.setFinalApplicationStatus(finalApplicationStatus);
+ return appHD;
+ }
@Public
@Unstable
- void setApplicationId(ApplicationId applicationId);
+ public abstract ApplicationId getApplicationId();
@Public
@Unstable
- String getApplicationName();
+ public abstract void setApplicationId(ApplicationId applicationId);
@Public
@Unstable
- void setApplicationName(String applicationName);
+ public abstract String getApplicationName();
@Public
@Unstable
- String getApplicationType();
+ public abstract void setApplicationName(String applicationName);
@Public
@Unstable
- void setApplicationType(String applicationType);
+ public abstract String getApplicationType();
@Public
@Unstable
- String getUser();
+ public abstract void setApplicationType(String applicationType);
@Public
@Unstable
- void setUser(String user);
+ public abstract String getUser();
@Public
@Unstable
- String getQueue();
+ public abstract void setUser(String user);
@Public
@Unstable
- void setQueue(String queue);
+ public abstract String getQueue();
@Public
@Unstable
- long getSubmitTime();
+ public abstract void setQueue(String queue);
@Public
@Unstable
- void setSubmitTime(long submitTime);
+ public abstract long getSubmitTime();
@Public
@Unstable
- long getStartTime();
+ public abstract void setSubmitTime(long submitTime);
@Public
@Unstable
- void setStartTime(long startTime);
+ public abstract long getStartTime();
@Public
@Unstable
- long getFinishTime();
+ public abstract void setStartTime(long startTime);
@Public
@Unstable
- void setFinishTime(long finishTime);
+ public abstract long getFinishTime();
@Public
@Unstable
- String getDiagnosticsInfo();
+ public abstract void setFinishTime(long finishTime);
@Public
@Unstable
- void setDiagnosticsInfo(String diagnosticInfo);
+ public abstract String getDiagnosticsInfo();
@Public
@Unstable
- FinalApplicationStatus getFinalApplicationStatus();
+ public abstract void setDiagnosticsInfo(String diagnosticInfo);
@Public
@Unstable
- void setFinalApplicationStatus(FinalApplicationStatus finalApplicationStatus);
+ public abstract FinalApplicationStatus getFinalApplicationStatus();
+
+ @Public
+ @Unstable
+ public abstract void setFinalApplicationStatus(
+ FinalApplicationStatus finalApplicationStatus);
}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationStartData.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationStartData.java
new file mode 100644
index 0000000..021a061
--- /dev/null
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ApplicationStartData.java
@@ -0,0 +1,108 @@
+/**
+ * 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.server.applicationhistoryservice.records;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * The class contains the fields that can be determined when
+ * RMApp starts, and that need to be stored persistently.
+ */
+@Public
+@Unstable
+public abstract class ApplicationStartData {
+
+ @Public
+ @Unstable
+ public static ApplicationStartData newInstance(
+ ApplicationId applicationId, String applicationName,
+ String applicationType, String queue, String user,
+ long submitTime, long startTime) {
+ ApplicationStartData appSD =
+ Records.newRecord(ApplicationStartData.class);
+ appSD.setApplicationId(applicationId);
+ appSD.setApplicationName(applicationName);
+ appSD.setApplicationType(applicationType);
+ appSD.setQueue(queue);
+ appSD.setUser(user);
+ appSD.setSubmitTime(submitTime);
+ appSD.setStartTime(startTime);
+ return appSD;
+ }
+
+ @Public
+ @Unstable
+ public abstract ApplicationId getApplicationId();
+
+ @Public
+ @Unstable
+ public abstract void setApplicationId(ApplicationId applicationId);
+
+ @Public
+ @Unstable
+ public abstract String getApplicationName();
+
+ @Public
+ @Unstable
+ public abstract void setApplicationName(String applicationName);
+
+ @Public
+ @Unstable
+ public abstract String getApplicationType();
+
+ @Public
+ @Unstable
+ public abstract void setApplicationType(String applicationType);
+
+ @Public
+ @Unstable
+ public abstract String getUser();
+
+ @Public
+ @Unstable
+ public abstract void setUser(String user);
+
+ @Public
+ @Unstable
+ public abstract String getQueue();
+
+ @Public
+ @Unstable
+ public abstract void setQueue(String queue);
+
+ @Public
+ @Unstable
+ public abstract long getSubmitTime();
+
+ @Public
+ @Unstable
+ public abstract void setSubmitTime(long submitTime);
+
+ @Public
+ @Unstable
+ public abstract long getStartTime();
+
+ @Public
+ @Unstable
+ public abstract void setStartTime(long startTime);
+
+}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerFinishData.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerFinishData.java
new file mode 100644
index 0000000..707020b
--- /dev/null
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerFinishData.java
@@ -0,0 +1,89 @@
+/**
+ * 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.server.applicationhistoryservice.records;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * The class contains the fields that can be determined when
+ * RMContainer finishes, and that need to be stored persistently.
+ */
+@Public
+@Unstable
+public abstract class ContainerFinishData {
+
+ @Public
+ @Unstable
+ public static ContainerFinishData newInstance(ContainerId containerId,
+ long finishTime, String diagnosticsInfo, String logURL,
+ int containerExitCode) {
+ ContainerFinishData containerFD =
+ Records.newRecord(ContainerFinishData.class);
+ containerFD.setContainerId(containerId);
+ containerFD.setFinishTime(finishTime);
+ containerFD.setDiagnosticsInfo(diagnosticsInfo);
+ containerFD.setLogURL(logURL);
+ containerFD.setContainerExitStatus(containerExitCode);
+ return containerFD;
+ }
+
+ @Public
+ @Unstable
+ public abstract ContainerId getContainerId();
+
+ @Public
+ @Unstable
+ public abstract void setContainerId(ContainerId containerId);
+
+ @Public
+ @Unstable
+ public abstract long getFinishTime();
+
+ @Public
+ @Unstable
+ public abstract void setFinishTime(long finishTime);
+
+ @Public
+ @Unstable
+ public abstract String getDiagnosticsInfo();
+
+ @Public
+ @Unstable
+ public abstract void setDiagnosticsInfo(String diagnosticInfo);
+
+ @Public
+ @Unstable
+ public abstract String getLogURL();
+
+ @Public
+ @Unstable
+ public abstract void setLogURL(String logURL);
+
+ @Public
+ @Unstable
+ public abstract int getContainerExitStatus();
+
+ @Public
+ @Unstable
+ public abstract void setContainerExitStatus(int containerExitStatus);
+
+}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerHistoryData.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerHistoryData.java
index f069b5c..1089ba2 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerHistoryData.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerHistoryData.java
@@ -21,89 +21,109 @@
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.ContainerState;
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.Priority;
import org.apache.hadoop.yarn.api.records.Resource;
+import org.apache.hadoop.yarn.util.Records;
/**
- * The class contains all the fields that need to be stored persistently for
+ * The class contains all the fields that are stored persistently for
* RMContainer.
*/
@Public
@Unstable
-public interface ContainerHistoryData {
+public abstract class ContainerHistoryData {
@Public
@Unstable
- ContainerId getContainerId();
+ public static ContainerHistoryData newInstance(ContainerId containerId,
+ Resource allocatedResource, NodeId assignedNode, Priority priority,
+ long startTime, long finishTime, String diagnosticsInfo, String logURL,
+ int containerExitCode) {
+ ContainerHistoryData containerHD =
+ Records.newRecord(ContainerHistoryData.class);
+ containerHD.setContainerId(containerId);
+ containerHD.setAllocatedResource(allocatedResource);
+ containerHD.setAssignedNode(assignedNode);
+ containerHD.setPriority(priority);
+ containerHD.setStartTime(startTime);
+ containerHD.setFinishTime(finishTime);
+ containerHD.setDiagnosticsInfo(diagnosticsInfo);
+ containerHD.setLogURL(logURL);
+ containerHD.setContainerExitStatus(containerExitCode);
+ return containerHD;
+ }
@Public
@Unstable
- void setContainerId(ContainerId containerId);
+ public abstract ContainerId getContainerId();
@Public
@Unstable
- Resource getAllocatedResource();
+ public abstract void setContainerId(ContainerId containerId);
@Public
@Unstable
- void setAllocatedResource(Resource resource);
+ public abstract Resource getAllocatedResource();
@Public
@Unstable
- NodeId getAssignedNode();
+ public abstract void setAllocatedResource(Resource resource);
@Public
@Unstable
- void setAssignedNode(NodeId nodeId);
+ public abstract NodeId getAssignedNode();
@Public
@Unstable
- Priority getPriority();
+ public abstract void setAssignedNode(NodeId nodeId);
@Public
@Unstable
- void setPriority(Priority priority);
+ public abstract Priority getPriority();
@Public
@Unstable
- long getStartTime();
+ public abstract void setPriority(Priority priority);
@Public
@Unstable
- void setStartTime(long startTime);
+ public abstract long getStartTime();
@Public
@Unstable
- long getFinishTime();
+ public abstract void setStartTime(long startTime);
@Public
@Unstable
- void setFinishTime(long finishTime);
+ public abstract long getFinishTime();
@Public
@Unstable
- String getDiagnosticsInfo();
+ public abstract void setFinishTime(long finishTime);
@Public
@Unstable
- void setDiagnosticsInfo(String diagnosticInfo);
+ public abstract String getDiagnosticsInfo();
@Public
@Unstable
- String getLogURL();
+ public abstract void setDiagnosticsInfo(String diagnosticInfo);
@Public
@Unstable
- void setLogURL(String logURL);
+ public abstract String getLogURL();
@Public
@Unstable
- ContainerState getFinalContainerStatus();
+ public abstract void setLogURL(String logURL);
@Public
@Unstable
- void setFinalContainerStatus(ContainerState finalContainerState);
+ public abstract int getContainerExitStatus();
+
+ @Public
+ @Unstable
+ public abstract void setContainerExitStatus(int containerExitStatus);
}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerStartData.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerStartData.java
new file mode 100644
index 0000000..0c6dd81
--- /dev/null
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/ContainerStartData.java
@@ -0,0 +1,92 @@
+/**
+ * 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.server.applicationhistoryservice.records;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.NodeId;
+import org.apache.hadoop.yarn.api.records.Priority;
+import org.apache.hadoop.yarn.api.records.Resource;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ * The class contains the fields that can be determined when
+ * RMContainer starts, and that need to be stored persistently.
+ */
+@Public
+@Unstable
+public abstract class ContainerStartData {
+
+ @Public
+ @Unstable
+ public static ContainerStartData newInstance(ContainerId containerId,
+ Resource allocatedResource, NodeId assignedNode, Priority priority,
+ long startTime) {
+ ContainerStartData containerSD =
+ Records.newRecord(ContainerStartData.class);
+ containerSD.setContainerId(containerId);
+ containerSD.setAllocatedResource(allocatedResource);
+ containerSD.setAssignedNode(assignedNode);
+ containerSD.setPriority(priority);
+ containerSD.setStartTime(startTime);
+ return containerSD;
+ }
+
+ @Public
+ @Unstable
+ public abstract ContainerId getContainerId();
+
+ @Public
+ @Unstable
+ public abstract void setContainerId(ContainerId containerId);
+
+ @Public
+ @Unstable
+ public abstract Resource getAllocatedResource();
+
+ @Public
+ @Unstable
+ public abstract void setAllocatedResource(Resource resource);
+
+ @Public
+ @Unstable
+ public abstract NodeId getAssignedNode();
+
+ @Public
+ @Unstable
+ public abstract void setAssignedNode(NodeId nodeId);
+
+ @Public
+ @Unstable
+ public abstract Priority getPriority();
+
+ @Public
+ @Unstable
+ public abstract void setPriority(Priority priority);
+
+ @Public
+ @Unstable
+ public abstract long getStartTime();
+
+ @Public
+ @Unstable
+ public abstract void setStartTime(long startTime);
+
+}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptFinishDataPBImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptFinishDataPBImpl.java
new file mode 100644
index 0000000..03f2afa
--- /dev/null
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptFinishDataPBImpl.java
@@ -0,0 +1,209 @@
+/**
+ * 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.server.applicationhistoryservice.records.impl.pb;
+
+import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
+import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl;
+import org.apache.hadoop.yarn.api.records.impl.pb.ProtoUtils;
+import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationAttemptFinishDataProto;
+import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationAttemptFinishDataProtoOrBuilder;
+import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationAttemptIdProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.FinalApplicationStatusProto;
+import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptFinishData;
+
+import com.google.protobuf.TextFormat;
+
+
+public class ApplicationAttemptFinishDataPBImpl
+ extends ApplicationAttemptFinishData {
+
+ ApplicationAttemptFinishDataProto proto =
+ ApplicationAttemptFinishDataProto.getDefaultInstance();
+ ApplicationAttemptFinishDataProto.Builder builder = null;
+ boolean viaProto = false;
+
+ public ApplicationAttemptFinishDataPBImpl() {
+ builder = ApplicationAttemptFinishDataProto.newBuilder();
+ }
+
+ public ApplicationAttemptFinishDataPBImpl(
+ ApplicationAttemptFinishDataProto proto) {
+ this.proto = proto;
+ viaProto = true;
+ }
+
+ private ApplicationAttemptId applicationAttemptId;
+
+ @Override
+ public ApplicationAttemptId getApplicationAttemptId() {
+ if (this.applicationAttemptId != null) {
+ return this.applicationAttemptId;
+ }
+ ApplicationAttemptFinishDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasApplicationAttemptId()) {
+ return null;
+ }
+ this.applicationAttemptId =
+ convertFromProtoFormat(p.getApplicationAttemptId());
+ return this.applicationAttemptId;
+ }
+
+ @Override
+ public void
+ setApplicationAttemptId(ApplicationAttemptId applicationAttemptId) {
+ maybeInitBuilder();
+ if (applicationAttemptId == null) {
+ builder.clearApplicationAttemptId();
+ }
+ this.applicationAttemptId = applicationAttemptId;
+ }
+
+ @Override
+ public String getTrackingURL() {
+ ApplicationAttemptFinishDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasTrackingUrl()) {
+ return null;
+ }
+ return p.getTrackingUrl();
+ }
+
+ @Override
+ public void setTrackingURL(String trackingURL) {
+ maybeInitBuilder();
+ if (trackingURL == null) {
+ builder.clearTrackingUrl();
+ return;
+ }
+ builder.setTrackingUrl(trackingURL);
+ }
+
+ @Override
+ public String getDiagnosticsInfo() {
+ ApplicationAttemptFinishDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasDiagnosticsInfo()) {
+ return null;
+ }
+ return p.getDiagnosticsInfo();
+ }
+
+ @Override
+ public void setDiagnosticsInfo(String diagnosticsInfo) {
+ maybeInitBuilder();
+ if (diagnosticsInfo == null) {
+ builder.clearDiagnosticsInfo();
+ return;
+ }
+ builder.setDiagnosticsInfo(diagnosticsInfo);
+ }
+
+ @Override
+ public FinalApplicationStatus getFinalApplicationStatus() {
+ ApplicationAttemptFinishDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasFinalApplicationStatus()) {
+ return null;
+ }
+ return convertFromProtoFormat(p.getFinalApplicationStatus());
+ }
+
+ @Override
+ public void setFinalApplicationStatus(
+ FinalApplicationStatus finalApplicationStatus) {
+ maybeInitBuilder();
+ if (finalApplicationStatus == null) {
+ builder.clearFinalApplicationStatus();
+ return;
+ }
+ builder.setFinalApplicationStatus(
+ convertToProtoFormat(finalApplicationStatus));
+ }
+
+ public ApplicationAttemptFinishDataProto getProto() {
+ mergeLocalToProto();
+ proto = viaProto ? proto : builder.build();
+ viaProto = true;
+ return proto;
+ }
+
+ @Override
+ public int hashCode() {
+ return getProto().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null)
+ return false;
+ if (other.getClass().isAssignableFrom(this.getClass())) {
+ return this.getProto().equals(this.getClass().cast(other).getProto());
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return TextFormat.shortDebugString(getProto());
+ }
+
+ private void mergeLocalToBuilder() {
+ if (this.applicationAttemptId != null && !((ApplicationAttemptIdPBImpl)
+ this.applicationAttemptId).getProto().equals(
+ builder.getApplicationAttemptId())) {
+ builder.setApplicationAttemptId(
+ convertToProtoFormat(this.applicationAttemptId));
+ }
+ }
+
+ private void mergeLocalToProto() {
+ if (viaProto) {
+ maybeInitBuilder();
+ }
+ mergeLocalToBuilder();
+ proto = builder.build();
+ viaProto = true;
+ }
+
+ private void maybeInitBuilder() {
+ if (viaProto || builder == null) {
+ builder = ApplicationAttemptFinishDataProto.newBuilder(proto);
+ }
+ viaProto = false;
+ }
+
+ private ApplicationAttemptIdPBImpl convertFromProtoFormat(
+ ApplicationAttemptIdProto applicationAttemptId) {
+ return new ApplicationAttemptIdPBImpl(applicationAttemptId);
+ }
+
+ private ApplicationAttemptIdProto convertToProtoFormat(
+ ApplicationAttemptId applicationAttemptId) {
+ return ((ApplicationAttemptIdPBImpl) applicationAttemptId).getProto();
+ }
+
+ private FinalApplicationStatus convertFromProtoFormat(
+ FinalApplicationStatusProto finalApplicationStatus) {
+ return ProtoUtils.convertFromProtoFormat(finalApplicationStatus);
+ }
+
+ private FinalApplicationStatusProto convertToProtoFormat(
+ FinalApplicationStatus finalApplicationStatus) {
+ return ProtoUtils.convertToProtoFormat(finalApplicationStatus);
+ }
+
+}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptHistoryDataPBImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptHistoryDataPBImpl.java
index 3362875..c58405d 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptHistoryDataPBImpl.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptHistoryDataPBImpl.java
@@ -23,7 +23,6 @@
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.ContainerIdPBImpl;
-import org.apache.hadoop.yarn.api.records.impl.pb.ProtoBase;
import org.apache.hadoop.yarn.api.records.impl.pb.ProtoUtils;
import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationAttemptHistoryDataProto;
import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationAttemptHistoryDataProtoOrBuilder;
@@ -32,10 +31,11 @@
import org.apache.hadoop.yarn.proto.YarnProtos.FinalApplicationStatusProto;
import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptHistoryData;
+import com.google.protobuf.TextFormat;
+
public class ApplicationAttemptHistoryDataPBImpl
- extends ProtoBase
- implements ApplicationAttemptHistoryData {
+ extends ApplicationAttemptHistoryData {
ApplicationAttemptHistoryDataProto proto =
ApplicationAttemptHistoryDataProto.getDefaultInstance();
@@ -192,7 +192,6 @@ public void setMasterContainerId(ContainerId masterContainerId) {
this.masterContainerId = masterContainerId;
}
- @Override
public ApplicationAttemptHistoryDataProto getProto() {
mergeLocalToProto();
proto = viaProto ? proto : builder.build();
@@ -217,7 +216,7 @@ public boolean equals(Object other) {
@Override
public String toString() {
- return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
+ return TextFormat.shortDebugString(getProto());
}
private void mergeLocalToBuilder() {
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptStartDataPBImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptStartDataPBImpl.java
new file mode 100644
index 0000000..5dbbecc
--- /dev/null
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationAttemptStartDataPBImpl.java
@@ -0,0 +1,211 @@
+/**
+ * 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.server.applicationhistoryservice.records.impl.pb;
+
+import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl;
+import org.apache.hadoop.yarn.api.records.impl.pb.ContainerIdPBImpl;
+import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationAttemptStartDataProto;
+import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationAttemptStartDataProtoOrBuilder;
+import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationAttemptIdProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProto;
+import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationAttemptStartData;
+
+import com.google.protobuf.TextFormat;
+
+
+public class ApplicationAttemptStartDataPBImpl
+ extends ApplicationAttemptStartData {
+
+ ApplicationAttemptStartDataProto proto =
+ ApplicationAttemptStartDataProto.getDefaultInstance();
+ ApplicationAttemptStartDataProto.Builder builder = null;
+ boolean viaProto = false;
+
+ public ApplicationAttemptStartDataPBImpl() {
+ builder = ApplicationAttemptStartDataProto.newBuilder();
+ }
+
+ public ApplicationAttemptStartDataPBImpl(
+ ApplicationAttemptStartDataProto proto) {
+ this.proto = proto;
+ viaProto = true;
+ }
+
+ private ApplicationAttemptId applicationAttemptId;
+ private ContainerId masterContainerId;
+
+ @Override
+ public ApplicationAttemptId getApplicationAttemptId() {
+ if (this.applicationAttemptId != null) {
+ return this.applicationAttemptId;
+ }
+ ApplicationAttemptStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasApplicationAttemptId()) {
+ return null;
+ }
+ this.applicationAttemptId =
+ convertFromProtoFormat(p.getApplicationAttemptId());
+ return this.applicationAttemptId;
+ }
+
+ @Override
+ public void
+ setApplicationAttemptId(ApplicationAttemptId applicationAttemptId) {
+ maybeInitBuilder();
+ if (applicationAttemptId == null) {
+ builder.clearApplicationAttemptId();
+ }
+ this.applicationAttemptId = applicationAttemptId;
+ }
+
+ @Override
+ public String getHost() {
+ ApplicationAttemptStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasHost()) {
+ return null;
+ }
+ return p.getHost();
+ }
+
+ @Override
+ public void setHost(String host) {
+ maybeInitBuilder();
+ if (host == null) {
+ builder.clearHost();
+ return;
+ }
+ builder.setHost(host);
+ }
+
+ @Override
+ public int getRPCPort() {
+ ApplicationAttemptStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ return p.getRpcPort();
+ }
+
+ @Override
+ public void setRPCPort(int rpcPort) {
+ maybeInitBuilder();
+ builder.setRpcPort(rpcPort);
+ }
+
+ @Override
+ public ContainerId getMasterContainerId() {
+ if (this.masterContainerId != null) {
+ return this.masterContainerId;
+ }
+ ApplicationAttemptStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasApplicationAttemptId()) {
+ return null;
+ }
+ this.masterContainerId =
+ convertFromProtoFormat(p.getMasterContainerId());
+ return this.masterContainerId;
+ }
+
+ @Override
+ public void setMasterContainerId(ContainerId masterContainerId) {
+ maybeInitBuilder();
+ if (masterContainerId == null) {
+ builder.clearMasterContainerId();
+ }
+ this.masterContainerId = masterContainerId;
+ }
+
+ public ApplicationAttemptStartDataProto getProto() {
+ mergeLocalToProto();
+ proto = viaProto ? proto : builder.build();
+ viaProto = true;
+ return proto;
+ }
+
+ @Override
+ public int hashCode() {
+ return getProto().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null)
+ return false;
+ if (other.getClass().isAssignableFrom(this.getClass())) {
+ return this.getProto().equals(this.getClass().cast(other).getProto());
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return TextFormat.shortDebugString(getProto());
+ }
+
+ private void mergeLocalToBuilder() {
+ if (this.applicationAttemptId != null && !((ApplicationAttemptIdPBImpl)
+ this.applicationAttemptId).getProto().equals(
+ builder.getApplicationAttemptId())) {
+ builder.setApplicationAttemptId(
+ convertToProtoFormat(this.applicationAttemptId));
+ }
+ if (this.masterContainerId != null && !((ContainerIdPBImpl)
+ this.masterContainerId).getProto().equals(
+ builder.getMasterContainerId())) {
+ builder.setMasterContainerId(
+ convertToProtoFormat(this.masterContainerId));
+ }
+ }
+
+ private void mergeLocalToProto() {
+ if (viaProto) {
+ maybeInitBuilder();
+ }
+ mergeLocalToBuilder();
+ proto = builder.build();
+ viaProto = true;
+ }
+
+ private void maybeInitBuilder() {
+ if (viaProto || builder == null) {
+ builder = ApplicationAttemptStartDataProto.newBuilder(proto);
+ }
+ viaProto = false;
+ }
+
+ private ApplicationAttemptIdPBImpl convertFromProtoFormat(
+ ApplicationAttemptIdProto applicationAttemptId) {
+ return new ApplicationAttemptIdPBImpl(applicationAttemptId);
+ }
+
+ private ApplicationAttemptIdProto convertToProtoFormat(
+ ApplicationAttemptId applicationAttemptId) {
+ return ((ApplicationAttemptIdPBImpl) applicationAttemptId).getProto();
+ }
+
+ private ContainerIdPBImpl convertFromProtoFormat(
+ ContainerIdProto containerId) {
+ return new ContainerIdPBImpl(containerId);
+ }
+
+ private ContainerIdProto convertToProtoFormat(
+ ContainerId masterContainerId) {
+ return ((ContainerIdPBImpl) masterContainerId).getProto();
+ }
+
+}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationFinishDataPBImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationFinishDataPBImpl.java
new file mode 100644
index 0000000..f784aaf
--- /dev/null
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationFinishDataPBImpl.java
@@ -0,0 +1,197 @@
+/**
+ * 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.server.applicationhistoryservice.records.impl.pb;
+
+import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
+import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl;
+import org.apache.hadoop.yarn.api.records.impl.pb.ProtoUtils;
+import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationFinishDataProto;
+import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationFinishDataProtoOrBuilder;
+import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.FinalApplicationStatusProto;
+import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationFinishData;
+
+import com.google.protobuf.TextFormat;
+
+
+public class ApplicationFinishDataPBImpl
+ extends ApplicationFinishData {
+
+ ApplicationFinishDataProto proto =
+ ApplicationFinishDataProto.getDefaultInstance();
+ ApplicationFinishDataProto.Builder builder = null;
+ boolean viaProto = false;
+
+ private ApplicationId applicationId;
+
+ public ApplicationFinishDataPBImpl() {
+ builder = ApplicationFinishDataProto.newBuilder();
+ }
+
+ public ApplicationFinishDataPBImpl(ApplicationFinishDataProto proto) {
+ this.proto = proto;
+ viaProto = true;
+ }
+
+ @Override
+ public ApplicationId getApplicationId() {
+ if (this.applicationId != null) {
+ return this.applicationId;
+ }
+ ApplicationFinishDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasApplicationId()) {
+ return null;
+ }
+ this.applicationId = convertFromProtoFormat(p.getApplicationId());
+ return this.applicationId;
+ }
+
+ @Override
+ public void setApplicationId(ApplicationId applicationId) {
+ maybeInitBuilder();
+ if (applicationId == null) {
+ builder.clearApplicationId();
+ }
+ this.applicationId = applicationId;
+ }
+
+ @Override
+ public long getFinishTime() {
+ ApplicationFinishDataProtoOrBuilder p = viaProto ? proto : builder;
+ return p.getFinishTime();
+ }
+
+ @Override
+ public void setFinishTime(long finishTime) {
+ maybeInitBuilder();
+ builder.setFinishTime(finishTime);
+ }
+
+ @Override
+ public String getDiagnosticsInfo() {
+ ApplicationFinishDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasDiagnosticsInfo()) {
+ return null;
+ }
+ return p.getDiagnosticsInfo();
+ }
+
+ @Override
+ public void setDiagnosticsInfo(String diagnosticInfo) {
+ maybeInitBuilder();
+ if (diagnosticInfo == null) {
+ builder.clearDiagnosticsInfo();
+ return;
+ }
+ builder.setDiagnosticsInfo(diagnosticInfo);
+ }
+
+ @Override
+ public FinalApplicationStatus getFinalApplicationStatus() {
+ ApplicationFinishDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasFinalApplicationStatus()) {
+ return null;
+ }
+ return convertFromProtoFormat(p.getFinalApplicationStatus());
+ }
+
+ @Override
+ public void setFinalApplicationStatus(
+ FinalApplicationStatus finalApplicationStatus) {
+ maybeInitBuilder();
+ if (finalApplicationStatus == null) {
+ builder.clearFinalApplicationStatus();
+ return;
+ }
+ builder.setFinalApplicationStatus(
+ convertToProtoFormat(finalApplicationStatus));
+ }
+
+ public ApplicationFinishDataProto getProto() {
+ mergeLocalToProto();
+ proto = viaProto ? proto : builder.build();
+ viaProto = true;
+ return proto;
+ }
+
+ @Override
+ public int hashCode() {
+ return getProto().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null)
+ return false;
+ if (other.getClass().isAssignableFrom(this.getClass())) {
+ return this.getProto().equals(this.getClass().cast(other).getProto());
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return TextFormat.shortDebugString(getProto());
+ }
+
+ private void mergeLocalToBuilder() {
+ if (this.applicationId != null && !((ApplicationIdPBImpl)
+ this.applicationId).getProto().equals(builder.getApplicationId())) {
+ builder.setApplicationId(convertToProtoFormat(this.applicationId));
+ }
+ }
+
+ private void mergeLocalToProto() {
+ if (viaProto) {
+ maybeInitBuilder();
+ }
+ mergeLocalToBuilder();
+ proto = builder.build();
+ viaProto = true;
+ }
+
+ private void maybeInitBuilder() {
+ if (viaProto || builder == null) {
+ builder = ApplicationFinishDataProto.newBuilder(proto);
+ }
+ viaProto = false;
+ }
+
+ private ApplicationIdProto convertToProtoFormat(
+ ApplicationId applicationId) {
+ return ((ApplicationIdPBImpl) applicationId).getProto();
+ }
+
+ private ApplicationIdPBImpl convertFromProtoFormat(
+ ApplicationIdProto applicationId) {
+ return new ApplicationIdPBImpl(applicationId);
+ }
+
+ private FinalApplicationStatus convertFromProtoFormat(
+ FinalApplicationStatusProto finalApplicationStatus) {
+ return ProtoUtils.convertFromProtoFormat(finalApplicationStatus);
+ }
+
+ private FinalApplicationStatusProto convertToProtoFormat(
+ FinalApplicationStatus finalApplicationStatus) {
+ return ProtoUtils.convertToProtoFormat(finalApplicationStatus);
+ }
+
+}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationHistoryDataPBImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationHistoryDataPBImpl.java
index 7a65918..ab70c38 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationHistoryDataPBImpl.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationHistoryDataPBImpl.java
@@ -21,7 +21,6 @@
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl;
-import org.apache.hadoop.yarn.api.records.impl.pb.ProtoBase;
import org.apache.hadoop.yarn.api.records.impl.pb.ProtoUtils;
import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationHistoryDataProto;
import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationHistoryDataProtoOrBuilder;
@@ -29,10 +28,11 @@
import org.apache.hadoop.yarn.proto.YarnProtos.FinalApplicationStatusProto;
import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationHistoryData;
+import com.google.protobuf.TextFormat;
+
public class ApplicationHistoryDataPBImpl
- extends ProtoBase
- implements ApplicationHistoryData {
+ extends ApplicationHistoryData {
ApplicationHistoryDataProto proto =
ApplicationHistoryDataProto.getDefaultInstance();
@@ -224,7 +224,6 @@ public void setFinalApplicationStatus(
convertToProtoFormat(finalApplicationStatus));
}
- @Override
public ApplicationHistoryDataProto getProto() {
mergeLocalToProto();
proto = viaProto ? proto : builder.build();
@@ -249,7 +248,7 @@ public boolean equals(Object other) {
@Override
public String toString() {
- return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
+ return TextFormat.shortDebugString(getProto());
}
private void mergeLocalToBuilder() {
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationStartDataPBImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationStartDataPBImpl.java
new file mode 100644
index 0000000..b08023e
--- /dev/null
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ApplicationStartDataPBImpl.java
@@ -0,0 +1,231 @@
+/**
+ * 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.server.applicationhistoryservice.records.impl.pb;
+
+import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl;
+import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationStartDataProto;
+import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ApplicationStartDataProtoOrBuilder;
+import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto;
+import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ApplicationStartData;
+
+import com.google.protobuf.TextFormat;
+
+
+public class ApplicationStartDataPBImpl
+ extends ApplicationStartData {
+
+ ApplicationStartDataProto proto =
+ ApplicationStartDataProto.getDefaultInstance();
+ ApplicationStartDataProto.Builder builder = null;
+ boolean viaProto = false;
+
+ private ApplicationId applicationId;
+
+ public ApplicationStartDataPBImpl() {
+ builder = ApplicationStartDataProto.newBuilder();
+ }
+
+ public ApplicationStartDataPBImpl(ApplicationStartDataProto proto) {
+ this.proto = proto;
+ viaProto = true;
+ }
+
+ @Override
+ public ApplicationId getApplicationId() {
+ if (this.applicationId != null) {
+ return this.applicationId;
+ }
+ ApplicationStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasApplicationId()) {
+ return null;
+ }
+ this.applicationId = convertFromProtoFormat(p.getApplicationId());
+ return this.applicationId;
+ }
+
+ @Override
+ public void setApplicationId(ApplicationId applicationId) {
+ maybeInitBuilder();
+ if (applicationId == null) {
+ builder.clearApplicationId();
+ }
+ this.applicationId = applicationId;
+ }
+
+ @Override
+ public String getApplicationName() {
+ ApplicationStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasApplicationName()) {
+ return null;
+ }
+ return p.getApplicationName();
+ }
+
+ @Override
+ public void setApplicationName(String applicationName) {
+ maybeInitBuilder();
+ if (applicationName == null) {
+ builder.clearApplicationName();
+ return;
+ }
+ builder.setApplicationName(applicationName);
+ }
+
+ @Override
+ public String getApplicationType() {
+ ApplicationStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasApplicationType()) {
+ return null;
+ }
+ return p.getApplicationType();
+ }
+
+ @Override
+ public void setApplicationType(String applicationType) {
+ maybeInitBuilder();
+ if (applicationType == null) {
+ builder.clearApplicationType();
+ return;
+ }
+ builder.setApplicationType(applicationType);
+ }
+
+ @Override
+ public String getUser() {
+ ApplicationStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasUser()) {
+ return null;
+ }
+ return p.getUser();
+ }
+
+ @Override
+ public void setUser(String user) {
+ maybeInitBuilder();
+ if (user == null) {
+ builder.clearUser();
+ return;
+ }
+ builder.setUser(user);
+ }
+
+ @Override
+ public String getQueue() {
+ ApplicationStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasQueue()) {
+ return null;
+ }
+ return p.getQueue();
+ }
+
+ @Override
+ public void setQueue(String queue) {
+ maybeInitBuilder();
+ if (queue == null) {
+ builder.clearQueue();
+ return;
+ }
+ builder.setQueue(queue);
+ }
+
+ @Override
+ public long getSubmitTime() {
+ ApplicationStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ return p.getStartTime();
+ }
+
+ @Override
+ public void setSubmitTime(long submitTime) {
+ maybeInitBuilder();
+ builder.setSubmitTime(submitTime);
+ }
+
+ @Override
+ public long getStartTime() {
+ ApplicationStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ return p.getStartTime();
+ }
+
+ @Override
+ public void setStartTime(long startTime) {
+ maybeInitBuilder();
+ builder.setStartTime(startTime);
+ }
+
+ public ApplicationStartDataProto getProto() {
+ mergeLocalToProto();
+ proto = viaProto ? proto : builder.build();
+ viaProto = true;
+ return proto;
+ }
+
+ @Override
+ public int hashCode() {
+ return getProto().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null)
+ return false;
+ if (other.getClass().isAssignableFrom(this.getClass())) {
+ return this.getProto().equals(this.getClass().cast(other).getProto());
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return TextFormat.shortDebugString(getProto());
+ }
+
+ private void mergeLocalToBuilder() {
+ if (this.applicationId != null && !((ApplicationIdPBImpl)
+ this.applicationId).getProto().equals(builder.getApplicationId())) {
+ builder.setApplicationId(convertToProtoFormat(this.applicationId));
+ }
+ }
+
+ private void mergeLocalToProto() {
+ if (viaProto) {
+ maybeInitBuilder();
+ }
+ mergeLocalToBuilder();
+ proto = builder.build();
+ viaProto = true;
+ }
+
+ private void maybeInitBuilder() {
+ if (viaProto || builder == null) {
+ builder = ApplicationStartDataProto.newBuilder(proto);
+ }
+ viaProto = false;
+ }
+
+ private ApplicationIdProto convertToProtoFormat(
+ ApplicationId applicationId) {
+ return ((ApplicationIdPBImpl) applicationId).getProto();
+ }
+
+ private ApplicationIdPBImpl convertFromProtoFormat(
+ ApplicationIdProto applicationId) {
+ return new ApplicationIdPBImpl(applicationId);
+ }
+}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerFinishDataPBImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerFinishDataPBImpl.java
new file mode 100644
index 0000000..64893b6
--- /dev/null
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerFinishDataPBImpl.java
@@ -0,0 +1,194 @@
+/**
+ * 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.server.applicationhistoryservice.records.impl.pb;
+
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.impl.pb.ContainerIdPBImpl;
+import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ContainerFinishDataProto;
+import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ContainerFinishDataProtoOrBuilder;
+import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProto;
+import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ContainerFinishData;
+
+import com.google.protobuf.TextFormat;
+
+
+public class ContainerFinishDataPBImpl
+ extends ContainerFinishData {
+
+ ContainerFinishDataProto proto =
+ ContainerFinishDataProto.getDefaultInstance();
+ ContainerFinishDataProto.Builder builder = null;
+ boolean viaProto = false;
+
+ private ContainerId containerId;
+
+ public ContainerFinishDataPBImpl() {
+ builder = ContainerFinishDataProto.newBuilder();
+ }
+
+ public ContainerFinishDataPBImpl(ContainerFinishDataProto proto) {
+ this.proto = proto;
+ viaProto = true;
+ }
+
+ @Override
+ public ContainerId getContainerId() {
+ if (this != null) {
+ return this.containerId;
+ }
+ ContainerFinishDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasContainerId()) {
+ return null;
+ }
+ this.containerId = convertFromProtoFormat(p.getContainerId());
+ return this.containerId;
+ }
+
+ @Override
+ public void setContainerId(ContainerId containerId) {
+ maybeInitBuilder();
+ if (containerId == null) {
+ builder.clearContainerId();
+ }
+ this.containerId = containerId;
+ }
+
+ @Override
+ public long getFinishTime() {
+ ContainerFinishDataProtoOrBuilder p = viaProto ? proto : builder;
+ return p.getFinishTime();
+ }
+
+ @Override
+ public void setFinishTime(long finishTime) {
+ maybeInitBuilder();
+ builder.setFinishTime(finishTime);
+ }
+
+ @Override
+ public String getDiagnosticsInfo() {
+ ContainerFinishDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasDiagnosticsInfo()) {
+ return null;
+ }
+ return p.getDiagnosticsInfo();
+ }
+
+ @Override
+ public void setDiagnosticsInfo(String diagnosticInfo) {
+ maybeInitBuilder();
+ if (diagnosticInfo == null) {
+ builder.clearDiagnosticsInfo();
+ return;
+ }
+ builder.setDiagnosticsInfo(diagnosticInfo);
+ }
+
+ @Override
+ public String getLogURL() {
+ ContainerFinishDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasLogUrl()) {
+ return null;
+ }
+ return p.getLogUrl();
+ }
+
+ @Override
+ public void setLogURL(String logURL) {
+ maybeInitBuilder();
+ if (logURL == null) {
+ builder.clearLogUrl();
+ return;
+ }
+ builder.setLogUrl(logURL);
+ }
+
+ @Override
+ public int getContainerExitStatus() {
+ ContainerFinishDataProtoOrBuilder p = viaProto ? proto : builder;
+ return p.getContainerExitStatus();
+ }
+
+ @Override
+ public void setContainerExitStatus(int containerExitStatus) {
+ maybeInitBuilder();
+ builder.setContainerExitStatus(containerExitStatus);
+ }
+
+ public ContainerFinishDataProto getProto() {
+ mergeLocalToProto();
+ proto = viaProto ? proto : builder.build();
+ viaProto = true;
+ return proto;
+ }
+
+ @Override
+ public int hashCode() {
+ return getProto().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null)
+ return false;
+ if (other.getClass().isAssignableFrom(this.getClass())) {
+ return this.getProto().equals(this.getClass().cast(other).getProto());
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return TextFormat.shortDebugString(getProto());
+ }
+
+ private void mergeLocalToBuilder() {
+ if (this.containerId != null && !((ContainerIdPBImpl)
+ this.containerId).getProto().equals(builder.getContainerId())) {
+ builder.setContainerId(convertToProtoFormat(this.containerId));
+ }
+ }
+
+ private void mergeLocalToProto() {
+ if (viaProto) {
+ maybeInitBuilder();
+ }
+ mergeLocalToBuilder();
+ proto = builder.build();
+ viaProto = true;
+ }
+
+ private void maybeInitBuilder() {
+ if (viaProto || builder == null) {
+ builder = ContainerFinishDataProto.newBuilder(proto);
+ }
+ viaProto = false;
+ }
+
+ private ContainerIdProto convertToProtoFormat(
+ ContainerId containerId) {
+ return ((ContainerIdPBImpl) containerId).getProto();
+ }
+
+ private ContainerIdPBImpl convertFromProtoFormat(
+ ContainerIdProto containerId) {
+ return new ContainerIdPBImpl(containerId);
+ }
+
+}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerHistoryDataPBImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerHistoryDataPBImpl.java
index 2cd95a8..8585047 100644
--- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerHistoryDataPBImpl.java
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerHistoryDataPBImpl.java
@@ -19,29 +19,26 @@
package org.apache.hadoop.yarn.server.applicationhistoryservice.records.impl.pb;
import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.ContainerState;
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.Priority;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.impl.pb.ContainerIdPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl;
import org.apache.hadoop.yarn.api.records.impl.pb.PriorityPBImpl;
-import org.apache.hadoop.yarn.api.records.impl.pb.ProtoBase;
-import org.apache.hadoop.yarn.api.records.impl.pb.ProtoUtils;
import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl;
import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ContainerHistoryDataProto;
import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ContainerHistoryDataProtoOrBuilder;
import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProto;
-import org.apache.hadoop.yarn.proto.YarnProtos.ContainerStateProto;
import org.apache.hadoop.yarn.proto.YarnProtos.NodeIdProto;
import org.apache.hadoop.yarn.proto.YarnProtos.PriorityProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto;
import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ContainerHistoryData;
+import com.google.protobuf.TextFormat;
+
public class ContainerHistoryDataPBImpl
- extends ProtoBase
- implements ContainerHistoryData {
+ extends ContainerHistoryData {
ContainerHistoryDataProto proto =
ContainerHistoryDataProto.getDefaultInstance();
@@ -213,27 +210,17 @@ public void setLogURL(String logURL) {
}
@Override
- public ContainerState getFinalContainerStatus() {
+ public int getContainerExitStatus() {
ContainerHistoryDataProtoOrBuilder p = viaProto ? proto : builder;
- if (!p.hasFinalContainerStatus()) {
- return null;
- }
- return convertFromProtoFormat(p.getFinalContainerStatus());
+ return p.getContainerExitStatus();
}
@Override
- public void setFinalContainerStatus(
- ContainerState finalContainerState) {
+ public void setContainerExitStatus(int containerExitStatus) {
maybeInitBuilder();
- if (finalContainerState == null) {
- builder.clearFinalContainerStatus();
- return;
- }
- builder.setFinalContainerStatus(
- convertToProtoFormat(finalContainerState));
+ builder.setContainerExitStatus(containerExitStatus);
}
- @Override
public ContainerHistoryDataProto getProto() {
mergeLocalToProto();
proto = viaProto ? proto : builder.build();
@@ -258,7 +245,7 @@ public boolean equals(Object other) {
@Override
public String toString() {
- return getProto().toString().replaceAll("\\n", ", ").replaceAll("\\s+", " ");
+ return TextFormat.shortDebugString(getProto());
}
private void mergeLocalToBuilder() {
@@ -297,7 +284,7 @@ private void maybeInitBuilder() {
}
private ContainerIdProto convertToProtoFormat(
- ContainerId ContainerId) {
+ ContainerId containerId) {
return ((ContainerIdPBImpl) containerId).getProto();
}
@@ -330,14 +317,4 @@ private PriorityPBImpl convertFromProtoFormat(PriorityProto priority) {
return new PriorityPBImpl(priority);
}
- private ContainerState convertFromProtoFormat(
- ContainerStateProto finalContainerStatus) {
- return ProtoUtils.convertFromProtoFormat(finalContainerStatus);
- }
-
- private ContainerStateProto convertToProtoFormat(
- ContainerState finalContainerStatus) {
- return ProtoUtils.convertToProtoFormat(finalContainerStatus);
- }
-
}
diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerStartDataPBImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerStartDataPBImpl.java
new file mode 100644
index 0000000..0f06d24
--- /dev/null
+++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/records/impl/pb/ContainerStartDataPBImpl.java
@@ -0,0 +1,258 @@
+/**
+ * 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.server.applicationhistoryservice.records.impl.pb;
+
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.NodeId;
+import org.apache.hadoop.yarn.api.records.Priority;
+import org.apache.hadoop.yarn.api.records.Resource;
+import org.apache.hadoop.yarn.api.records.impl.pb.ContainerIdPBImpl;
+import org.apache.hadoop.yarn.api.records.impl.pb.NodeIdPBImpl;
+import org.apache.hadoop.yarn.api.records.impl.pb.PriorityPBImpl;
+import org.apache.hadoop.yarn.api.records.impl.pb.ResourcePBImpl;
+import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ContainerStartDataProto;
+import org.apache.hadoop.yarn.proto.ApplicationHistoryServerProtos.ContainerStartDataProtoOrBuilder;
+import org.apache.hadoop.yarn.proto.YarnProtos.ContainerIdProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.NodeIdProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.PriorityProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.ResourceProto;
+import org.apache.hadoop.yarn.server.applicationhistoryservice.records.ContainerStartData;
+
+import com.google.protobuf.TextFormat;
+
+
+public class ContainerStartDataPBImpl
+ extends ContainerStartData {
+
+ ContainerStartDataProto proto =
+ ContainerStartDataProto.getDefaultInstance();
+ ContainerStartDataProto.Builder builder = null;
+ boolean viaProto = false;
+
+ private ContainerId containerId;
+ private Resource resource;
+ private NodeId nodeId;
+ private Priority priority;
+
+ public ContainerStartDataPBImpl() {
+ builder = ContainerStartDataProto.newBuilder();
+ }
+
+ public ContainerStartDataPBImpl(ContainerStartDataProto proto) {
+ this.proto = proto;
+ viaProto = true;
+ }
+
+ @Override
+ public ContainerId getContainerId() {
+ if (this != null) {
+ return this.containerId;
+ }
+ ContainerStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasContainerId()) {
+ return null;
+ }
+ this.containerId = convertFromProtoFormat(p.getContainerId());
+ return this.containerId;
+ }
+
+ @Override
+ public void setContainerId(ContainerId containerId) {
+ maybeInitBuilder();
+ if (containerId == null) {
+ builder.clearContainerId();
+ }
+ this.containerId = containerId;
+ }
+
+ @Override
+ public Resource getAllocatedResource() {
+ if (this != null) {
+ return this.resource;
+ }
+ ContainerStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasAllocatedResource()) {
+ return null;
+ }
+ this.resource = convertFromProtoFormat(p.getAllocatedResource());
+ return this.resource;
+ }
+
+ @Override
+ public void setAllocatedResource(Resource resource) {
+ maybeInitBuilder();
+ if (resource == null) {
+ builder.clearAllocatedResource();
+ }
+ this.resource = resource;
+ }
+
+ @Override
+ public NodeId getAssignedNode() {
+ if (this != null) {
+ return this.nodeId;
+ }
+ ContainerStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasAssignedNodeId()) {
+ return null;
+ }
+ this.nodeId = convertFromProtoFormat(p.getAssignedNodeId());
+ return this.nodeId;
+ }
+
+ @Override
+ public void setAssignedNode(NodeId nodeId) {
+ maybeInitBuilder();
+ if (nodeId == null) {
+ builder.clearAssignedNodeId();
+ }
+ this.nodeId = nodeId;
+ }
+
+ @Override
+ public Priority getPriority() {
+ if (this != null) {
+ return this.priority;
+ }
+ ContainerStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ if (!p.hasPriority()) {
+ return null;
+ }
+ this.priority = convertFromProtoFormat(p.getPriority());
+ return this.priority;
+ }
+
+ @Override
+ public void setPriority(Priority priority) {
+ maybeInitBuilder();
+ if (priority == null) {
+ builder.clearPriority();
+ }
+ this.priority = priority;
+ }
+
+ @Override
+ public long getStartTime() {
+ ContainerStartDataProtoOrBuilder p = viaProto ? proto : builder;
+ return p.getStartTime();
+ }
+
+ @Override
+ public void setStartTime(long startTime) {
+ maybeInitBuilder();
+ builder.setStartTime(startTime);
+ }
+
+ public ContainerStartDataProto getProto() {
+ mergeLocalToProto();
+ proto = viaProto ? proto : builder.build();
+ viaProto = true;
+ return proto;
+ }
+
+ @Override
+ public int hashCode() {
+ return getProto().hashCode();
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (other == null)
+ return false;
+ if (other.getClass().isAssignableFrom(this.getClass())) {
+ return this.getProto().equals(this.getClass().cast(other).getProto());
+ }
+ return false;
+ }
+
+ @Override
+ public String toString() {
+ return TextFormat.shortDebugString(getProto());
+ }
+
+ private void mergeLocalToBuilder() {
+ if (this.containerId != null && !((ContainerIdPBImpl)
+ this.containerId).getProto().equals(builder.getContainerId())) {
+ builder.setContainerId(convertToProtoFormat(this.containerId));
+ }
+ if (this.resource != null && !((ResourcePBImpl)
+ this.resource).getProto().equals(builder.getAllocatedResource())) {
+ builder.setAllocatedResource(convertToProtoFormat(this.resource));
+ }
+ if (this.nodeId != null && !((NodeIdPBImpl)
+ this.nodeId).getProto().equals(builder.getAssignedNodeId())) {
+ builder.setAssignedNodeId(convertToProtoFormat(this.nodeId));
+ }
+ if (this.priority != null && !((PriorityPBImpl)
+ this.priority).getProto().equals(builder.getPriority())) {
+ builder.setPriority(convertToProtoFormat(this.priority));
+ }
+ }
+
+ private void mergeLocalToProto() {
+ if (viaProto) {
+ maybeInitBuilder();
+ }
+ mergeLocalToBuilder();
+ proto = builder.build();
+ viaProto = true;
+ }
+
+ private void maybeInitBuilder() {
+ if (viaProto || builder == null) {
+ builder = ContainerStartDataProto.newBuilder(proto);
+ }
+ viaProto = false;
+ }
+
+ private ContainerIdProto convertToProtoFormat(
+ ContainerId containerId) {
+ return ((ContainerIdPBImpl) containerId).getProto();
+ }
+
+ private ContainerIdPBImpl convertFromProtoFormat(
+ ContainerIdProto containerId) {
+ return new ContainerIdPBImpl(containerId);
+ }
+
+ private ResourceProto convertToProtoFormat(Resource resource) {
+ return ((ResourcePBImpl) resource).getProto();
+ }
+
+ private ResourcePBImpl convertFromProtoFormat(ResourceProto resource) {
+ return new ResourcePBImpl(resource);
+ }
+
+ private NodeIdProto convertToProtoFormat(NodeId nodeId) {
+ return ((NodeIdPBImpl) nodeId).getProto();
+ }
+
+ private NodeIdPBImpl convertFromProtoFormat(NodeIdProto nodeId) {
+ return new NodeIdPBImpl(nodeId);
+ }
+
+ private PriorityProto convertToProtoFormat(Priority priority) {
+ return ((PriorityPBImpl) priority).getProto();
+ }
+
+ private PriorityPBImpl convertFromProtoFormat(PriorityProto priority) {
+ return new PriorityPBImpl(priority);
+ }
+
+}