diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationPriorityPerQueue.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationPriorityPerQueue.java new file mode 100644 index 0000000..8a056d8 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationPriorityPerQueue.java @@ -0,0 +1,138 @@ +/** + * 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; + +/** + *

PriorityLabelsPerQueue holds different types of priority labels in a queue.

+ * + *

It includes information such as: + *

+ *

+ * + */ +@Public +@Stable +public abstract class ApplicationPriorityPerQueue implements + Comparable { + + @Private + @Unstable + public static ApplicationPriorityPerQueue newInstance( + Integer maxPriorityLabel, Integer defaultPriorityLabel) { + ApplicationPriorityPerQueue perQueuePriorityLabels = Records + .newRecord(ApplicationPriorityPerQueue.class); + perQueuePriorityLabels.setMaxApplicationPriority(maxPriorityLabel); + perQueuePriorityLabels.setDefaultApplicationPriority(defaultPriorityLabel); + return perQueuePriorityLabels; + } + + /** + * Get the max application priority of the queue. + * + * @return max application priority configured in the queue + */ + @Public + @Stable + public abstract Integer getMaxApplicationPriority(); + + @Private + @Unstable + public abstract void setMaxApplicationPriority(Integer maxApplicationPriority); + + /** + * Get the default application priority of the queue. + * + * @return default application priority configured in the queue + */ + @Public + @Stable + public abstract Integer getDefaultApplicationPriority(); + + @Private + @Unstable + public abstract void setDefaultApplicationPriority( + Integer defaultApplicationPriority); + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + + ApplicationPriorityPerQueue other = (ApplicationPriorityPerQueue) obj; + if (!this.getDefaultApplicationPriority().equals( + other.getDefaultApplicationPriority())) + return false; + + if (!this.getMaxApplicationPriority().equals( + other.getMaxApplicationPriority())) + return false; + + return true; + } + + @Override + public String toString() { + return "Max application priority: " + this.getMaxApplicationPriority() + + ", " + "Default application priority: " + + this.getDefaultApplicationPriority(); + } + + @Override + public int hashCode() { + final int prime = 92821; + int result = 17; + result = result + * prime + + Math + .min(getMaxApplicationPriority(), getDefaultApplicationPriority()); + result = result + * prime + + Math + .max(getMaxApplicationPriority(), getDefaultApplicationPriority()); + return result; + } + + @Override + public int compareTo(ApplicationPriorityPerQueue priorityLabelsPerQueue) { + if (priorityLabelsPerQueue == null) { + return -1; + } + int defltLabelCompare = priorityLabelsPerQueue + .getDefaultApplicationPriority() - this.getDefaultApplicationPriority(); + if (defltLabelCompare == 0) { + return priorityLabelsPerQueue.getMaxApplicationPriority() + - this.getMaxApplicationPriority(); + } else { + return defltLabelCompare; + } + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/AddToClusterLevelApplicationPriorityRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/AddToClusterLevelApplicationPriorityRequest.java new file mode 100644 index 0000000..be930a1 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/AddToClusterLevelApplicationPriorityRequest.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.server.api.protocolrecords; + +import java.util.Set; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.yarn.util.Records; + +@Public +@Evolving +public abstract class AddToClusterLevelApplicationPriorityRequest { + public static AddToClusterLevelApplicationPriorityRequest newInstance( + Set applicationPriorities) { + AddToClusterLevelApplicationPriorityRequest request = Records + .newRecord(AddToClusterLevelApplicationPriorityRequest.class); + request.setApplicationPriorities(applicationPriorities); + return request; + } + + @Public + @Evolving + public abstract void setApplicationPriorities( + Set applicationPriorities); + + @Public + @Evolving + public abstract Set getApplicationPriorities(); +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/AddToClusterLevelApplicationPriorityResponse.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/AddToClusterLevelApplicationPriorityResponse.java new file mode 100644 index 0000000..1903046 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/AddToClusterLevelApplicationPriorityResponse.java @@ -0,0 +1,31 @@ +/** + * 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.api.protocolrecords; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.yarn.util.Records; + +@Public +@Evolving +public abstract class AddToClusterLevelApplicationPriorityResponse { + public static AddToClusterLevelApplicationPriorityResponse newInstance() { + return Records.newRecord(AddToClusterLevelApplicationPriorityResponse.class); + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/GetApplicationPriorityForQueueRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/GetApplicationPriorityForQueueRequest.java new file mode 100644 index 0000000..abf5fa6 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/GetApplicationPriorityForQueueRequest.java @@ -0,0 +1,41 @@ +/** + * 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.api.protocolrecords; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.yarn.util.Records; + +public abstract class GetApplicationPriorityForQueueRequest { + public static GetApplicationPriorityForQueueRequest newInstance(String queueName, + String userName) { + GetApplicationPriorityForQueueRequest request = + Records.newRecord(GetApplicationPriorityForQueueRequest.class); + request.setQueueName(queueName); + return request; + } + + @Public + @Evolving + public abstract void setQueueName(String queueName); + + @Public + @Evolving + public abstract String getQueueName(); +} \ No newline at end of file diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/GetApplicationPriorityForQueueResponse.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/GetApplicationPriorityForQueueResponse.java new file mode 100644 index 0000000..d28c8579 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/GetApplicationPriorityForQueueResponse.java @@ -0,0 +1,43 @@ +/** + * 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.api.protocolrecords; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.yarn.api.records.ApplicationPriorityPerQueue; +import org.apache.hadoop.yarn.util.Records; + +public abstract class GetApplicationPriorityForQueueResponse { + public static GetApplicationPriorityForQueueResponse newInstance( + ApplicationPriorityPerQueue applicationPriorityPerQueue) { + GetApplicationPriorityForQueueResponse response = Records + .newRecord(GetApplicationPriorityForQueueResponse.class); + response.setApplicationPriorityPerQueue(applicationPriorityPerQueue); + return response; + } + + @Public + @Evolving + public abstract void setApplicationPriorityPerQueue( + ApplicationPriorityPerQueue applicationPriorityPerQueue); + + @Public + @Evolving + public abstract ApplicationPriorityPerQueue getApplicationPriorityPerQueue(); +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/GetClusterLevelApplicationPriorityRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/GetClusterLevelApplicationPriorityRequest.java new file mode 100644 index 0000000..0b257e2 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/GetClusterLevelApplicationPriorityRequest.java @@ -0,0 +1,29 @@ +/** + * 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.api.protocolrecords; + +import org.apache.hadoop.yarn.util.Records; + +public abstract class GetClusterLevelApplicationPriorityRequest { + public static GetClusterLevelApplicationPriorityRequest newInstance() { + GetClusterLevelApplicationPriorityRequest request = Records + .newRecord(GetClusterLevelApplicationPriorityRequest.class); + return request; + } +} \ No newline at end of file diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/GetClusterLevelApplicationPriorityResponse.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/GetClusterLevelApplicationPriorityResponse.java new file mode 100644 index 0000000..a268753 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/GetClusterLevelApplicationPriorityResponse.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.server.api.protocolrecords; + +import java.util.Set; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.yarn.util.Records; + +public abstract class GetClusterLevelApplicationPriorityResponse { + public static GetClusterLevelApplicationPriorityResponse newInstance( + Set applicationPriorities) { + GetClusterLevelApplicationPriorityResponse response = Records + .newRecord(GetClusterLevelApplicationPriorityResponse.class); + response.setApplicationPriorities(applicationPriorities); + return response; + } + + @Public + @Evolving + public abstract void setApplicationPriorities( + Set applicationPriorities); + + @Public + @Evolving + public abstract Set getApplicationPriorities(); +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/RemoveApplicationPriorityFromClusterRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/RemoveApplicationPriorityFromClusterRequest.java new file mode 100644 index 0000000..dded4bb --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/RemoveApplicationPriorityFromClusterRequest.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.server.api.protocolrecords; + +import java.util.Set; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.yarn.util.Records; + +@Public +@Evolving +public abstract class RemoveApplicationPriorityFromClusterRequest { + public static RemoveApplicationPriorityFromClusterRequest newInstance( + Set applicationPriorities) { + RemoveApplicationPriorityFromClusterRequest request = Records + .newRecord(RemoveApplicationPriorityFromClusterRequest.class); + request.setApplicationPriorities(applicationPriorities); + return request; + } + + @Public + @Evolving + public abstract void setApplicationPriorities( + Set applicationPriorities); + + @Public + @Evolving + public abstract Set getApplicationPriorities(); +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/RemoveApplicationPriorityFromClusterResponse.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/RemoveApplicationPriorityFromClusterResponse.java new file mode 100644 index 0000000..1472dad --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/RemoveApplicationPriorityFromClusterResponse.java @@ -0,0 +1,32 @@ +/** + * 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.api.protocolrecords; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.yarn.util.Records; + +@Public +@Evolving +public abstract class RemoveApplicationPriorityFromClusterResponse { + public static RemoveApplicationPriorityFromClusterResponse newInstance() { + return Records + .newRecord(RemoveApplicationPriorityFromClusterResponse.class); + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/ReplaceApplicationPriorityOnQueueRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/ReplaceApplicationPriorityOnQueueRequest.java new file mode 100644 index 0000000..f57907c --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/ReplaceApplicationPriorityOnQueueRequest.java @@ -0,0 +1,47 @@ +/** + * 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.api.protocolrecords; + +import java.util.Map; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.yarn.api.records.ApplicationPriorityPerQueue; +import org.apache.hadoop.yarn.util.Records; + +@Public +@Evolving +public abstract class ReplaceApplicationPriorityOnQueueRequest { + public static ReplaceApplicationPriorityOnQueueRequest newInstance( + Map map) { + ReplaceApplicationPriorityOnQueueRequest request = Records + .newRecord(ReplaceApplicationPriorityOnQueueRequest.class); + request.setQueueToApplicationPriority(map); + return request; + } + + @Public + @Evolving + public abstract void setQueueToApplicationPriority( + Map map); + + @Public + @Evolving + public abstract Map getQueueToApplicationPriority(); +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/ReplaceApplicationPriorityOnQueueResponse.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/ReplaceApplicationPriorityOnQueueResponse.java new file mode 100644 index 0000000..c529583 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/ReplaceApplicationPriorityOnQueueResponse.java @@ -0,0 +1,31 @@ +/** + * 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.api.protocolrecords; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.yarn.util.Records; + +@Public +@Evolving +public abstract class ReplaceApplicationPriorityOnQueueResponse { + public static ReplaceApplicationPriorityOnQueueResponse newInstance() { + return Records.newRecord(ReplaceApplicationPriorityOnQueueResponse.class); + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/SetApplicationPriorityForQueueRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/SetApplicationPriorityForQueueRequest.java new file mode 100644 index 0000000..6c89923 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/SetApplicationPriorityForQueueRequest.java @@ -0,0 +1,54 @@ +/** + * 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.api.protocolrecords; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.yarn.api.records.ApplicationPriorityPerQueue; +import org.apache.hadoop.yarn.util.Records; + +@Public +@Evolving +public abstract class SetApplicationPriorityForQueueRequest { + public static SetApplicationPriorityForQueueRequest newInstance( + String queueName, ApplicationPriorityPerQueue applicationPriorityPerQueue) { + SetApplicationPriorityForQueueRequest request = Records + .newRecord(SetApplicationPriorityForQueueRequest.class); + request.setQueueName(queueName); + request.setApplicationPriorityPerQueue(applicationPriorityPerQueue); + return request; + } + + @Public + @Evolving + public abstract void setQueueName(String queueName); + + @Public + @Evolving + public abstract String getQueueName(); + + @Public + @Evolving + public abstract void setApplicationPriorityPerQueue( + ApplicationPriorityPerQueue applicationPriorityPerQueue); + + @Public + @Evolving + public abstract ApplicationPriorityPerQueue getApplicationPriorityPerQueue(); +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/SetApplicationPriorityForQueueResponse.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/SetApplicationPriorityForQueueResponse.java new file mode 100644 index 0000000..74fdbe1 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/SetApplicationPriorityForQueueResponse.java @@ -0,0 +1,31 @@ +/** + * 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.api.protocolrecords; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.yarn.util.Records; + +@Public +@Evolving +public abstract class SetApplicationPriorityForQueueResponse { + public static SetApplicationPriorityForQueueResponse newInstance() { + return Records.newRecord(SetApplicationPriorityForQueueResponse.class); + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/SetQueueAclToApplicationPriorityRequest.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/SetQueueAclToApplicationPriorityRequest.java new file mode 100644 index 0000000..057c543 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/SetQueueAclToApplicationPriorityRequest.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.server.api.protocolrecords; + +import java.util.Set; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.yarn.util.Records; + +@Public +@Evolving +public abstract class SetQueueAclToApplicationPriorityRequest { + public static SetQueueAclToApplicationPriorityRequest newInstance( + String queueName, Integer applicationPriority, Set userList) { + SetQueueAclToApplicationPriorityRequest request = Records + .newRecord(SetQueueAclToApplicationPriorityRequest.class); + request.setQueueName(queueName); + request.setApplicationPriority(applicationPriority); + request.setQueuePriorityLabelACL(userList); + return request; + } + + @Public + @Evolving + public abstract void setQueueName(String queueName); + + @Public + @Evolving + public abstract String getQueueName(); + + @Public + @Evolving + public abstract void setApplicationPriority(Integer applicationPriority); + + @Public + @Evolving + public abstract Integer getApplicationPriority(); + + @Public + @Evolving + public abstract void setQueuePriorityLabelACL(Set userList); + + @Public + @Evolving + public abstract Set getQueuePriorityLabelACL(); +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/SetQueueAclToApplicationPriorityResponse.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/SetQueueAclToApplicationPriorityResponse.java new file mode 100644 index 0000000..729acf6 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/SetQueueAclToApplicationPriorityResponse.java @@ -0,0 +1,31 @@ +/** + * 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.api.protocolrecords; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; +import org.apache.hadoop.yarn.util.Records; + +@Public +@Evolving +public abstract class SetQueueAclToApplicationPriorityResponse { + public static SetQueueAclToApplicationPriorityResponse newInstance() { + return Records.newRecord(SetQueueAclToApplicationPriorityResponse.class); + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/server/yarn_server_resourcemanager_service_protos.proto b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/server/yarn_server_resourcemanager_service_protos.proto index 900e349..4bedbc0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/server/yarn_server_resourcemanager_service_protos.proto +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/server/yarn_server_resourcemanager_service_protos.proto @@ -97,6 +97,59 @@ message ReplaceLabelsOnNodeResponseProto { } +message AddToClusterLevelApplicationPriorityRequestProto { + repeated int32 applicationPriorities = 1; +} + +message AddToClusterLevelApplicationPriorityResponseProto { +} + +message SetApplicationPriorityForQueueRequestProto { + optional string queueName = 1; + optional ApplicationPriorityPerQueueProto applicatonPriorityPerQueue = 2; +} + +message SetApplicationPriorityForQueueResponseProto { +} + +message RemoveApplicationPriorityFromClusterRequestProto { + repeated int32 applicationPriorities = 1; +} + +message RemoveApplicationPriorityFromClusterResponseProto { +} + +message ReplaceApplicationPriorityOnQueueRequestProto { + repeated QueueToApplicationPriorityProto queueToApplicationPriorities = 1; +} + +message ReplaceApplicationPriorityOnQueueResponseProto { +} + +message GetApplicationPriorityForQueueRequestProto { + optional string queueName = 1; +} + +message GetApplicationPriorityForQueueResponseProto { + optional ApplicationPriorityPerQueueProto applicationPriorityPerQueue = 1; +} + +message GetClusterLevelApplicationPriorityRequestProto { +} + +message GetClusterLevelApplicationPriorityResponseProto { + repeated int32 applicationPriority = 1; +} + +message SetQueueAclToApplicationPriorityRequestProto { + optional string queueName = 1; + optional int32 applicationPriority = 2; + repeated string applicationPriorityACL = 3; +} + +message SetQueueAclToApplicationPriorityResponseProto { +} + ////////////////////////////////////////////////////////////////// ///////////// RM Failover related records //////////////////////// ////////////////////////////////////////////////////////////////// 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 c4e756d..eee1afe 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 @@ -238,6 +238,16 @@ message NodeIdToLabelsProto { repeated string nodeLabels = 2; } +message ApplicationPriorityPerQueueProto { + optional int32 maxApplicationPriority = 1; + optional int32 defaultApplicationPriority = 2; +} + +message QueueToApplicationPriorityProto { + optional string queueName = 1; + optional ApplicationPriorityPerQueueProto applicationPriorityPerQueue = 2; +} + //////////////////////////////////////////////////////////////////////// ////// From AM_RM_Protocol ///////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationPriorityPerQueuePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationPriorityPerQueuePBImpl.java new file mode 100644 index 0000000..8dc591c --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ApplicationPriorityPerQueuePBImpl.java @@ -0,0 +1,88 @@ +/** + * 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.impl.pb; + +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.yarn.api.records.ApplicationPriorityPerQueue; +import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationPriorityPerQueueProto; +import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationPriorityPerQueueProtoOrBuilder; + + +@Private +@Unstable +public class ApplicationPriorityPerQueuePBImpl + extends + ApplicationPriorityPerQueue { + ApplicationPriorityPerQueueProto proto = ApplicationPriorityPerQueueProto + .getDefaultInstance(); + ApplicationPriorityPerQueueProto.Builder builder = null; + boolean viaProto = false; + + public ApplicationPriorityPerQueuePBImpl() { + builder = ApplicationPriorityPerQueueProto.newBuilder(); + } + + public ApplicationPriorityPerQueuePBImpl(ApplicationPriorityPerQueueProto p) { + this.proto = p; + viaProto = true; + } + + public ApplicationPriorityPerQueueProto getProto() { + proto = viaProto ? proto : builder.build(); + viaProto = true; + return proto; + } + + private void maybeInitBuilder() { + if (viaProto || builder == null) { + builder = ApplicationPriorityPerQueueProto.newBuilder(proto); + } + viaProto = false; + } + + @Override + public int hashCode() { + return getProto().hashCode(); + } + + @Override + public Integer getMaxApplicationPriority() { + ApplicationPriorityPerQueueProtoOrBuilder p = viaProto ? proto : builder; + return (p.getMaxApplicationPriority()); + } + + @Override + public void setMaxApplicationPriority(Integer maxApplicationPriority) { + maybeInitBuilder(); + builder.setMaxApplicationPriority(maxApplicationPriority); + } + + @Override + public Integer getDefaultApplicationPriority() { + ApplicationPriorityPerQueueProtoOrBuilder p = viaProto ? proto : builder; + return (p.getDefaultApplicationPriority()); + } + + @Override + public void setDefaultApplicationPriority(Integer defaultApplicationPriority) { + maybeInitBuilder(); + builder.setDefaultApplicationPriority(defaultApplicationPriority); + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/AddToClusterLevelApplicationPriorityRequestPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/AddToClusterLevelApplicationPriorityRequestPBImpl.java new file mode 100644 index 0000000..d047e85 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/AddToClusterLevelApplicationPriorityRequestPBImpl.java @@ -0,0 +1,121 @@ +/** + * 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.api.protocolrecords.impl.pb; + +import java.util.HashSet; +import java.util.Set; + +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.AddToClusterLevelApplicationPriorityRequestProto; +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.AddToClusterLevelApplicationPriorityRequestProtoOrBuilder; +import org.apache.hadoop.yarn.server.api.protocolrecords.AddToClusterLevelApplicationPriorityRequest; + +public class AddToClusterLevelApplicationPriorityRequestPBImpl + extends + AddToClusterLevelApplicationPriorityRequest { + AddToClusterLevelApplicationPriorityRequestProto proto = AddToClusterLevelApplicationPriorityRequestProto + .getDefaultInstance(); + AddToClusterLevelApplicationPriorityRequestProto.Builder builder = null; + boolean viaProto = false; + + private Set applicationPriorities = null; + + public AddToClusterLevelApplicationPriorityRequestPBImpl() { + this.builder = AddToClusterLevelApplicationPriorityRequestProto + .newBuilder(); + } + + public AddToClusterLevelApplicationPriorityRequestPBImpl( + AddToClusterLevelApplicationPriorityRequestProto proto) { + this.proto = proto; + viaProto = true; + } + + private void maybeInitBuilder() { + if (viaProto || builder == null) { + builder = AddToClusterLevelApplicationPriorityRequestProto + .newBuilder(proto); + } + viaProto = false; + } + + private void mergeLocalToProto() { + if (viaProto) + maybeInitBuilder(); + mergeLocalToBuilder(); + proto = builder.build(); + viaProto = true; + } + + private void mergeLocalToBuilder() { + if (this.applicationPriorities != null + && !this.applicationPriorities.isEmpty()) { + builder.clearApplicationPriorities(); + builder.addAllApplicationPriorities(this.applicationPriorities); + } + } + + public AddToClusterLevelApplicationPriorityRequestProto getProto() { + mergeLocalToProto(); + proto = viaProto ? proto : builder.build(); + viaProto = true; + return proto; + } + + @Override + public void setApplicationPriorities(Set applicationPriorities) { + maybeInitBuilder(); + if (applicationPriorities == null || applicationPriorities.isEmpty()) { + builder.clearApplicationPriorities(); + } + this.applicationPriorities = applicationPriorities; + } + + private void initPriorityLabel() { + if (this.applicationPriorities != null) { + return; + } + AddToClusterLevelApplicationPriorityRequestProtoOrBuilder p = viaProto + ? proto + : builder; + this.applicationPriorities = new HashSet(); + this.applicationPriorities.addAll(p.getApplicationPrioritiesList()); + } + + @Override + public Set getApplicationPriorities() { + initPriorityLabel(); + return this.applicationPriorities; + } + + @Override + public int hashCode() { + assert false : "hashCode not designed"; + return 0; + } + + @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; + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/AddToClusterLevelApplicationPriorityResponsePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/AddToClusterLevelApplicationPriorityResponsePBImpl.java new file mode 100644 index 0000000..bcb1001 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/AddToClusterLevelApplicationPriorityResponsePBImpl.java @@ -0,0 +1,69 @@ +/** + * 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.api.protocolrecords.impl.pb; + +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.AddToClusterLevelApplicationPriorityResponseProto; +import org.apache.hadoop.yarn.server.api.protocolrecords.AddToClusterLevelApplicationPriorityResponse; + +import com.google.protobuf.TextFormat; + +public class AddToClusterLevelApplicationPriorityResponsePBImpl extends + AddToClusterLevelApplicationPriorityResponse { + + AddToClusterLevelApplicationPriorityResponseProto proto = AddToClusterLevelApplicationPriorityResponseProto + .getDefaultInstance(); + AddToClusterLevelApplicationPriorityResponseProto.Builder builder = null; + boolean viaProto = false; + + public AddToClusterLevelApplicationPriorityResponsePBImpl() { + builder = AddToClusterLevelApplicationPriorityResponseProto.newBuilder(); + } + + public AddToClusterLevelApplicationPriorityResponsePBImpl( + AddToClusterLevelApplicationPriorityResponseProto proto) { + this.proto = proto; + viaProto = true; + } + + public AddToClusterLevelApplicationPriorityResponseProto 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/server/api/protocolrecords/impl/pb/GetApplicationPriorityForQueueRequestPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/GetApplicationPriorityForQueueRequestPBImpl.java new file mode 100644 index 0000000..4b68ec4 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/GetApplicationPriorityForQueueRequestPBImpl.java @@ -0,0 +1,98 @@ +/** + * 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.api.protocolrecords.impl.pb; + +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.GetApplicationPriorityForQueueRequestProto; +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.GetApplicationPriorityForQueueRequestProtoOrBuilder; +import org.apache.hadoop.yarn.server.api.protocolrecords.GetApplicationPriorityForQueueRequest; + +import com.google.protobuf.TextFormat; + +public class GetApplicationPriorityForQueueRequestPBImpl extends + GetApplicationPriorityForQueueRequest { + + GetApplicationPriorityForQueueRequestProto proto = GetApplicationPriorityForQueueRequestProto + .getDefaultInstance(); + GetApplicationPriorityForQueueRequestProto.Builder builder = null; + boolean viaProto = false; + + public GetApplicationPriorityForQueueRequestPBImpl() { + builder = GetApplicationPriorityForQueueRequestProto.newBuilder(); + } + + public GetApplicationPriorityForQueueRequestPBImpl( + GetApplicationPriorityForQueueRequestProto proto) { + this.proto = proto; + viaProto = true; + } + + public GetApplicationPriorityForQueueRequestProto 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()); + } + + @Override + public void setQueueName(String queueName) { + maybeInitBuilder(); + if (queueName == null) { + builder.clearQueueName(); + return; + } + builder.setQueueName(queueName); + } + + @Override + public String getQueueName() { + GetApplicationPriorityForQueueRequestProtoOrBuilder p = viaProto + ? proto + : builder; + if (!p.hasQueueName()) { + return null; + } + return (p.getQueueName()); + } + + private void maybeInitBuilder() { + if (viaProto || builder == null) { + builder = GetApplicationPriorityForQueueRequestProto.newBuilder(proto); + } + viaProto = false; + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/GetApplicationPriorityForQueueResponsePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/GetApplicationPriorityForQueueResponsePBImpl.java new file mode 100644 index 0000000..0b4a0f6 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/GetApplicationPriorityForQueueResponsePBImpl.java @@ -0,0 +1,131 @@ +/** + * 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.api.protocolrecords.impl.pb; + +import org.apache.hadoop.yarn.api.records.ApplicationPriorityPerQueue; +import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationPriorityPerQueuePBImpl; +import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationPriorityPerQueueProto; +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.GetApplicationPriorityForQueueResponseProto; +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.GetApplicationPriorityForQueueResponseProtoOrBuilder; +import org.apache.hadoop.yarn.server.api.protocolrecords.GetApplicationPriorityForQueueResponse; + +public class GetApplicationPriorityForQueueResponsePBImpl extends + GetApplicationPriorityForQueueResponse { + GetApplicationPriorityForQueueResponseProto proto = GetApplicationPriorityForQueueResponseProto + .getDefaultInstance(); + GetApplicationPriorityForQueueResponseProto.Builder builder = null; + boolean viaProto = false; + + private ApplicationPriorityPerQueue applicationPriorityPerQueue = null; + + public GetApplicationPriorityForQueueResponsePBImpl() { + this.builder = GetApplicationPriorityForQueueResponseProto.newBuilder(); + } + + public GetApplicationPriorityForQueueResponsePBImpl( + GetApplicationPriorityForQueueResponseProto proto) { + this.proto = proto; + viaProto = true; + } + + private void maybeInitBuilder() { + if (viaProto || builder == null) { + builder = GetApplicationPriorityForQueueResponseProto.newBuilder(proto); + } + viaProto = false; + } + + private void mergeLocalToProto() { + if (viaProto) + maybeInitBuilder(); + mergeLocalToBuilder(); + proto = builder.build(); + viaProto = true; + } + + private void mergeLocalToBuilder() { + if (this.applicationPriorityPerQueue != null) { + builder.clearApplicationPriorityPerQueue(); + builder + .setApplicationPriorityPerQueue(convertToProtoFormat(this.applicationPriorityPerQueue)); + } + } + + public GetApplicationPriorityForQueueResponseProto getProto() { + mergeLocalToProto(); + proto = viaProto ? proto : builder.build(); + viaProto = true; + return proto; + } + + private ApplicationPriorityPerQueuePBImpl convertFromProtoFormat( + ApplicationPriorityPerQueueProto p) { + return new ApplicationPriorityPerQueuePBImpl(p); + } + + private ApplicationPriorityPerQueueProto convertToProtoFormat( + ApplicationPriorityPerQueue t) { + return ((ApplicationPriorityPerQueuePBImpl) t).getProto(); + } + + @Override + public int hashCode() { + assert false : "hashCode not designed"; + return 0; + } + + @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 void setApplicationPriorityPerQueue( + ApplicationPriorityPerQueue applicationPriorityPerQueue) { + maybeInitBuilder(); + if (applicationPriorityPerQueue == null) { + builder.clearApplicationPriorityPerQueue(); + return; + } + this.applicationPriorityPerQueue = applicationPriorityPerQueue; + } + + @Override + public ApplicationPriorityPerQueue getApplicationPriorityPerQueue() { + GetApplicationPriorityForQueueResponseProtoOrBuilder p = viaProto + ? proto + : builder; + if (this.applicationPriorityPerQueue != null) { + return this.applicationPriorityPerQueue; + } + + if (!p.hasApplicationPriorityPerQueue()) { + return null; + } + + this.applicationPriorityPerQueue = convertFromProtoFormat(p + .getApplicationPriorityPerQueue()); + return this.applicationPriorityPerQueue; + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/GetClusterLevelApplicationPriorityRequestPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/GetClusterLevelApplicationPriorityRequestPBImpl.java new file mode 100644 index 0000000..942de64 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/GetClusterLevelApplicationPriorityRequestPBImpl.java @@ -0,0 +1,71 @@ +/** + * 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.api.protocolrecords.impl.pb; + + +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.GetClusterLevelApplicationPriorityRequestProto; +import org.apache.hadoop.yarn.server.api.protocolrecords.GetClusterLevelApplicationPriorityRequest; + +import com.google.protobuf.TextFormat; + +public class GetClusterLevelApplicationPriorityRequestPBImpl + extends + GetClusterLevelApplicationPriorityRequest { + + GetClusterLevelApplicationPriorityRequestProto proto = GetClusterLevelApplicationPriorityRequestProto + .getDefaultInstance(); + GetClusterLevelApplicationPriorityRequestProto.Builder builder = null; + boolean viaProto = false; + + public GetClusterLevelApplicationPriorityRequestPBImpl() { + builder = GetClusterLevelApplicationPriorityRequestProto.newBuilder(); + } + + public GetClusterLevelApplicationPriorityRequestPBImpl( + GetClusterLevelApplicationPriorityRequestProto proto) { + this.proto = proto; + viaProto = true; + } + + public GetClusterLevelApplicationPriorityRequestProto 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/server/api/protocolrecords/impl/pb/GetClusterLevelApplicationPriorityResponsePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/GetClusterLevelApplicationPriorityResponsePBImpl.java new file mode 100644 index 0000000..7873e0f --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/GetClusterLevelApplicationPriorityResponsePBImpl.java @@ -0,0 +1,118 @@ +/** + * 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.api.protocolrecords.impl.pb; + +import java.util.HashSet; +import java.util.Set; + +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.GetClusterLevelApplicationPriorityResponseProto; +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.GetClusterLevelApplicationPriorityResponseProtoOrBuilder; +import org.apache.hadoop.yarn.server.api.protocolrecords.GetClusterLevelApplicationPriorityResponse; + +public class GetClusterLevelApplicationPriorityResponsePBImpl extends + GetClusterLevelApplicationPriorityResponse { + GetClusterLevelApplicationPriorityResponseProto proto = GetClusterLevelApplicationPriorityResponseProto + .getDefaultInstance(); + GetClusterLevelApplicationPriorityResponseProto.Builder builder = null; + boolean viaProto = false; + + private Set applicationPriorities = null; + + public GetClusterLevelApplicationPriorityResponsePBImpl() { + this.builder = GetClusterLevelApplicationPriorityResponseProto.newBuilder(); + } + + public GetClusterLevelApplicationPriorityResponsePBImpl( + GetClusterLevelApplicationPriorityResponseProto proto) { + this.proto = proto; + viaProto = true; + } + + private void maybeInitBuilder() { + if (viaProto || builder == null) { + builder = GetClusterLevelApplicationPriorityResponseProto + .newBuilder(proto); + } + viaProto = false; + } + + private void mergeLocalToProto() { + if (viaProto) + maybeInitBuilder(); + mergeLocalToBuilder(); + proto = builder.build(); + viaProto = true; + } + + private void mergeLocalToBuilder() { + if (this.applicationPriorities != null && !this.applicationPriorities.isEmpty()) { + builder.clearApplicationPriority(); + builder.addAllApplicationPriority(this.applicationPriorities); + } + } + + public GetClusterLevelApplicationPriorityResponseProto getProto() { + mergeLocalToProto(); + proto = viaProto ? proto : builder.build(); + viaProto = true; + return proto; + } + + @Override + public void setApplicationPriorities(Set applicationPriorities) { + maybeInitBuilder(); + if (applicationPriorities == null || applicationPriorities.isEmpty()) { + builder.clearApplicationPriority(); + } + this.applicationPriorities = applicationPriorities; + } + + private void initApplicationPriorityLabel() { + if (this.applicationPriorities != null) { + return; + } + GetClusterLevelApplicationPriorityResponseProtoOrBuilder p = viaProto + ? proto + : builder; + this.applicationPriorities = new HashSet(); + this.applicationPriorities.addAll(p.getApplicationPriorityList()); + } + + @Override + public Set getApplicationPriorities() { + initApplicationPriorityLabel(); + return this.applicationPriorities; + } + + @Override + public int hashCode() { + assert false : "hashCode not designed"; + return 0; + } + + @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; + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RemoveApplicationPriorityFromClusterRequestPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RemoveApplicationPriorityFromClusterRequestPBImpl.java new file mode 100644 index 0000000..b551686 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RemoveApplicationPriorityFromClusterRequestPBImpl.java @@ -0,0 +1,118 @@ +/** + * 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.api.protocolrecords.impl.pb; + +import java.util.HashSet; +import java.util.Set; + +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.RemoveApplicationPriorityFromClusterRequestProto; +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.RemoveApplicationPriorityFromClusterRequestProtoOrBuilder; +import org.apache.hadoop.yarn.server.api.protocolrecords.RemoveApplicationPriorityFromClusterRequest; + +public class RemoveApplicationPriorityFromClusterRequestPBImpl extends + RemoveApplicationPriorityFromClusterRequest { + private Set priorityLabels = null; + RemoveApplicationPriorityFromClusterRequestProto proto = RemoveApplicationPriorityFromClusterRequestProto + .getDefaultInstance(); + RemoveApplicationPriorityFromClusterRequestProto.Builder builder = null; + boolean viaProto = false; + + public RemoveApplicationPriorityFromClusterRequestPBImpl() { + this.builder = RemoveApplicationPriorityFromClusterRequestProto + .newBuilder(); + } + + public RemoveApplicationPriorityFromClusterRequestPBImpl( + RemoveApplicationPriorityFromClusterRequestProto proto) { + this.proto = proto; + viaProto = true; + } + + private void maybeInitBuilder() { + if (viaProto || builder == null) { + builder = RemoveApplicationPriorityFromClusterRequestProto + .newBuilder(proto); + } + viaProto = false; + } + + private void mergeLocalToBuilder() { + if (this.priorityLabels != null && !this.priorityLabels.isEmpty()) { + builder.clearApplicationPriorities(); + builder.addAllApplicationPriorities(this.priorityLabels); + } + } + + private void mergeLocalToProto() { + if (viaProto) + maybeInitBuilder(); + mergeLocalToBuilder(); + proto = builder.build(); + viaProto = true; + } + + public RemoveApplicationPriorityFromClusterRequestProto getProto() { + mergeLocalToProto(); + proto = viaProto ? proto : builder.build(); + viaProto = true; + return proto; + } + + private void initPriorityLabels() { + if (this.priorityLabels != null) { + return; + } + RemoveApplicationPriorityFromClusterRequestProtoOrBuilder p = viaProto + ? proto + : builder; + this.priorityLabels = new HashSet(); + this.priorityLabels.addAll(p.getApplicationPrioritiesList()); + } + + @Override + public void setApplicationPriorities(Set priorityLabels) { + maybeInitBuilder(); + if (priorityLabels == null || priorityLabels.isEmpty()) { + builder.clearApplicationPriorities(); + } + this.priorityLabels = priorityLabels; + } + + @Override + public Set getApplicationPriorities() { + initPriorityLabels(); + return this.priorityLabels; + } + + @Override + public int hashCode() { + assert false : "hashCode not designed"; + return 0; + } + + @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; + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RemoveApplicationPriorityFromClusterResponsePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RemoveApplicationPriorityFromClusterResponsePBImpl.java new file mode 100644 index 0000000..4089797 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/RemoveApplicationPriorityFromClusterResponsePBImpl.java @@ -0,0 +1,69 @@ +/** + * 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.api.protocolrecords.impl.pb; + +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.RemoveApplicationPriorityFromClusterResponseProto; +import org.apache.hadoop.yarn.server.api.protocolrecords.RemoveApplicationPriorityFromClusterResponse; + +import com.google.protobuf.TextFormat; + +public class RemoveApplicationPriorityFromClusterResponsePBImpl extends + RemoveApplicationPriorityFromClusterResponse { + + RemoveApplicationPriorityFromClusterResponseProto proto = RemoveApplicationPriorityFromClusterResponseProto + .getDefaultInstance(); + RemoveApplicationPriorityFromClusterResponseProto.Builder builder = null; + boolean viaProto = false; + + public RemoveApplicationPriorityFromClusterResponsePBImpl() { + builder = RemoveApplicationPriorityFromClusterResponseProto.newBuilder(); + } + + public RemoveApplicationPriorityFromClusterResponsePBImpl( + RemoveApplicationPriorityFromClusterResponseProto proto) { + this.proto = proto; + viaProto = true; + } + + public RemoveApplicationPriorityFromClusterResponseProto 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/server/api/protocolrecords/impl/pb/ReplaceApplicationPriorityOnQueueRequestPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/ReplaceApplicationPriorityOnQueueRequestPBImpl.java new file mode 100644 index 0000000..2d64416 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/ReplaceApplicationPriorityOnQueueRequestPBImpl.java @@ -0,0 +1,183 @@ +/** + * 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.api.protocolrecords.impl.pb; + +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.apache.hadoop.yarn.api.records.ApplicationPriorityPerQueue; +import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationPriorityPerQueuePBImpl; +import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationPriorityPerQueueProto; +import org.apache.hadoop.yarn.proto.YarnProtos.QueueToApplicationPriorityProto; +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.ReplaceApplicationPriorityOnQueueRequestProto; +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.ReplaceApplicationPriorityOnQueueRequestProtoOrBuilder; +import org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceApplicationPriorityOnQueueRequest; + + +public class ReplaceApplicationPriorityOnQueueRequestPBImpl extends + ReplaceApplicationPriorityOnQueueRequest { + ReplaceApplicationPriorityOnQueueRequestProto proto = ReplaceApplicationPriorityOnQueueRequestProto + .getDefaultInstance(); + ReplaceApplicationPriorityOnQueueRequestProto.Builder builder = null; + boolean viaProto = false; + + private Map queueNameToApplicationPriority; + + public ReplaceApplicationPriorityOnQueueRequestPBImpl() { + this.builder = ReplaceApplicationPriorityOnQueueRequestProto.newBuilder(); + } + + public ReplaceApplicationPriorityOnQueueRequestPBImpl( + ReplaceApplicationPriorityOnQueueRequestProto proto) { + this.proto = proto; + this.viaProto = true; + } + + private void initQueueToLabels() { + if (this.queueNameToApplicationPriority != null) { + return; + } + ReplaceApplicationPriorityOnQueueRequestProtoOrBuilder p = viaProto + ? proto + : builder; + List list = p + .getQueueToApplicationPrioritiesList(); + this.queueNameToApplicationPriority = new HashMap(); + + for (QueueToApplicationPriorityProto c : list) { + this.queueNameToApplicationPriority.put(c.getQueueName(), + ApplicationPriorityPerQueue.newInstance( + convertFromProtoFormat(c.getApplicationPriorityPerQueue()) + .getMaxApplicationPriority(), + convertFromProtoFormat(c.getApplicationPriorityPerQueue()) + .getDefaultApplicationPriority())); + } + } + + private void maybeInitBuilder() { + if (viaProto || builder == null) { + builder = ReplaceApplicationPriorityOnQueueRequestProto.newBuilder(proto); + } + viaProto = false; + } + + private void addQueueToLabelsToProto() { + maybeInitBuilder(); + builder.clearQueueToApplicationPriorities(); + if (queueNameToApplicationPriority == null) { + return; + } + + Iterable iterable = new Iterable() { + @Override + public Iterator iterator() { + return new Iterator() { + + Iterator> iter = queueNameToApplicationPriority + .entrySet().iterator(); + + @Override + public void remove() { + throw new UnsupportedOperationException(); + } + + @Override + public QueueToApplicationPriorityProto next() { + Entry now = iter.next(); + return QueueToApplicationPriorityProto + .newBuilder() + .setQueueName(now.getKey()) + .clearApplicationPriorityPerQueue() + .setApplicationPriorityPerQueue( + convertToProtoFormat(now.getValue())).build(); + } + + @Override + public boolean hasNext() { + return iter.hasNext(); + } + }; + } + }; + builder.addAllQueueToApplicationPriorities(iterable); + } + + private ApplicationPriorityPerQueuePBImpl convertFromProtoFormat( + ApplicationPriorityPerQueueProto p) { + return new ApplicationPriorityPerQueuePBImpl(p); + } + + private ApplicationPriorityPerQueueProto convertToProtoFormat( + ApplicationPriorityPerQueue t) { + return ((ApplicationPriorityPerQueuePBImpl) t).getProto(); + } + + private void mergeLocalToBuilder() { + if (this.queueNameToApplicationPriority != null) { + addQueueToLabelsToProto(); + } + } + + private void mergeLocalToProto() { + if (viaProto) + maybeInitBuilder(); + mergeLocalToBuilder(); + proto = builder.build(); + viaProto = true; + } + + public ReplaceApplicationPriorityOnQueueRequestProto getProto() { + mergeLocalToProto(); + proto = viaProto ? proto : builder.build(); + viaProto = true; + return proto; + } + + @Override + public Map getQueueToApplicationPriority() { + initQueueToLabels(); + return this.queueNameToApplicationPriority; + } + + @Override + public void setQueueToApplicationPriority(Map map) { + initQueueToLabels(); + queueNameToApplicationPriority.clear(); + queueNameToApplicationPriority.putAll(map); + } + + @Override + public int hashCode() { + assert false : "hashCode not designed"; + return 0; + } + + @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; + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/ReplaceApplicationPriorityOnQueueResponsePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/ReplaceApplicationPriorityOnQueueResponsePBImpl.java new file mode 100644 index 0000000..29e56ca --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/ReplaceApplicationPriorityOnQueueResponsePBImpl.java @@ -0,0 +1,69 @@ +/** + * 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.api.protocolrecords.impl.pb; + +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.ReplaceApplicationPriorityOnQueueResponseProto; +import org.apache.hadoop.yarn.server.api.protocolrecords.ReplaceApplicationPriorityOnQueueResponse; + +import com.google.protobuf.TextFormat; + +public class ReplaceApplicationPriorityOnQueueResponsePBImpl extends + ReplaceApplicationPriorityOnQueueResponse { + + ReplaceApplicationPriorityOnQueueResponseProto proto = ReplaceApplicationPriorityOnQueueResponseProto + .getDefaultInstance(); + ReplaceApplicationPriorityOnQueueResponseProto.Builder builder = null; + boolean viaProto = false; + + public ReplaceApplicationPriorityOnQueueResponsePBImpl() { + builder = ReplaceApplicationPriorityOnQueueResponseProto.newBuilder(); + } + + public ReplaceApplicationPriorityOnQueueResponsePBImpl( + ReplaceApplicationPriorityOnQueueResponseProto proto) { + this.proto = proto; + viaProto = true; + } + + public ReplaceApplicationPriorityOnQueueResponseProto 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/server/api/protocolrecords/impl/pb/SetApplicationPriorityForQueueRequestPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/SetApplicationPriorityForQueueRequestPBImpl.java new file mode 100644 index 0000000..3ec5e8b --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/SetApplicationPriorityForQueueRequestPBImpl.java @@ -0,0 +1,152 @@ +/** + * 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.api.protocolrecords.impl.pb; + +import org.apache.hadoop.yarn.api.records.ApplicationPriorityPerQueue; +import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationPriorityPerQueuePBImpl; +import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationPriorityPerQueueProto; +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.SetApplicationPriorityForQueueRequestProto; +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.SetApplicationPriorityForQueueRequestProtoOrBuilder; +import org.apache.hadoop.yarn.server.api.protocolrecords.SetApplicationPriorityForQueueRequest; + + +public class SetApplicationPriorityForQueueRequestPBImpl extends + SetApplicationPriorityForQueueRequest { + private ApplicationPriorityPerQueue applicationPriorityPerQueue = null; + SetApplicationPriorityForQueueRequestProto proto = SetApplicationPriorityForQueueRequestProto + .getDefaultInstance(); + SetApplicationPriorityForQueueRequestProto.Builder builder = null; + boolean viaProto = false; + + public SetApplicationPriorityForQueueRequestPBImpl() { + this.builder = SetApplicationPriorityForQueueRequestProto.newBuilder(); + } + + public SetApplicationPriorityForQueueRequestPBImpl( + SetApplicationPriorityForQueueRequestProto proto) { + this.proto = proto; + viaProto = true; + } + + private void maybeInitBuilder() { + if (viaProto || builder == null) { + builder = SetApplicationPriorityForQueueRequestProto.newBuilder(proto); + } + viaProto = false; + } + + private void mergeLocalToBuilder() { + if (this.applicationPriorityPerQueue != null) { + builder.clearApplicatonPriorityPerQueue(); + builder + .setApplicatonPriorityPerQueue(convertToProtoFormat(this.applicationPriorityPerQueue)); + } + } + + private void mergeLocalToProto() { + if (viaProto) + maybeInitBuilder(); + mergeLocalToBuilder(); + proto = builder.build(); + viaProto = true; + } + + public SetApplicationPriorityForQueueRequestProto getProto() { + mergeLocalToProto(); + proto = viaProto ? proto : builder.build(); + viaProto = true; + return proto; + } + + private ApplicationPriorityPerQueuePBImpl convertFromProtoFormat( + ApplicationPriorityPerQueueProto p) { + return new ApplicationPriorityPerQueuePBImpl(p); + } + + private ApplicationPriorityPerQueueProto convertToProtoFormat( + ApplicationPriorityPerQueue t) { + return ((ApplicationPriorityPerQueuePBImpl) 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 void setQueueName(String queueName) { + maybeInitBuilder(); + if (queueName == null) { + builder.clearQueueName(); + return; + } + builder.setQueueName(queueName); + } + + @Override + public String getQueueName() { + SetApplicationPriorityForQueueRequestProtoOrBuilder p = viaProto + ? proto + : builder; + if (!p.hasQueueName()) { + return null; + } + return (p.getQueueName()); + } + + @Override + public void setApplicationPriorityPerQueue( + ApplicationPriorityPerQueue applicationPriorityPerQueue) { + maybeInitBuilder(); + if (applicationPriorityPerQueue == null) { + builder.clearApplicatonPriorityPerQueue(); + return; + } + this.applicationPriorityPerQueue = applicationPriorityPerQueue; + } + + @Override + public ApplicationPriorityPerQueue getApplicationPriorityPerQueue() { + SetApplicationPriorityForQueueRequestProtoOrBuilder p = viaProto + ? proto + : builder; + + if (this.applicationPriorityPerQueue != null) { + return this.applicationPriorityPerQueue; + } + + if (!p.hasApplicatonPriorityPerQueue()) { + return null; + } + + this.applicationPriorityPerQueue = convertFromProtoFormat(p + .getApplicatonPriorityPerQueue()); + return this.applicationPriorityPerQueue; + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/SetApplicationPriorityForQueueResponsePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/SetApplicationPriorityForQueueResponsePBImpl.java new file mode 100644 index 0000000..2258f69 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/SetApplicationPriorityForQueueResponsePBImpl.java @@ -0,0 +1,70 @@ +/** + * 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.api.protocolrecords.impl.pb; + + +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.SetApplicationPriorityForQueueResponseProto; +import org.apache.hadoop.yarn.server.api.protocolrecords.SetApplicationPriorityForQueueResponse; + +import com.google.protobuf.TextFormat; + +public class SetApplicationPriorityForQueueResponsePBImpl extends + SetApplicationPriorityForQueueResponse { + + SetApplicationPriorityForQueueResponseProto proto = SetApplicationPriorityForQueueResponseProto + .getDefaultInstance(); + SetApplicationPriorityForQueueResponseProto.Builder builder = null; + boolean viaProto = false; + + public SetApplicationPriorityForQueueResponsePBImpl() { + builder = SetApplicationPriorityForQueueResponseProto.newBuilder(); + } + + public SetApplicationPriorityForQueueResponsePBImpl( + SetApplicationPriorityForQueueResponseProto proto) { + this.proto = proto; + viaProto = true; + } + + public SetApplicationPriorityForQueueResponseProto 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/server/api/protocolrecords/impl/pb/SetQueueAclToApplicationPriorityRequestPBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/SetQueueAclToApplicationPriorityRequestPBImpl.java new file mode 100644 index 0000000..8f8ae40 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/SetQueueAclToApplicationPriorityRequestPBImpl.java @@ -0,0 +1,159 @@ +/** + * 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.api.protocolrecords.impl.pb; + +import java.util.HashSet; +import java.util.Set; + +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.SetQueueAclToApplicationPriorityRequestProto; +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.SetQueueAclToApplicationPriorityRequestProtoOrBuilder; +import org.apache.hadoop.yarn.server.api.protocolrecords.SetQueueAclToApplicationPriorityRequest; + +public class SetQueueAclToApplicationPriorityRequestPBImpl extends + SetQueueAclToApplicationPriorityRequest { + SetQueueAclToApplicationPriorityRequestProto proto = SetQueueAclToApplicationPriorityRequestProto + .getDefaultInstance(); + SetQueueAclToApplicationPriorityRequestProto.Builder builder = null; + boolean viaProto = false; + + Set userLists = null; + + public SetQueueAclToApplicationPriorityRequestPBImpl() { + this.builder = SetQueueAclToApplicationPriorityRequestProto.newBuilder(); + } + + public SetQueueAclToApplicationPriorityRequestPBImpl( + SetQueueAclToApplicationPriorityRequestProto proto) { + this.proto = proto; + viaProto = true; + } + + private void maybeInitBuilder() { + if (viaProto || builder == null) { + builder = SetQueueAclToApplicationPriorityRequestProto.newBuilder(proto); + } + viaProto = false; + } + + private void mergeLocalToProto() { + if (viaProto) + maybeInitBuilder(); + mergeLocalToBuilder(); + proto = builder.build(); + viaProto = true; + } + + private void mergeLocalToBuilder() { + if (this.userLists != null && !this.userLists.isEmpty()) { + builder.clearApplicationPriorityACL(); + builder.addAllApplicationPriorityACL(this.userLists); + } + } + + public SetQueueAclToApplicationPriorityRequestProto getProto() { + mergeLocalToProto(); + proto = viaProto ? proto : builder.build(); + viaProto = true; + return proto; + } + + @Override + public int hashCode() { + assert false : "hashCode not designed"; + return 0; + } + + @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; + } + + private void initLabels() { + if (this.userLists != null) { + return; + } + SetQueueAclToApplicationPriorityRequestProtoOrBuilder p = viaProto + ? proto + : builder; + this.userLists = new HashSet(); + this.userLists.addAll(p.getApplicationPriorityACLList()); + } + + @Override + public void setQueueName(String queueName) { + maybeInitBuilder(); + if (queueName == null) { + builder.clearQueueName(); + return; + } + builder.setQueueName(queueName); + } + + @Override + public String getQueueName() { + SetQueueAclToApplicationPriorityRequestProtoOrBuilder p = viaProto + ? proto + : builder; + if (!p.hasQueueName()) { + return null; + } + return (p.getQueueName()); + } + + @Override + public void setApplicationPriority(Integer applicationPriority) { + maybeInitBuilder(); + if (applicationPriority == null) { + builder.clearApplicationPriority(); + return; + } + builder.setApplicationPriority(applicationPriority); + } + + @Override + public Integer getApplicationPriority() { + SetQueueAclToApplicationPriorityRequestProtoOrBuilder p = viaProto + ? proto + : builder; + if (!p.hasApplicationPriority()) { + return null; + } + return (p.getApplicationPriority()); + } + + @Override + public void setQueuePriorityLabelACL(Set userList) { + maybeInitBuilder(); + if (userLists == null || userLists.isEmpty()) { + builder.clearApplicationPriorityACL(); + } + this.userLists = userList; + } + + @Override + public Set getQueuePriorityLabelACL() { + initLabels(); + return this.userLists; + } +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/SetQueueAclToApplicationPriorityResponsePBImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/SetQueueAclToApplicationPriorityResponsePBImpl.java new file mode 100644 index 0000000..5b1a184 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/server/api/protocolrecords/impl/pb/SetQueueAclToApplicationPriorityResponsePBImpl.java @@ -0,0 +1,69 @@ +/** + * 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.api.protocolrecords.impl.pb; + +import org.apache.hadoop.yarn.proto.YarnServerResourceManagerServiceProtos.SetQueueAclToApplicationPriorityResponseProto; +import org.apache.hadoop.yarn.server.api.protocolrecords.SetQueueAclToApplicationPriorityResponse; + +import com.google.protobuf.TextFormat; + +public class SetQueueAclToApplicationPriorityResponsePBImpl extends + SetQueueAclToApplicationPriorityResponse { + + SetQueueAclToApplicationPriorityResponseProto proto = SetQueueAclToApplicationPriorityResponseProto + .getDefaultInstance(); + SetQueueAclToApplicationPriorityResponseProto.Builder builder = null; + boolean viaProto = false; + + public SetQueueAclToApplicationPriorityResponsePBImpl() { + builder = SetQueueAclToApplicationPriorityResponseProto.newBuilder(); + } + + public SetQueueAclToApplicationPriorityResponsePBImpl( + SetQueueAclToApplicationPriorityResponseProto proto) { + this.proto = proto; + viaProto = true; + } + + public SetQueueAclToApplicationPriorityResponseProto 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/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java index b8f6e9c..cf7dcf5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestPBImplRecords.java @@ -74,6 +74,8 @@ private static Object genTypeValue(Type type) { return rand.nextBoolean(); } else if (type.equals(byte.class)) { return bytes[rand.nextInt(4)]; + } else if (type.equals(Integer.class)) { + return rand.nextInt(1000000); } else if (type.equals(int.class)) { return rand.nextInt(1000000); } else if (type.equals(long.class)) { @@ -224,6 +226,7 @@ public static void setup() throws Exception { generateByNewInstance(ReservationRequest.class); generateByNewInstance(ReservationRequests.class); generateByNewInstance(ReservationDefinition.class); + generateByNewInstance(ApplicationPriorityPerQueue.class); } private class GetSetPair { @@ -1003,4 +1006,79 @@ public void testGetNodeToLabelsResponsePBImpl() throws Exception { validatePBImplRecord(GetNodesToLabelsResponsePBImpl.class, GetNodesToLabelsResponseProto.class); } + + @Test + public void testAddToClusterLevelApplicationPriorityRequestPBImpl() + throws Exception { + validatePBImplRecord( + AddToClusterLevelApplicationPriorityRequestPBImpl.class, + AddToClusterLevelApplicationPriorityRequestProto.class); + } + + @Test + public void testAddToClusterLevelApplicationPriorityResponsePBImpl() + throws Exception { + validatePBImplRecord( + AddToClusterLevelApplicationPriorityResponsePBImpl.class, + AddToClusterLevelApplicationPriorityResponseProto.class); + } + + @Test + public void testGetClusterLevelApplicationPriorityRequestPBImpl() + throws Exception { + validatePBImplRecord(GetClusterLevelApplicationPriorityRequestPBImpl.class, + GetClusterLevelApplicationPriorityRequestProto.class); + } + + @Test + public void testGetClusterLevelApplicationPriorityResponsePBImpl() + throws Exception { + validatePBImplRecord( + GetClusterLevelApplicationPriorityResponsePBImpl.class, + GetClusterLevelApplicationPriorityResponseProto.class); + } + + @Test + public void testGetApplicationPriorityForQueueRequestPBImpl() + throws Exception { + validatePBImplRecord(GetApplicationPriorityForQueueRequestPBImpl.class, + GetApplicationPriorityForQueueRequestProto.class); + } + + @Test + public void testGetApplicationPriorityForQueueResponsePBImpl() + throws Exception { + validatePBImplRecord(GetApplicationPriorityForQueueResponsePBImpl.class, + GetApplicationPriorityForQueueResponseProto.class); + } + + @Test + public void testSetApplicationPriorityForQueueRequestPBImpl() + throws Exception { + validatePBImplRecord(SetApplicationPriorityForQueueRequestPBImpl.class, + SetApplicationPriorityForQueueRequestProto.class); + } + + @Test + public void testSetApplicationPriorityForQueueResponsePBImpl() + throws Exception { + validatePBImplRecord(SetApplicationPriorityForQueueResponsePBImpl.class, + SetApplicationPriorityForQueueResponseProto.class); + } + + @Test + public void testRemoveApplicationPriorityFromClusterRequestPBImpl() + throws Exception { + validatePBImplRecord( + RemoveApplicationPriorityFromClusterRequestPBImpl.class, + RemoveApplicationPriorityFromClusterRequestProto.class); + } + + @Test + public void testRemoveApplicationPriorityFromClusterResponsePBImpl() + throws Exception { + validatePBImplRecord( + RemoveApplicationPriorityFromClusterResponsePBImpl.class, + RemoveApplicationPriorityFromClusterResponseProto.class); + } } -- 1.9.4.msysgit.1