+ * The interface used by client to set ApplicationTimeouts of an application.
+ * The UpdateApplicationTimeoutsRequest should have timeout value with
+ * absolute time with ISO8601 format yyyy-MM-dd'T'HH:mm:ss.SSSZ.
+ *
+ * Note: If application timeout value is less than or equal to current
+ * time then update application throws YarnException.
+ * @param request to set ApplicationTimeouts of an application
+ * @return an empty response that the update has completed successfully.
+ * @throws YarnException if update request has empty values or application is
+ * in completing states.
+ * @throws IOException on IO failures
+ */
+ @Public
+ @Unstable
+ @Idempotent
+ public UpdateApplicationTimeoutsResponse updateApplicationTimeouts(
+ UpdateApplicationTimeoutsRequest request)
+ throws YarnException, IOException;
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/UpdateApplicationTimeoutsRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/UpdateApplicationTimeoutsRequest.java
new file mode 100644
index 0000000000..0e81e7e34c
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/UpdateApplicationTimeoutsRequest.java
@@ -0,0 +1,81 @@
+/**
+ * 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.api.protocolrecords;
+
+import java.util.Map;
+
+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.ApplicationTimeoutType;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ *
+ * The request sent by the client to the ResourceManager to set or
+ * update the application timeout.
+ *
+ *
+ * The request includes the {@link ApplicationId} of the application and timeout
+ * to be set for an application
+ *
+ */
+@Public
+@Unstable
+public abstract class UpdateApplicationTimeoutsRequest {
+ public static UpdateApplicationTimeoutsRequest newInstance(
+ ApplicationId applicationId,
+ Map applicationTimeouts) {
+ UpdateApplicationTimeoutsRequest request =
+ Records.newRecord(UpdateApplicationTimeoutsRequest.class);
+ request.setApplicationId(applicationId);
+ request.setApplicationTimeouts(applicationTimeouts);
+ return request;
+ }
+
+ /**
+ * Get the ApplicationId of the application.
+ * @return ApplicationId of the application
+ */
+ public abstract ApplicationId getApplicationId();
+
+ /**
+ * Set the ApplicationId of the application.
+ * @param applicationId ApplicationId of the application
+ */
+ public abstract void setApplicationId(ApplicationId applicationId);
+
+ /**
+ * Get ApplicationTimeouts of the application. Timeout value is
+ * in ISO8601 standard with format yyyy-MM-dd'T'HH:mm:ss.SSSZ.
+ * @return all ApplicationTimeouts of the application.
+ */
+ public abstract Map getApplicationTimeouts();
+
+ /**
+ * Set the ApplicationTimeouts for the application. Timeout value
+ * is absolute. Timeout value should meet ISO8601 format. Support ISO8601
+ * format is yyyy-MM-dd'T'HH:mm:ss.SSSZ. All pre-existing Map entries
+ * are cleared before adding the new Map.
+ * @param applicationTimeouts ApplicationTimeoutss for the
+ * application
+ */
+ public abstract void setApplicationTimeouts(
+ Map applicationTimeouts);
+}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/UpdateApplicationTimeoutsResponse.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/UpdateApplicationTimeoutsResponse.java
new file mode 100644
index 0000000000..bd02bb85e8
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/UpdateApplicationTimeoutsResponse.java
@@ -0,0 +1,46 @@
+/**
+ * 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.api.protocolrecords;
+
+import java.util.Map;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.util.Records;
+
+/**
+ *
+ * The response sent by the ResourceManager to the client on update
+ * application timeout.
+ *
+ *
+ * A response without exception means that the update has completed
+ * successfully.
+ *
+ */
+@Public
+@Unstable
+public abstract class UpdateApplicationTimeoutsResponse {
+
+ public static UpdateApplicationTimeoutsResponse newInstance() {
+ UpdateApplicationTimeoutsResponse response =
+ Records.newRecord(UpdateApplicationTimeoutsResponse.class);
+ return response;
+ }
+}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java
index 83f601a5f5..e562aaae5c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java
@@ -549,6 +549,10 @@ public abstract void setLogAggregationContext(
/**
* Set the ApplicationTimeouts for the application in seconds.
* All pre-existing Map entries are cleared before adding the new Map.
+ *
+ * Note: If application timeout value is less than or equal to zero
+ * then application submission will throw an exception.
+ *
* @param applicationTimeouts ApplicationTimeoutss for the
* application
*/
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
index 1fd25a79d8..b95bd1a256 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
@@ -1540,10 +1540,10 @@ public static boolean isAclEnabled(Configuration conf) {
// Configurations for applicaiton life time monitor feature
- public static final String RM_APPLICATION_LIFETIME_MONITOR_INTERVAL_MS =
- RM_PREFIX + "application-timeouts.lifetime-monitor.interval-ms";
+ public static final String RM_APPLICATION_MONITOR_INTERVAL_MS =
+ RM_PREFIX + "application-timeouts.monitor.interval-ms";
- public static final long DEFAULT_RM_APPLICATION_LIFETIME_MONITOR_INTERVAL_MS =
+ public static final long DEFAULT_RM_APPLICATION_MONITOR_INTERVAL_MS =
60000;
/**
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/applicationclient_protocol.proto b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/applicationclient_protocol.proto
index f1c3839428..ba79db09a6 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/applicationclient_protocol.proto
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/applicationclient_protocol.proto
@@ -60,4 +60,5 @@ service ApplicationClientProtocolService {
rpc getClusterNodeLabels (GetClusterNodeLabelsRequestProto) returns (GetClusterNodeLabelsResponseProto);
rpc updateApplicationPriority (UpdateApplicationPriorityRequestProto) returns (UpdateApplicationPriorityResponseProto);
rpc signalToContainer(SignalContainerRequestProto) returns (SignalContainerResponseProto);
+ rpc updateApplicationTimeouts (UpdateApplicationTimeoutsRequestProto) returns (UpdateApplicationTimeoutsResponseProto);
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
index 9c746fde30..b59d02b4fb 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
@@ -377,6 +377,11 @@ message ApplicationTimeoutMapProto {
optional int64 timeout = 2;
}
+message ApplicationUpdateTimeoutMapProto {
+ optional ApplicationTimeoutTypeProto application_timeout_type = 1;
+ optional string expire_time = 2;
+}
+
message LogAggregationContextProto {
optional string include_pattern = 1 [default = ".*"];
optional string exclude_pattern = 2 [default = ""];
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto
index 6526bf97a3..d9230d4707 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto
@@ -267,6 +267,15 @@ message SignalContainerRequestProto {
message SignalContainerResponseProto {
}
+message UpdateApplicationTimeoutsRequestProto {
+ required ApplicationIdProto applicationId = 1;
+ repeated ApplicationUpdateTimeoutMapProto application_timeouts = 2;
+}
+
+message UpdateApplicationTimeoutsResponseProto {
+ repeated ApplicationUpdateTimeoutMapProto application_timeouts = 1;
+}
+
//////////////////////////////////////////////////////
/////// client_NM_Protocol ///////////////////////////
//////////////////////////////////////////////////////
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ApplicationClientProtocolPBClientImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ApplicationClientProtocolPBClientImpl.java
index 2d755a2f78..ad7cb29608 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ApplicationClientProtocolPBClientImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/client/ApplicationClientProtocolPBClientImpl.java
@@ -83,6 +83,8 @@
import org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateResponse;
import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationPriorityRequest;
import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationPriorityResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsResponse;
import org.apache.hadoop.yarn.api.protocolrecords.SignalContainerRequest;
import org.apache.hadoop.yarn.api.protocolrecords.SignalContainerResponse;
import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest;
@@ -139,6 +141,8 @@
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.ReservationUpdateResponsePBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UpdateApplicationPriorityRequestPBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UpdateApplicationPriorityResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UpdateApplicationTimeoutsRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UpdateApplicationTimeoutsResponsePBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SignalContainerRequestPBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SignalContainerResponsePBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SubmitApplicationRequestPBImpl;
@@ -165,7 +169,7 @@
import org.apache.hadoop.yarn.proto.YarnServiceProtos.ReservationSubmissionRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.ReservationUpdateRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.UpdateApplicationPriorityRequestProto;
-import org.apache.hadoop.yarn.proto.YarnServiceProtos.UpdateApplicationPriorityResponseProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.UpdateApplicationTimeoutsRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.SubmitApplicationRequestProto;
import com.google.protobuf.ServiceException;
@@ -600,4 +604,19 @@ public SignalContainerResponse signalToContainer(
return null;
}
}
+
+ @Override
+ public UpdateApplicationTimeoutsResponse updateApplicationTimeouts(
+ UpdateApplicationTimeoutsRequest request)
+ throws YarnException, IOException {
+ UpdateApplicationTimeoutsRequestProto requestProto =
+ ((UpdateApplicationTimeoutsRequestPBImpl) request).getProto();
+ try {
+ return new UpdateApplicationTimeoutsResponsePBImpl(
+ proxy.updateApplicationTimeouts(null, requestProto));
+ } catch (ServiceException e) {
+ RPCUtil.unwrapAndThrowException(e);
+ return null;
+ }
+ }
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ApplicationClientProtocolPBServiceImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ApplicationClientProtocolPBServiceImpl.java
index 300ef57cf6..93ce6a343c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ApplicationClientProtocolPBServiceImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/impl/pb/service/ApplicationClientProtocolPBServiceImpl.java
@@ -55,6 +55,7 @@
import org.apache.hadoop.yarn.api.protocolrecords.ReservationSubmissionResponse;
import org.apache.hadoop.yarn.api.protocolrecords.ReservationUpdateResponse;
import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationPriorityResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsResponse;
import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse;
import org.apache.hadoop.yarn.api.protocolrecords.SignalContainerResponse;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.CancelDelegationTokenRequestPBImpl;
@@ -111,6 +112,8 @@
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SignalContainerResponsePBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UpdateApplicationPriorityRequestPBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UpdateApplicationPriorityResponsePBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UpdateApplicationTimeoutsRequestPBImpl;
+import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.UpdateApplicationTimeoutsResponsePBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SubmitApplicationRequestPBImpl;
import org.apache.hadoop.yarn.api.protocolrecords.impl.pb.SubmitApplicationResponsePBImpl;
import org.apache.hadoop.yarn.exceptions.YarnException;
@@ -162,6 +165,8 @@
import org.apache.hadoop.yarn.proto.YarnServiceProtos.SignalContainerResponseProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.UpdateApplicationPriorityRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.UpdateApplicationPriorityResponseProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.UpdateApplicationTimeoutsRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.UpdateApplicationTimeoutsResponseProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.SubmitApplicationRequestProto;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.SubmitApplicationResponseProto;
@@ -609,4 +614,21 @@ public SignalContainerResponseProto signalToContainer(
throw new ServiceException(e);
}
}
+
+ @Override
+ public UpdateApplicationTimeoutsResponseProto updateApplicationTimeouts(
+ RpcController controller, UpdateApplicationTimeoutsRequestProto proto)
+ throws ServiceException {
+ UpdateApplicationTimeoutsRequestPBImpl request =
+ new UpdateApplicationTimeoutsRequestPBImpl(proto);
+ try {
+ UpdateApplicationTimeoutsResponse response =
+ real.updateApplicationTimeouts(request);
+ return ((UpdateApplicationTimeoutsResponsePBImpl) response).getProto();
+ } catch (YarnException e) {
+ throw new ServiceException(e);
+ } catch (IOException e) {
+ throw new ServiceException(e);
+ }
+ }
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/UpdateApplicationTimeoutsRequestPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/UpdateApplicationTimeoutsRequestPBImpl.java
new file mode 100644
index 0000000000..1f86c5524b
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/UpdateApplicationTimeoutsRequestPBImpl.java
@@ -0,0 +1,220 @@
+/**
+ * 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.api.protocolrecords.impl.pb;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsRequest;
+import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.api.records.ApplicationTimeoutType;
+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.YarnProtos.ApplicationIdProto;
+import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationUpdateTimeoutMapProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.UpdateApplicationTimeoutsRequestProto;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.UpdateApplicationTimeoutsRequestProtoOrBuilder;
+
+import com.google.protobuf.TextFormat;
+
+@Private
+@Unstable
+public class UpdateApplicationTimeoutsRequestPBImpl
+ extends UpdateApplicationTimeoutsRequest {
+
+ UpdateApplicationTimeoutsRequestProto proto =
+ UpdateApplicationTimeoutsRequestProto.getDefaultInstance();
+ UpdateApplicationTimeoutsRequestProto.Builder builder = null;
+ boolean viaProto = false;
+
+ private ApplicationId applicationId = null;
+ private Map applicationTimeouts = null;
+
+ public UpdateApplicationTimeoutsRequestPBImpl() {
+ builder = UpdateApplicationTimeoutsRequestProto.newBuilder();
+ }
+
+ public UpdateApplicationTimeoutsRequestPBImpl(
+ UpdateApplicationTimeoutsRequestProto proto) {
+ this.proto = proto;
+ viaProto = true;
+ }
+
+ public UpdateApplicationTimeoutsRequestProto getProto() {
+ mergeLocalToProto();
+ proto = viaProto ? proto : builder.build();
+ viaProto = true;
+ return proto;
+ }
+
+ private void mergeLocalToProto() {
+ if (viaProto)
+ maybeInitBuilder();
+ mergeLocalToBuilder();
+ proto = builder.build();
+ viaProto = true;
+ }
+
+ private void maybeInitBuilder() {
+ if (viaProto || builder == null) {
+ builder = UpdateApplicationTimeoutsRequestProto.newBuilder(proto);
+ }
+ viaProto = false;
+ }
+
+ private void mergeLocalToBuilder() {
+ if (this.applicationId != null) {
+ builder.setApplicationId(convertToProtoFormat(this.applicationId));
+ }
+ if (this.applicationTimeouts != null) {
+ addApplicationTimeouts();
+ }
+ }
+
+ @Override
+ public ApplicationId getApplicationId() {
+ UpdateApplicationTimeoutsRequestProtoOrBuilder p =
+ viaProto ? proto : builder;
+ if (this.applicationId != null) {
+ return applicationId;
+ } // Else via proto
+ if (!p.hasApplicationId()) {
+ return null;
+ }
+ applicationId = convertFromProtoFormat(p.getApplicationId());
+ return applicationId;
+ }
+
+ @Override
+ public void setApplicationId(ApplicationId applicationId) {
+ maybeInitBuilder();
+ if (applicationId == null) {
+ builder.clearApplicationId();
+ }
+ this.applicationId = applicationId;
+ }
+
+ private ApplicationIdPBImpl convertFromProtoFormat(ApplicationIdProto p) {
+ return new ApplicationIdPBImpl(p);
+ }
+
+ private ApplicationIdProto convertToProtoFormat(ApplicationId t) {
+ return ((ApplicationIdPBImpl) t).getProto();
+ }
+
+ @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());
+ }
+
+ @Override
+ public Map getApplicationTimeouts() {
+ initApplicationTimeout();
+ return this.applicationTimeouts;
+ }
+
+ private void initApplicationTimeout() {
+ if (this.applicationTimeouts != null) {
+ return;
+ }
+ UpdateApplicationTimeoutsRequestProtoOrBuilder p =
+ viaProto ? proto : builder;
+ List lists =
+ p.getApplicationTimeoutsList();
+ this.applicationTimeouts =
+ new HashMap(lists.size());
+ for (ApplicationUpdateTimeoutMapProto timeoutProto : lists) {
+ this.applicationTimeouts.put(
+ ProtoUtils
+ .convertFromProtoFormat(timeoutProto.getApplicationTimeoutType()),
+ timeoutProto.getExpireTime());
+ }
+ }
+
+ @Override
+ public void setApplicationTimeouts(
+ Map appTimeouts) {
+ if (appTimeouts == null) {
+ return;
+ }
+ initApplicationTimeout();
+ this.applicationTimeouts.clear();
+ this.applicationTimeouts.putAll(appTimeouts);
+ }
+
+ private void addApplicationTimeouts() {
+ maybeInitBuilder();
+ builder.clearApplicationTimeouts();
+ if (applicationTimeouts == null) {
+ return;
+ }
+ Iterable extends ApplicationUpdateTimeoutMapProto> values =
+ new Iterable() {
+
+ @Override
+ public Iterator iterator() {
+ return new Iterator() {
+ private Iterator iterator =
+ applicationTimeouts.keySet().iterator();
+
+ @Override
+ public boolean hasNext() {
+ return iterator.hasNext();
+ }
+
+ @Override
+ public ApplicationUpdateTimeoutMapProto next() {
+ ApplicationTimeoutType key = iterator.next();
+ return ApplicationUpdateTimeoutMapProto.newBuilder()
+ .setExpireTime(applicationTimeouts.get(key))
+ .setApplicationTimeoutType(
+ ProtoUtils.convertToProtoFormat(key))
+ .build();
+ }
+
+ @Override
+ public void remove() {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+ };
+ this.builder.addAllApplicationTimeouts(values);
+ }
+}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/UpdateApplicationTimeoutsResponsePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/UpdateApplicationTimeoutsResponsePBImpl.java
new file mode 100644
index 0000000000..74f17155f4
--- /dev/null
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/UpdateApplicationTimeoutsResponsePBImpl.java
@@ -0,0 +1,73 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.yarn.api.protocolrecords.impl.pb;
+
+import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceStability.Unstable;
+import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsResponse;
+import org.apache.hadoop.yarn.proto.YarnServiceProtos.UpdateApplicationTimeoutsResponseProto;
+
+import com.google.protobuf.TextFormat;
+
+@Private
+@Unstable
+public class UpdateApplicationTimeoutsResponsePBImpl
+ extends UpdateApplicationTimeoutsResponse {
+ UpdateApplicationTimeoutsResponseProto proto =
+ UpdateApplicationTimeoutsResponseProto.getDefaultInstance();
+ UpdateApplicationTimeoutsResponseProto.Builder builder = null;
+ boolean viaProto = false;
+
+ public UpdateApplicationTimeoutsResponsePBImpl() {
+ builder = UpdateApplicationTimeoutsResponseProto.newBuilder();
+ }
+
+ public UpdateApplicationTimeoutsResponsePBImpl(
+ UpdateApplicationTimeoutsResponseProto proto) {
+ this.proto = proto;
+ viaProto = true;
+ }
+
+ public UpdateApplicationTimeoutsResponseProto getProto() {
+ 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());
+ }
+}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/AbstractLivelinessMonitor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/AbstractLivelinessMonitor.java
index b605026151..638128e4bf 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/AbstractLivelinessMonitor.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/AbstractLivelinessMonitor.java
@@ -46,6 +46,7 @@ public abstract class AbstractLivelinessMonitor extends AbstractService {
public static final int DEFAULT_EXPIRE = 5*60*1000;//5 mins
private long expireInterval = DEFAULT_EXPIRE;
private long monitorInterval = expireInterval / 3;
+ private volatile boolean resetTimerOnStart = true;
private final Clock clock;
@@ -105,8 +106,8 @@ public synchronized void register(O ob) {
register(ob, clock.getTime());
}
- public synchronized void register(O ob, long monitorStartTime) {
- running.put(ob, monitorStartTime);
+ public synchronized void register(O ob, long expireTime) {
+ running.put(ob, expireTime);
}
public synchronized void unregister(O ob) {
@@ -114,12 +115,18 @@ public synchronized void unregister(O ob) {
}
public synchronized void resetTimer() {
- long time = clock.getTime();
- for (O ob : running.keySet()) {
- running.put(ob, time);
+ if (resetTimerOnStart) {
+ long time = clock.getTime();
+ for (O ob : running.keySet()) {
+ running.put(ob, time);
+ }
}
}
+ protected void setResetTimeOnStart(boolean resetTimeOnStart) {
+ this.resetTimerOnStart = resetTimeOnStart;
+ }
+
private class PingChecker implements Runnable {
@Override
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/Times.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/Times.java
index 8ae3842283..f113bd31c4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/Times.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/Times.java
@@ -18,6 +18,7 @@
package org.apache.hadoop.yarn.util;
+import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -29,6 +30,8 @@
public class Times {
private static final Log LOG = LogFactory.getLog(Times.class);
+ static final String ISO8601DATEFORMAT = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
+
// This format should match the one used in yarn.dt.plugins.js
static final ThreadLocal dateFormat =
new ThreadLocal() {
@@ -37,6 +40,14 @@ public class Times {
}
};
+ static final ThreadLocal isoFormat =
+ new ThreadLocal() {
+ @Override
+ protected SimpleDateFormat initialValue() {
+ return new SimpleDateFormat(ISO8601DATEFORMAT);
+ }
+ };
+
public static long elapsed(long started, long finished) {
return Times.elapsed(started, finished, true);
}
@@ -74,4 +85,26 @@ public static String format(long ts) {
return ts > 0 ? String.valueOf(dateFormat.get().format(new Date(ts)))
: "N/A";
}
+
+ /**
+ * Given a time stamp returns ISO-8601 formated string in format
+ * "yyyy-MM-dd'T'HH:mm:ss.SSSZ".
+ * @param ts to be formatted in ISO format.
+ * @return ISO 8601 formatted string.
+ */
+ public static String formatISO8601(long ts) {
+ return isoFormat.get().format(new Date(ts));
+ }
+
+ /**
+ * Given ISO formatted string with format "yyyy-MM-dd'T'HH:mm:ss.SSSZ", return
+ * epoch time for local Time zone.
+ * @param isoString in format of "yyyy-MM-dd'T'HH:mm:ss.SSSZ".
+ * @return epoch time for local time zone.
+ * @throws ParseException if given ISO formatted string can not be parsed.
+ */
+ public static long parseISO8601ToLocalTimeInMillis(String isoString)
+ throws ParseException {
+ return isoFormat.get().parse(isoString).getTime();
+ }
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
index 834ead74e9..019166b0b4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/resources/yarn-default.xml
@@ -3048,9 +3048,9 @@
- The RMAppLifetimeMonitor Service uses this value as lifetime monitor interval
+ The RMAppLifetimeMonitor Service uses this value as monitor interval
- yarn.resourcemanager.application-timeouts.lifetime-monitor.interval-ms
+ yarn.resourcemanager.application-timeouts.monitor.interval-ms60000
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/MockResourceManagerFacade.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/MockResourceManagerFacade.java
index f02e306960..c69313f66a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/MockResourceManagerFacade.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/amrmproxy/MockResourceManagerFacade.java
@@ -91,6 +91,8 @@
import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse;
import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationPriorityRequest;
import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationPriorityResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsResponse;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
import org.apache.hadoop.yarn.api.records.AMCommand;
@@ -497,4 +499,11 @@ public FailApplicationAttemptResponse failApplicationAttempt(
FailApplicationAttemptRequest request) throws YarnException, IOException {
throw new NotImplementedException();
}
+
+ @Override
+ public UpdateApplicationTimeoutsResponse updateApplicationTimeouts(
+ UpdateApplicationTimeoutsRequest request)
+ throws YarnException, IOException {
+ throw new NotImplementedException();
+ }
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java
index e9bd230696..c8af526029 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java
@@ -108,12 +108,15 @@
import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationResponse;
import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationPriorityRequest;
import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationPriorityResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsResponse;
import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
+import org.apache.hadoop.yarn.api.records.ApplicationTimeoutType;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ContainerReport;
import org.apache.hadoop.yarn.api.records.NodeReport;
@@ -1589,37 +1592,11 @@ public UpdateApplicationPriorityResponse updateApplicationPriority(
ApplicationId applicationId = request.getApplicationId();
Priority newAppPriority = request.getApplicationPriority();
- UserGroupInformation callerUGI;
- try {
- callerUGI = UserGroupInformation.getCurrentUser();
- } catch (IOException ie) {
- LOG.info("Error getting UGI ", ie);
- RMAuditLogger.logFailure("UNKNOWN", AuditConstants.UPDATE_APP_PRIORITY,
- "UNKNOWN", "ClientRMService", "Error getting UGI", applicationId);
- throw RPCUtil.getRemoteException(ie);
- }
- RMApp application = this.rmContext.getRMApps().get(applicationId);
- if (application == null) {
- RMAuditLogger.logFailure(callerUGI.getUserName(),
- AuditConstants.UPDATE_APP_PRIORITY, "UNKNOWN", "ClientRMService",
- "Trying to update priority of an absent application", applicationId);
- throw new ApplicationNotFoundException(
- "Trying to update priority of an absent application "
- + applicationId);
- }
-
- if (!checkAccess(callerUGI, application.getUser(),
- ApplicationAccessType.MODIFY_APP, application)) {
- RMAuditLogger.logFailure(callerUGI.getShortUserName(),
- AuditConstants.UPDATE_APP_PRIORITY,
- "User doesn't have permissions to "
- + ApplicationAccessType.MODIFY_APP.toString(), "ClientRMService",
- AuditConstants.UNAUTHORIZED_USER, applicationId);
- throw RPCUtil.getRemoteException(new AccessControlException("User "
- + callerUGI.getShortUserName() + " cannot perform operation "
- + ApplicationAccessType.MODIFY_APP.name() + " on " + applicationId));
- }
+ UserGroupInformation callerUGI =
+ getCallerUgi(applicationId, AuditConstants.UPDATE_APP_PRIORITY);
+ RMApp application = verifyUserAccessForRMApp(applicationId, callerUGI,
+ AuditConstants.UPDATE_APP_PRIORITY);
UpdateApplicationPriorityResponse response = recordFactory
.newRecordInstance(UpdateApplicationPriorityResponse.class);
@@ -1724,4 +1701,104 @@ public SignalContainerResponse signalToContainer(
.newRecordInstance(SignalContainerResponse.class);
}
+ @Override
+ public UpdateApplicationTimeoutsResponse updateApplicationTimeouts(
+ UpdateApplicationTimeoutsRequest request)
+ throws YarnException, IOException {
+
+ ApplicationId applicationId = request.getApplicationId();
+ Map applicationTimeouts =
+ request.getApplicationTimeouts();
+
+ UserGroupInformation callerUGI =
+ getCallerUgi(applicationId, AuditConstants.UPDATE_APP_TIMEOUTS);
+ RMApp application = verifyUserAccessForRMApp(applicationId, callerUGI,
+ AuditConstants.UPDATE_APP_TIMEOUTS);
+
+ if (applicationTimeouts.isEmpty()) {
+ String message =
+ "At least one ApplicationTimeoutType should be configured"
+ + " for updating timeouts.";
+ RMAuditLogger.logFailure(callerUGI.getShortUserName(),
+ AuditConstants.UPDATE_APP_TIMEOUTS, "UNKNOWN", "ClientRMService",
+ message, applicationId);
+ throw RPCUtil.getRemoteException(message);
+ }
+
+ UpdateApplicationTimeoutsResponse response = recordFactory
+ .newRecordInstance(UpdateApplicationTimeoutsResponse.class);
+
+ RMAppState state = application.getState();
+ if (!EnumSet
+ .of(RMAppState.SUBMITTED, RMAppState.ACCEPTED, RMAppState.RUNNING)
+ .contains(state)) {
+ if (COMPLETED_APP_STATES.contains(state)) {
+ // If Application is in any of the final states, update timeout
+ // can be skipped rather throwing exception.
+ RMAuditLogger.logSuccess(callerUGI.getShortUserName(),
+ AuditConstants.UPDATE_APP_TIMEOUTS, "ClientRMService",
+ applicationId);
+ return response;
+ }
+ String msg =
+ "Application is in " + state + " state can not update timeout.";
+ RMAuditLogger.logFailure(callerUGI.getShortUserName(),
+ AuditConstants.UPDATE_APP_TIMEOUTS, "UNKNOWN", "ClientRMService",
+ msg);
+ throw RPCUtil.getRemoteException(msg);
+ }
+
+ try {
+ rmAppManager.updateApplicationTimeout(application, applicationTimeouts);
+ } catch (YarnException ex) {
+ RMAuditLogger.logFailure(callerUGI.getShortUserName(),
+ AuditConstants.UPDATE_APP_TIMEOUTS, "UNKNOWN", "ClientRMService",
+ ex.getMessage());
+ throw RPCUtil.getRemoteException(ex);
+ }
+
+ RMAuditLogger.logSuccess(callerUGI.getShortUserName(),
+ AuditConstants.UPDATE_APP_TIMEOUTS, "ClientRMService", applicationId);
+ return response;
+ }
+
+ private UserGroupInformation getCallerUgi(ApplicationId applicationId,
+ String operation) throws YarnException {
+ UserGroupInformation callerUGI;
+ try {
+ callerUGI = UserGroupInformation.getCurrentUser();
+ } catch (IOException ie) {
+ LOG.info("Error getting UGI ", ie);
+ RMAuditLogger.logFailure("UNKNOWN", operation, "UNKNOWN",
+ "ClientRMService", "Error getting UGI", applicationId);
+ throw RPCUtil.getRemoteException(ie);
+ }
+ return callerUGI;
+ }
+
+ private RMApp verifyUserAccessForRMApp(ApplicationId applicationId,
+ UserGroupInformation callerUGI, String operation) throws YarnException {
+ RMApp application = this.rmContext.getRMApps().get(applicationId);
+ if (application == null) {
+ RMAuditLogger.logFailure(callerUGI.getUserName(), operation, "UNKNOWN",
+ "ClientRMService",
+ "Trying to " + operation + " of an absent application",
+ applicationId);
+ throw new ApplicationNotFoundException("Trying to " + operation
+ + " of an absent application " + applicationId);
+ }
+
+ if (!checkAccess(callerUGI, application.getUser(),
+ ApplicationAccessType.MODIFY_APP, application)) {
+ RMAuditLogger.logFailure(callerUGI.getShortUserName(), operation,
+ "User doesn't have permissions to "
+ + ApplicationAccessType.MODIFY_APP.toString(),
+ "ClientRMService", AuditConstants.UNAUTHORIZED_USER, applicationId);
+ throw RPCUtil.getRemoteException(new AccessControlException("User "
+ + callerUGI.getShortUserName() + " cannot perform operation "
+ + ApplicationAccessType.MODIFY_APP.name() + " on " + applicationId));
+ }
+ return application;
+ }
+
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java
index c065b60779..7144421a51 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/RMAppManager.java
@@ -34,6 +34,7 @@
import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
+import org.apache.hadoop.yarn.api.records.ApplicationTimeoutType;
import org.apache.hadoop.yarn.api.records.Priority;
import org.apache.hadoop.yarn.api.records.QueueACL;
import org.apache.hadoop.yarn.api.records.ResourceRequest;
@@ -66,6 +67,8 @@
import org.apache.hadoop.yarn.server.utils.BuilderUtils;
import com.google.common.annotations.VisibleForTesting;
+import com.google.common.util.concurrent.Futures;
+import com.google.common.util.concurrent.SettableFuture;
/**
* This class manages the list of applications for the resource manager.
@@ -509,4 +512,38 @@ public void handle(RMAppManagerEvent event) {
LOG.error("Invalid eventtype " + event.getType() + ". Ignoring!");
}
}
+
+ // transaction method.
+ public void updateApplicationTimeout(RMApp app,
+ Map newTimeoutInISO8601Format)
+ throws YarnException {
+ ApplicationId applicationId = app.getApplicationId();
+ synchronized (applicationId) {
+ Map newExpireTime = RMServerUtils
+ .validateISO8601AndConvertToLocalTimeEpoch(newTimeoutInISO8601Format);
+
+ SettableFuture