diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicy.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicy.java new file mode 100644 index 0000000..c724a57 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicy.java @@ -0,0 +1,33 @@ +/** + * 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.federation.policies; + +import org.apache.hadoop.yarn.server.federation.policies.amrmproxy.AMRMProxyFederationPolicy; +import org.apache.hadoop.yarn.server.federation.policies.router.RouterFederationPolicy; + +/** + * Implementations of this interface provides support for the lifecycle of + * configuring, and instantiating policies in federation. In particular, it is + * designed to tie together a {@link RouterFederationPolicy} and a {@link + * AMRMProxyFederationPolicy}, and to provide basic serialization of the policy + * configuration. + */ +public interface FederationPolicy + extends FederationPolicyWriter, FederationPolicyConfigurator { + +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicyWriter.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicyWriter.java new file mode 100644 index 0000000..a3ad3e9 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicyWriter.java @@ -0,0 +1,45 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.hadoop.yarn.server.federation.policies; + +import org.apache.hadoop.yarn.server.federation.api.records.FederationPolicyConfiguration; +import org.apache.hadoop.yarn.server.federation.policies.exceptions.FederationPolicyInitializationException; + +/** + * Implementors of this class are able to serializeConf the configuraiton of a + * policy as a {@link FederationPolicyConfiguration}. This is used during the + * lifetime of a policy from the admin APIs or policy engine to serializeConf + * the policy into the policy store. + */ +public interface FederationPolicyWriter { + + /** + * This method is invoked to derive a {@link FederationPolicyConfiguration} + * based on the current parametrization of a {@link FederationPolicy} + * instance. This is to be used when writing a policy object in the federation + * policy store. + * + * @return a valid policy configuration representing this object + * parametrization. + * + * @throws FederationPolicyInitializationException if the current state cannot + * be serialized properly + */ + public FederationPolicyConfiguration serializeConf() + throws FederationPolicyInitializationException; +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicyConfigurator.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicyConfigurator.java new file mode 100644 index 0000000..e6e7da4 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicyConfigurator.java @@ -0,0 +1,81 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with this + * work for additional information regarding copyright ownership. The ASF + * licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations under + * the License. + */ + +package org.apache.hadoop.yarn.server.federation.policies; + +import org.apache.hadoop.yarn.server.federation.policies.amrmproxy.AMRMProxyFederationPolicy; +import org.apache.hadoop.yarn.server.federation.policies.exceptions.FederationPolicyInitializationException; +import org.apache.hadoop.yarn.server.federation.policies.router.RouterFederationPolicy; + +/** + * Implementors of this interface are capable to instantiate and (re)initalize + * {@link AMRMProxyFederationPolicy} and {@link RouterFederationPolicy} based on + * a {@link FederationPolicyContext}. The reason to bind these two policies + * together is to make sure we remain consistent across the router and amrmproxy + * policy decisions. + */ +public interface FederationPolicyConfigurator { + + /** + * If the current instance is compatible, this method returns the same + * instance of {@link AMRMProxyFederationPolicy} reinitialized with the + * current context, otherwise a new instance initialized with the current + * context is provided. If the instance is compatible with the current class + * the implementors should attempt to reinitalize (retaining state). To affect + * a complete policy reset {@param oldInstance} shoulb be null. + * + * @param federationPolicyContext the current context + * @param oldInstance the existing (possibly null) instance. + * + * @return an updated {@link AMRMProxyFederationPolicy}. + * + * @throws FederationPolicyInitializationException if the initalization cannot + * be completed properly. The + * oldInstance should be still + * valid in case of failed + * initialization. + */ + public AMRMProxyFederationPolicy getAMRMPolicy( + FederationPolicyContext federationPolicyContext, + AMRMProxyFederationPolicy oldInstance) + throws FederationPolicyInitializationException; + + /** + * If the current instance is compatible, this method returns the same + * instance of {@link RouterFederationPolicy} reinitialized with the current + * context, otherwise a new instance initialized with the current context is + * provided. If the instance is compatible with the current class the + * implementors should attempt to reinitalize (retaining state). To affect a + * complete policy reset {@param oldInstance} shoulb be null. + * + * @param federationPolicyContext the current context + * @param oldInstance the existing (possibly null) instance. + * + * @return an updated {@link RouterFederationPolicy}. + * + * @throws FederationPolicyInitializationException if the initalization cannot + * be completed properly. The + * oldInstance should be still + * valid in case of failed + * initialization. + */ + public RouterFederationPolicy getRouterPolicy( + FederationPolicyContext federationPolicyContext, + RouterFederationPolicy oldInstance) + throws FederationPolicyInitializationException; + +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicyContext.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicyContext.java new file mode 100644 index 0000000..1d4e12a --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicyContext.java @@ -0,0 +1,51 @@ +/** + * 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.federation.policies; + +import org.apache.hadoop.yarn.server.federation.api.records.FederationPolicyConfiguration; +import org.apache.hadoop.yarn.server.federation.policies.amrmproxy.AMRMProxyFederationPolicy; +import org.apache.hadoop.yarn.server.federation.policies.router.RouterFederationPolicy; +import org.apache.hadoop.yarn.server.federation.resolver.FederationSubClusterResolver; + +/** + * Context to (re)initialize a {@link AMRMProxyFederationPolicy} and {@link + * RouterFederationPolicy}. + */ +public class FederationPolicyContext { + + private FederationPolicyConfiguration federationPolicyConfiguration; + private FederationSubClusterResolver federationSubclusterResolver; + + public FederationPolicyConfiguration getFederationPolicyConfiguration() { + return federationPolicyConfiguration; + } + + public void setFederationPolicyConfiguration( + FederationPolicyConfiguration federationPolicyConfiguration) { + this.federationPolicyConfiguration = federationPolicyConfiguration; + } + + public FederationSubClusterResolver getFederationSubclusterResolver() { + return federationSubclusterResolver; + } + + public void setFederationSubclusterResolver( + FederationSubClusterResolver federationSubclusterResolver) { + this.federationSubclusterResolver = federationSubclusterResolver; + } +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicyContextValidator.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicyContextValidator.java new file mode 100644 index 0000000..56081ad --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/FederationPolicyContextValidator.java @@ -0,0 +1,58 @@ +/** + * 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.federation.policies; + +import org.apache.hadoop.yarn.server.federation.policies.exceptions.FederationPolicyInitializationException; + +/** + * Helper class used to factor out common validation steps for policies. + */ +public final class FederationPolicyContextValidator { + + public static void validate(FederationPolicyContext federationPolicyContext, + String myType) throws FederationPolicyInitializationException { + + if(myType == null){ + throw new FederationPolicyInitializationException("The myType parameter" + + " should not be null."); + } + + if (federationPolicyContext == null) { + throw new FederationPolicyInitializationException( + "The FederationPolicyContext provided is null. Cannot reinitalize " + + "successfully."); + } + if (federationPolicyContext.getFederationPolicyConfiguration() == null) { + throw new FederationPolicyInitializationException( + "The FederationPolicyConfiguration provided is null. Cannot " + + "reinitalize successfully."); + } + + String intendedType = + federationPolicyContext.getFederationPolicyConfiguration().getType(); + + if (!myType.equals(intendedType)) { + throw new FederationPolicyInitializationException( + "The FederationPolicyConfiguration carries a type (" + intendedType + + ") different then mine (" + myType + + "). Cannot reinitialize successfully."); + } + + } + +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/ConfigurableFederationPolicy.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/ConfigurableFederationPolicy.java new file mode 100644 index 0000000..4bde348 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/ConfigurableFederationPolicy.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.federation.policies; + +import org.apache.hadoop.yarn.server.federation.policies.exceptions.FederationPolicyInitializationException; + +/** + * This interface provides a general method to reinitialize a policy. The + * semantics are try-n-swap, so in case of an exception is thrown the + * implmentation must ensure the previous state and configuration is preserved. + */ +public interface ConfigurableFederationPolicy { + + /** + * This method is invoked to initialize of update the configuration of + * policies. The implementor should provide try-n-swap semantics, and retain + * state if possible. + * + * @param federationPolicyContext the new context to provide to implementor. + * + * @throws FederationPolicyInitializationException in case the initialization + * fails. + */ + public void reinitialize(FederationPolicyContext federationPolicyContext) + throws FederationPolicyInitializationException; +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/router/RouterFederationPolicy.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/router/RouterFederationPolicy.java new file mode 100644 index 0000000..43eef41 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/router/RouterFederationPolicy.java @@ -0,0 +1,49 @@ +/** + * 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.federation.policies.router; + +import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; +import org.apache.hadoop.yarn.exceptions.YarnException; +import org.apache.hadoop.yarn.server.federation.api.records.FederationSubClusterId; +import org.apache.hadoop.yarn.server.federation.api.records.FederationSubClusterInfo; +import org.apache.hadoop.yarn.server.federation.policies.ConfigurableFederationPolicy; + +import java.util.Map; + +/** + * Implements the logic for determining the routing of an application submission + * based on a policy. + */ +public interface RouterFederationPolicy extends ConfigurableFederationPolicy { + + /** + * Determines the sub-cluster that the user application submision should be + * routed to. + * + * @param appSubmissionContext the context for the app being submitted. + * + * @return the sub-cluster as identified by {@link FederationSubClusterId} to + * route the request to. + * + * @throws YarnException if the policy cannot determine a viable subcluster. + */ + public FederationSubClusterId getHomeSubcluster( + ApplicationSubmissionContext appSubmissionContext, + Map activeSubclusters) + throws YarnException; +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/amrmproxy/AMRMProxyFederationPolicy.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/amrmproxy/AMRMProxyFederationPolicy.java new file mode 100644 index 0000000..6321791 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/amrmproxy/AMRMProxyFederationPolicy.java @@ -0,0 +1,67 @@ +/** + * 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.federation.policies.amrmproxy; + +import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse; +import org.apache.hadoop.yarn.api.records.ResourceRequest; +import org.apache.hadoop.yarn.exceptions.YarnException; +import org.apache.hadoop.yarn.server.federation.api.records.FederationSubClusterId; +import org.apache.hadoop.yarn.server.federation.api.records.FederationSubClusterInfo; +import org.apache.hadoop.yarn.server.federation.policies.ConfigurableFederationPolicy; + +import java.util.List; +import java.util.Map; + +/** + * Implementors of this interface provide logic to split {@link + * List} received by the AM among various RMs. + */ +public interface AMRMProxyFederationPolicy + extends ConfigurableFederationPolicy { + + /** + * Splits the {@link ResourceRequest}s from the client across one or more + * sub-clusters based on the policy semantics (e.g., broadcast, load-based). + * + * @param resourceRequests the {@link List} from the AM to be + * split + * + * @return map of sub-cluster as identified by {@link FederationSubClusterId} + * to the {@link List}s that should be forwarded to it + * + * @throws YarnException in case the request is malformed or no viable + * sub-clusters can be found. + */ + public Map> splitResourceRequests( + List resourceRequests, + Map activeSubclusters) + throws YarnException; + + /** + * This method should be invoked to notify the policy about responses being + * received. This is useful for stateful policies that make decisions based on + * previous responses being received. + * + * @param response the response received from one of the RMs + * + * @throws YarnException in case the response is not valid + */ + public void notifyOfResponse(FederationSubClusterId subClusterId, + AllocateResponse response) throws YarnException; + +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/exceptions/FederationPolicyException.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/exceptions/FederationPolicyException.java new file mode 100644 index 0000000..66a797d --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/exceptions/FederationPolicyException.java @@ -0,0 +1,33 @@ +/** + * 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.federation.policies.exceptions; + +import org.apache.hadoop.yarn.exceptions.YarnException; + +/** + * Generic policy exception + */ +public class FederationPolicyException extends YarnException { + public FederationPolicyException(String s) { + super(s); + } + + public FederationPolicyException(Throwable t) { + super(t); + } +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/exceptions/FederationPolicyInitializationException.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/exceptions/FederationPolicyInitializationException.java new file mode 100644 index 0000000..fcc09c2 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/exceptions/FederationPolicyInitializationException.java @@ -0,0 +1,33 @@ +/** + * 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.federation.policies.exceptions; + +/** + * This exception is thrown when the initialization of a federation policy is + * not successful. + */ +public class FederationPolicyInitializationException + extends FederationPolicyException { + public FederationPolicyInitializationException(String message) { + super(message); + } + + public FederationPolicyInitializationException(Throwable j) { + super(j); + } +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/exceptions/NoActiveSubclustersException.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/exceptions/NoActiveSubclustersException.java new file mode 100644 index 0000000..a427944 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/exceptions/NoActiveSubclustersException.java @@ -0,0 +1,27 @@ +/** + * 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.federation.policies.exceptions; + +/** + * This exception is thrown when policies cannot locate any active cluster. + */ +public class NoActiveSubclustersException extends FederationPolicyException { + public NoActiveSubclustersException(String s) { + super(s); + } +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/exceptions/UnknownSubclusterException.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/exceptions/UnknownSubclusterException.java new file mode 100644 index 0000000..ddec066 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-common/src/main/java/org/apache/hadoop/yarn/server/federation/policies/exceptions/UnknownSubclusterException.java @@ -0,0 +1,30 @@ +/** + * 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.federation.policies.exceptions; + +import org.apache.hadoop.yarn.server.federation.api.records.FederationSubClusterId; + +/** + * This exception is thrown whenever a policy is given a {@link + * FederationSubClusterId} that is unknown. + */ +public class UnknownSubclusterException extends FederationPolicyException { + public UnknownSubclusterException(String s) { + super(s); + } +}