diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/SchedulerConfigurationMutationRequest.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/SchedulerConfigurationMutationRequest.java new file mode 100644 index 0000000..9a465ed --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/SchedulerConfigurationMutationRequest.java @@ -0,0 +1,65 @@ +/** + * 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 org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.api.ApplicationClientProtocol; +import org.apache.hadoop.yarn.api.records.SchedulerConfigurationMutation; +import org.apache.hadoop.yarn.util.Records; + + +/** + *

+ * The request sent by the client to the ResourceManager to add or + * remove or update scheduler configurations. + *

+ *

+ * The request includes the {@link SchedulerConfigurationMutation} + *

+ * + * @see ApplicationClientProtocol#mutateSchedulerConfiguration(SchedulerConfigurationMutationRequest) + */ + +@Public +@Unstable +public abstract class SchedulerConfigurationMutationRequest { + public static SchedulerConfigurationMutationRequest newInstance( + SchedulerConfigurationMutation schedulerConfigurationMutation) { + SchedulerConfigurationMutationRequest request = + Records.newRecord(SchedulerConfigurationMutationRequest.class); + request.setSchedulerConfigurationMutation(schedulerConfigurationMutation); + return request; + } + + /** + * Get the SchedulerConfigurationMutation. + * + * @return SchedulerConfigurationMutation + */ + public abstract SchedulerConfigurationMutation getSchedulerConfigurationMutation(); + + /** + * Set the SchedulerConfigurationMutation. + * + * @param schedulerConfigurationMutation SchedulerConfigurationMutation + */ + public abstract void setSchedulerConfigurationMutation( + SchedulerConfigurationMutation schedulerConfigurationMutation); +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/SchedulerConfigurationMutationResponse.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/SchedulerConfigurationMutationResponse.java new file mode 100644 index 0000000..625c7d3 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/SchedulerConfigurationMutationResponse.java @@ -0,0 +1,45 @@ +/** + * 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 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 add or + * remove or update scheduler configurations. + *

+ *

+ * A response without exception means that the configuration mutation has completed + * successfully. + *

+ */ +@Public +@Unstable +public abstract class SchedulerConfigurationMutationResponse { + + public static SchedulerConfigurationMutationResponse newInstance() { + SchedulerConfigurationMutationResponse response = + Records.newRecord(SchedulerConfigurationMutationResponse.class); + return response; + } +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueConfigurationMutation.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueConfigurationMutation.java new file mode 100644 index 0000000..d7f657c --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueConfigurationMutation.java @@ -0,0 +1,100 @@ +/** + * 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.records; + +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Stable; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.util.Records; + +import java.util.Map; + +/** + *

QueueConfigurationMutation encapsulates mutations for a + * single queue's configuration.

+ * + * @see SchedulerConfigurationMutation + */ +@Public +@Unstable +public abstract class QueueConfigurationMutation { + + @Private + @Unstable + public static QueueConfigurationMutation newInstance(String queueName, + SchedulerOperationType operationType, Map configuration) { + QueueConfigurationMutation mutation = Records.newRecord(QueueConfigurationMutation.class); + mutation.setQueueName(queueName); + mutation.setOperationType(operationType); + mutation.setConfigurationMutation(configuration); + return mutation; + } + + /** + * Get the queue name of this queue configuration change + * @return queue name + */ + @Private + @Unstable + public abstract String getQueueName(); + + /** + * Set the queue name of this queue configuration change + * @param queueName queue name to set + */ + @Private + @Unstable + public abstract void setQueueName(String queueName); + + /** + * Get the operation type of this queue configuration change + * @return SchedulerOperationType of this queue + * configuration change + */ + @Private + @Unstable + public abstract SchedulerOperationType getOperationType(); + + /** + * Set the SchedulerOperationType of this + * queue configuration change + * @param operationType operation type of this queue configuration change + */ + @Private + @Unstable + public abstract void setOperationType(SchedulerOperationType operationType); + + /** + * Get the params for this queue configuration change + * @return Map of key-value pairs for this configuration change + */ + @Private + @Unstable + public abstract Map getConfigurationMutation(); + + /** + * Set the params for this queue configuration change + * @param configuration map of key-values for this queue configuration change + */ + @Private + @Unstable + public abstract void setConfigurationMutation(Map configuration); + +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SchedulerConfigurationMutation.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SchedulerConfigurationMutation.java new file mode 100644 index 0000000..4df76c6 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SchedulerConfigurationMutation.java @@ -0,0 +1,63 @@ +/** + * 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.records; + +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.util.Records; + +import java.util.List; + +/** + *

SchedulerConfigurationMutation encapsulates mutations + * for scheduler configuration.

+ * @see ConfigurationMutationRequest + */ +@Public +@Unstable +public abstract class SchedulerConfigurationMutation { + + @Private + @Unstable + public static SchedulerConfigurationMutation newInstance( + List mutations) { + SchedulerConfigurationMutation mutation = + Records.newRecord(SchedulerConfigurationMutation.class); + mutation.setQueueMutations(mutations); + return mutation; + } + + /** + * Get the queue mutations of this scheduler configuration change. + * @return queue mutations + */ + @Private + @Unstable + public abstract List getQueueMutations(); + + /** + * Set list of queue mutations for this scheduler configuration change. + * @param mutations list of queue mutations + */ + @Private + @Unstable + public abstract void setQueueMutations(List mutations); + +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SchedulerOperationType.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SchedulerOperationType.java new file mode 100644 index 0000000..7fe74b2 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SchedulerOperationType.java @@ -0,0 +1,44 @@ +/** +* 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.records; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; + +/** + * Type of scheduler configuration update. + */ +@Public +@Evolving +public enum SchedulerOperationType { + /** + * Add queue and set its configurations. + */ + ADD, + + /** + * Remove queue. + */ + REMOVE, + + /** + * Update queue's configurations. + */ + UPDATE, +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto index 43a661f..e6ce7bd 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto @@ -475,6 +475,21 @@ enum SignalContainerCommandProto { FORCEFUL_SHUTDOWN = 3; } +enum SchedulerOperationTypeProto { + QUEUE_ADD = 1; + QUEUE_REMOVE = 2; + QUEUE_UPDATE = 3; +} + +message QueueConfigurationMutationProto { + optional string queueName = 1; + optional SchedulerOperationTypeProto operationType = 2 [default = QUEUE_UPDATE]; + repeated StringStringMapProto configuration = 3; +} + +message SchedulerConfigurationMutationProto { + repeated QueueConfigurationMutationProto queueMutation = 1; +} //////////////////////////////////////////////////////////////////////// ////// From reservation_protocol ///////////////////////////////////// diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto index d9230d4..6ce60cc 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto @@ -276,6 +276,14 @@ message UpdateApplicationTimeoutsResponseProto { repeated ApplicationUpdateTimeoutMapProto application_timeouts = 1; } +message SchedulerConfigurationMutationRequestProto { + optional SchedulerConfigurationMutationProto scheduler_mutation = 1; +} + +message SchedulerConfigurationMutationResponseProto { +} + + ////////////////////////////////////////////////////// /////// client_NM_Protocol /////////////////////////// //////////////////////////////////////////////////////