YARN-5307. Federation Application State Store internal APIs

(cherry picked from commit 1af5292042)
This commit is contained in:
Subru Krishnan 2016-08-05 11:52:44 -07:00 committed by Carlo Curino
parent d19b677301
commit 047a16bf15
26 changed files with 2301 additions and 4 deletions

View File

@ -0,0 +1,126 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.server.federation.store.records.AddApplicationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.AddApplicationHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.records.DeleteApplicationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.DeleteApplicationHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.records.GetApplicationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.GetApplicationHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.records.GetApplicationsHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.GetApplicationsHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.federation.store.records.UpdateApplicationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.UpdateApplicationHomeSubClusterResponse;
import org.apache.hadoop.yarn.server.records.Version;
/**
* FederationApplicationHomeSubClusterStore maintains the state of all
* <em>Applications</em> that have been submitted to the federated cluster.
*
* *
* <p>
* The mapping details contains:
* <ul>
* <li>{@code ApplicationId}</li>
* <li>{@code SubClusterId}</li>
* </ul>
*
*/
@Private
@Unstable
public interface FederationApplicationHomeSubClusterStore {
/**
* Get the {@link Version} of the underlying federation application state
* store.
*
* @return the {@link Version} of the underlying federation application state
* store
*/
Version getApplicationStateStoreVersion();
/**
* Register the home {@code SubClusterId} of the newly submitted
* {@code ApplicationId}. Currently response is empty if the operation was
* successful, if not an exception reporting reason for a failure.
*
* @param request the request to register a new application with its home
* sub-cluster
* @return empty on successful registration of the application in the
* StateStore, if not an exception reporting reason for a failure
* @throws YarnException if the request is invalid/fails
*/
AddApplicationHomeSubClusterResponse addApplicationHomeSubClusterMap(
AddApplicationHomeSubClusterRequest request) throws YarnException;
/**
* Update the home {@code SubClusterId} of a previously submitted
* {@code ApplicationId}. Currently response is empty if the operation was
* successful, if not an exception reporting reason for a failure.
*
* @param request the request to update the home sub-cluster of an
* application.
* @return empty on successful update of the application in the StateStore, if
* not an exception reporting reason for a failure
* @throws YarnException if the request is invalid/fails
*/
UpdateApplicationHomeSubClusterResponse updateApplicationHomeSubClusterMap(
UpdateApplicationHomeSubClusterRequest request) throws YarnException;
/**
* Get information about the application identified by the input
* {@code ApplicationId}.
*
* @param request contains the application queried
* @return {@code ApplicationHomeSubCluster} containing the application's
* home subcluster
* @throws YarnException if the request is invalid/fails
*/
GetApplicationHomeSubClusterResponse getApplicationHomeSubClusterMap(
GetApplicationHomeSubClusterRequest request) throws YarnException;
/**
* Get the {@code ApplicationHomeSubCluster} list representing the mapping
* of all submitted applications to it's home sub-cluster.
*
* @param request empty representing all applications
* @return the mapping of all submitted application to it's home sub-cluster
* @throws YarnException if the request is invalid/fails
*/
GetApplicationsHomeSubClusterResponse getApplicationsHomeSubClusterMap(
GetApplicationsHomeSubClusterRequest request) throws YarnException;
/**
* Delete the mapping of home {@code SubClusterId} of a previously submitted
* {@code ApplicationId}. Currently response is empty if the operation was
* successful, if not an exception reporting reason for a failure.
*
* @param request the request to delete the home sub-cluster of an
* application.
* @return empty on successful update of the application in the StateStore, if
* not an exception reporting reason for a failure
* @throws YarnException if the request is invalid/fails
*/
DeleteApplicationHomeSubClusterResponse deleteApplicationHomeSubClusterMap(
DeleteApplicationHomeSubClusterRequest request) throws YarnException;
}

View File

@ -0,0 +1,72 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The request sent by the <code>Router</code> to <code>Federation state
* store</code> to map the home subcluster of a newly submitted application.
*
* <p>
* The request includes the mapping details, i.e.:
* <ul>
* <li>{@code ApplicationId}</li>
* <li>{@code SubClusterId}</li>
* </ul>
*/
@Private
@Unstable
public abstract class AddApplicationHomeSubClusterRequest {
@Private
@Unstable
public static AddApplicationHomeSubClusterRequest newInstance(
ApplicationHomeSubCluster applicationHomeSubCluster) {
AddApplicationHomeSubClusterRequest mapRequest =
Records.newRecord(AddApplicationHomeSubClusterRequest.class);
mapRequest.setApplicationHomeSubCluster(applicationHomeSubCluster);
return mapRequest;
}
/**
* Get the {@link ApplicationHomeSubCluster} representing the mapping of the
* application to it's home sub-cluster.
*
* @return the mapping of the application to it's home sub-cluster.
*/
@Public
@Unstable
public abstract ApplicationHomeSubCluster getApplicationHomeSubCluster();
/**
* Set the {@link ApplicationHomeSubCluster} representing the mapping of the
* application to it's home sub-cluster.
*
* @param applicationHomeSubCluster the mapping of the application to it's
* home sub-cluster.
*/
@Private
@Unstable
public abstract void setApplicationHomeSubCluster(
ApplicationHomeSubCluster applicationHomeSubCluster);
}

View File

@ -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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* AddApplicationHomeSubClusterResponse contains the answer from the
* {@code FederationApplicationHomeSubClusterStore} to a request to insert a
* newly generated applicationId and its owner. Currently response is empty if
* the operation was successful, if not an exception reporting reason for a
* failure.
*
*/
@Private
@Unstable
public abstract class AddApplicationHomeSubClusterResponse {
@Private
@Unstable
public static AddApplicationHomeSubClusterResponse newInstance() {
AddApplicationHomeSubClusterResponse response =
Records.newRecord(AddApplicationHomeSubClusterResponse.class);
return response;
}
}

View File

@ -0,0 +1,124 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* ApplicationHomeSubCluster is a report of the runtime information of the
* application that is running in the federated cluster.
*
* <p>
* It includes information such as:
* <ul>
* <li>{@link ApplicationId}</li>
* <li>{@link SubClusterId}</li>
* </ul>
*
*/
@Private
@Unstable
public abstract class ApplicationHomeSubCluster {
@Private
@Unstable
public static ApplicationHomeSubCluster newInstance(ApplicationId appId,
SubClusterId homeSubCluster) {
ApplicationHomeSubCluster appMapping =
Records.newRecord(ApplicationHomeSubCluster.class);
appMapping.setApplicationId(appId);
appMapping.setHomeSubCluster(homeSubCluster);
return appMapping;
}
/**
* Get the {@link ApplicationId} representing the unique identifier of the
* application.
*
* @return the application identifier
*/
@Public
@Unstable
public abstract ApplicationId getApplicationId();
/**
* Set the {@link ApplicationId} representing the unique identifier of the
* application.
*
* @param applicationId the application identifier
*/
@Private
@Unstable
public abstract void setApplicationId(ApplicationId applicationId);
/**
* Get the {@link SubClusterId} representing the unique identifier of the home
* subcluster in which the ApplicationMaster of the application is running.
*
* @return the home subcluster identifier
*/
@Public
@Unstable
public abstract SubClusterId getHomeSubCluster();
/**
* Set the {@link SubClusterId} representing the unique identifier of the home
* subcluster in which the ApplicationMaster of the application is running.
*
* @param homeSubCluster the home subcluster identifier
*/
@Private
@Unstable
public abstract void setHomeSubCluster(SubClusterId homeSubCluster);
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
ApplicationHomeSubCluster other = (ApplicationHomeSubCluster) obj;
if (!this.getApplicationId().equals(other.getApplicationId())) {
return false;
}
return this.getHomeSubCluster().equals(other.getHomeSubCluster());
}
@Override
public int hashCode() {
return getApplicationId().hashCode() * 31 + getHomeSubCluster().hashCode();
}
@Override
public String toString() {
return "ApplicationHomeSubCluster [getApplicationId()="
+ getApplicationId() + ", getHomeSubCluster()=" + getHomeSubCluster()
+ "]";
}
}

View File

@ -0,0 +1,65 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.util.Records;
/**
* The request to <code>Federation state store</code> to delete the mapping of
* home subcluster of a submitted application.
*/
@Private
@Unstable
public abstract class DeleteApplicationHomeSubClusterRequest {
@Private
@Unstable
public static DeleteApplicationHomeSubClusterRequest newInstance(
ApplicationId applicationId) {
DeleteApplicationHomeSubClusterRequest deleteApplicationRequest =
Records.newRecord(DeleteApplicationHomeSubClusterRequest.class);
deleteApplicationRequest.setApplicationId(applicationId);
return deleteApplicationRequest;
}
/**
* Get the identifier of the {@link ApplicationId} to be removed from
* <code>Federation state store</code> .
*
* @return the identifier of the application to be removed from Federation
* State Store.
*/
@Public
@Unstable
public abstract ApplicationId getApplicationId();
/**
* Set the identifier of the {@link ApplicationId} to be removed from
* <code>Federation state store</code> .
*
* @param applicationId the identifier of the application to be removed from
* Federation State Store.
*/
@Private
@Unstable
public abstract void setApplicationId(ApplicationId applicationId);
}

View File

@ -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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* DeleteApplicationHomeSubClusterResponse contains the answer from the {@code
* FederationApplicationHomeSubClusterStore} to a request to delete the mapping
* of home subcluster of a submitted application. Currently response is empty if
* the operation was successful, if not an exception reporting reason for a
* failure.
*/
@Private
@Unstable
public abstract class DeleteApplicationHomeSubClusterResponse {
@Private
@Unstable
public static DeleteApplicationHomeSubClusterResponse newInstance() {
DeleteApplicationHomeSubClusterResponse response =
Records.newRecord(DeleteApplicationHomeSubClusterResponse.class);
return response;
}
}

View File

@ -0,0 +1,64 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.util.Records;
/**
* Request class to obtain the home sub-cluster for the specified
* {@link ApplicationId}.
*/
@Private
@Unstable
public abstract class GetApplicationHomeSubClusterRequest {
@Private
@Unstable
public static GetApplicationHomeSubClusterRequest newInstance(
ApplicationId appId) {
GetApplicationHomeSubClusterRequest appMapping =
Records.newRecord(GetApplicationHomeSubClusterRequest.class);
appMapping.setApplicationId(appId);
return appMapping;
}
/**
* Get the {@link ApplicationId} representing the unique identifier of the
* application.
*
* @return the application identifier
*/
@Public
@Unstable
public abstract ApplicationId getApplicationId();
/**
* Set the {@link ApplicationId} representing the unique identifier of the
* application.
*
* @param applicationId the application identifier
*/
@Private
@Unstable
public abstract void setApplicationId(ApplicationId applicationId);
}

View File

@ -0,0 +1,73 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with this
* work for additional information regarding copyright ownership. The ASF
* licenses this file to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The response sent by <code>Federation state
* store</code> to a query for the home subcluster of a newly submitted
* application.
*
* <p>
* The request includes the mapping details, i.e.:
* <ul>
* <li>{@code ApplicationId}</li>
* <li>{@code SubClusterId}</li>
* </ul>
*/
@Private
@Unstable
public abstract class GetApplicationHomeSubClusterResponse {
@Private
@Unstable
public static GetApplicationHomeSubClusterResponse newInstance(
ApplicationHomeSubCluster applicationHomeSubCluster) {
GetApplicationHomeSubClusterResponse mapResponse =
Records.newRecord(GetApplicationHomeSubClusterResponse.class);
mapResponse.setApplicationHomeSubCluster(applicationHomeSubCluster);
return mapResponse;
}
/**
* Get the {@link ApplicationHomeSubCluster} representing the mapping of the
* application to it's home sub-cluster.
*
* @return the mapping of the application to it's home sub-cluster.
*/
@Public
@Unstable
public abstract ApplicationHomeSubCluster getApplicationHomeSubCluster();
/**
* Set the {@link ApplicationHomeSubCluster} representing the mapping of the
* application to it's home sub-cluster.
*
* @param applicationHomeSubCluster the mapping of the application to it's
* home sub-cluster.
*/
@Private
@Unstable
public abstract void setApplicationHomeSubCluster(
ApplicationHomeSubCluster applicationHomeSubCluster);
}

View File

@ -0,0 +1,40 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* Request class to obtain the home sub-cluster mapping of all active
* applications.
*/
@Private
@Unstable
public abstract class GetApplicationsHomeSubClusterRequest {
@Private
@Unstable
public static GetApplicationsHomeSubClusterRequest newInstance() {
GetApplicationsHomeSubClusterRequest request =
Records.newRecord(GetApplicationsHomeSubClusterRequest.class);
return request;
}
}

View File

@ -0,0 +1,75 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The response sent by <code>Federation state
* store</code> to a query for the home subcluster of all submitted
* applications.
*
* <p>
* The response includes the mapping details, i.e.:
* <ul>
* <li>{@code ApplicationId}</li>
* <li>{@code SubClusterId}</li>
* </ul>
*/
@Private
@Unstable
public abstract class GetApplicationsHomeSubClusterResponse {
@Private
@Unstable
public static GetApplicationsHomeSubClusterResponse newInstance(
List<ApplicationHomeSubCluster> appsHomeSubClusters) {
GetApplicationsHomeSubClusterResponse mapResponse =
Records.newRecord(GetApplicationsHomeSubClusterResponse.class);
mapResponse.setAppsHomeSubClusters(appsHomeSubClusters);
return mapResponse;
}
/**
* Get the {@link ApplicationHomeSubCluster} list representing the mapping of
* all submitted applications to it's home sub-cluster.
*
* @return the mapping of all submitted application to it's home sub-cluster.
*/
@Public
@Unstable
public abstract List<ApplicationHomeSubCluster> getAppsHomeSubClusters();
/**
* Set the {@link ApplicationHomeSubCluster} list representing the mapping of
* all submitted applications to it's home sub-cluster.
*
* @param appsHomeSubClusters the mapping of all submitted application to it's
* home sub-cluster.
*/
@Private
@Unstable
public abstract void setAppsHomeSubClusters(
List<ApplicationHomeSubCluster> appsHomeSubClusters);
}

View File

@ -0,0 +1,74 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The request sent by the <code>Router</code> to
* <code>Federation state store</code> to update the home subcluster of a newly
* submitted application.
*
* <p>
* The request includes the mapping details, i.e.:
* <ul>
* <li>{@code ApplicationId}</li>
* <li>{@code SubClusterId}</li>
* </ul>
*/
@Private
@Unstable
public abstract class UpdateApplicationHomeSubClusterRequest {
@Private
@Unstable
public static UpdateApplicationHomeSubClusterRequest newInstance(
ApplicationHomeSubCluster applicationHomeSubCluster) {
UpdateApplicationHomeSubClusterRequest updateApplicationRequest =
Records.newRecord(UpdateApplicationHomeSubClusterRequest.class);
updateApplicationRequest
.setApplicationHomeSubCluster(applicationHomeSubCluster);
return updateApplicationRequest;
}
/**
* Get the {@link ApplicationHomeSubCluster} representing the mapping of the
* application to it's home sub-cluster.
*
* @return the mapping of the application to it's home sub-cluster.
*/
@Public
@Unstable
public abstract ApplicationHomeSubCluster getApplicationHomeSubCluster();
/**
* Set the {@link ApplicationHomeSubCluster} representing the mapping of the
* application to it's home sub-cluster.
*
* @param applicationHomeSubCluster the mapping of the application to it's
* home sub-cluster.
*/
@Private
@Unstable
public abstract void setApplicationHomeSubCluster(
ApplicationHomeSubCluster applicationHomeSubCluster);
}

View File

@ -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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* UpdateApplicationHomeSubClusterResponse contains the answer from the
* {@code FederationApplicationHomeSubClusterStore} to a request to register the
* home subcluster of a submitted application. Currently response is empty if
* the operation was successful, if not an exception reporting reason for a
* failure.
*/
@Private
@Unstable
public abstract class UpdateApplicationHomeSubClusterResponse {
@Private
@Unstable
public static UpdateApplicationHomeSubClusterResponse newInstance() {
UpdateApplicationHomeSubClusterResponse response =
Records.newRecord(UpdateApplicationHomeSubClusterResponse.class);
return response;
}
}

View File

@ -0,0 +1,132 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records.impl.pb;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.AddApplicationHomeSubClusterRequestProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.AddApplicationHomeSubClusterRequestProtoOrBuilder;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.ApplicationHomeSubClusterProto;
import org.apache.hadoop.yarn.server.federation.store.records.AddApplicationHomeSubClusterRequest;
import org.apache.hadoop.yarn.server.federation.store.records.ApplicationHomeSubCluster;
import com.google.protobuf.TextFormat;
/**
* Protocol buffer based implementation of
* {@link AddApplicationHomeSubClusterRequest}.
*/
@Private
@Unstable
public class AddApplicationHomeSubClusterRequestPBImpl
extends AddApplicationHomeSubClusterRequest {
private AddApplicationHomeSubClusterRequestProto proto =
AddApplicationHomeSubClusterRequestProto.getDefaultInstance();
private AddApplicationHomeSubClusterRequestProto.Builder builder = null;
private boolean viaProto = false;
public AddApplicationHomeSubClusterRequestPBImpl() {
builder = AddApplicationHomeSubClusterRequestProto.newBuilder();
}
public AddApplicationHomeSubClusterRequestPBImpl(
AddApplicationHomeSubClusterRequestProto proto) {
this.proto = proto;
viaProto = true;
}
public AddApplicationHomeSubClusterRequestProto getProto() {
mergeLocalToProto();
proto = viaProto ? proto : builder.build();
viaProto = true;
return proto;
}
private void mergeLocalToProto() {
if (viaProto) {
maybeInitBuilder();
}
mergeLocalToBuilder();
proto = builder.build();
viaProto = true;
}
private void maybeInitBuilder() {
if (viaProto || builder == null) {
builder = AddApplicationHomeSubClusterRequestProto.newBuilder(proto);
}
viaProto = false;
}
private void mergeLocalToBuilder() {
}
@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 ApplicationHomeSubCluster getApplicationHomeSubCluster() {
AddApplicationHomeSubClusterRequestProtoOrBuilder p =
viaProto ? proto : builder;
if (!p.hasAppSubclusterMap()) {
return null;
}
return convertFromProtoFormat(p.getAppSubclusterMap());
}
@Override
public void setApplicationHomeSubCluster(
ApplicationHomeSubCluster applicationInfo) {
maybeInitBuilder();
if (applicationInfo == null) {
builder.clearAppSubclusterMap();
return;
}
builder.setAppSubclusterMap(convertToProtoFormat(applicationInfo));
}
private ApplicationHomeSubCluster convertFromProtoFormat(
ApplicationHomeSubClusterProto sc) {
return new ApplicationHomeSubClusterPBImpl(sc);
}
private ApplicationHomeSubClusterProto convertToProtoFormat(
ApplicationHomeSubCluster sc) {
return ((ApplicationHomeSubClusterPBImpl) sc).getProto();
}
}

View File

@ -0,0 +1,78 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records.impl.pb;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.AddApplicationHomeSubClusterResponseProto;
import org.apache.hadoop.yarn.server.federation.store.records.AddApplicationHomeSubClusterResponse;
import com.google.protobuf.TextFormat;
/**
* Protocol buffer based implementation of
* {@link AddApplicationHomeSubClusterResponse}.
*/
@Private
@Unstable
public class AddApplicationHomeSubClusterResponsePBImpl
extends AddApplicationHomeSubClusterResponse {
private AddApplicationHomeSubClusterResponseProto proto =
AddApplicationHomeSubClusterResponseProto.getDefaultInstance();
private AddApplicationHomeSubClusterResponseProto.Builder builder = null;
private boolean viaProto = false;
public AddApplicationHomeSubClusterResponsePBImpl() {
builder = AddApplicationHomeSubClusterResponseProto.newBuilder();
}
public AddApplicationHomeSubClusterResponsePBImpl(
AddApplicationHomeSubClusterResponseProto proto) {
this.proto = proto;
viaProto = true;
}
public AddApplicationHomeSubClusterResponseProto 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());
}
}

View File

@ -0,0 +1,167 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records.impl.pb;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.ApplicationHomeSubClusterProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.ApplicationHomeSubClusterProtoOrBuilder;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.SubClusterIdProto;
import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto;
import org.apache.hadoop.yarn.server.federation.store.records.ApplicationHomeSubCluster;
import org.apache.hadoop.yarn.server.federation.store.records.SubClusterId;
import com.google.protobuf.TextFormat;
/**
* Protocol buffer based implementation of {@link ApplicationHomeSubCluster}.
*/
@Private
@Unstable
public class ApplicationHomeSubClusterPBImpl extends ApplicationHomeSubCluster {
private ApplicationHomeSubClusterProto proto =
ApplicationHomeSubClusterProto.getDefaultInstance();
private ApplicationHomeSubClusterProto.Builder builder = null;
private boolean viaProto = false;
private ApplicationId applicationId = null;
private SubClusterId homeSubCluster = null;
public ApplicationHomeSubClusterPBImpl() {
builder = ApplicationHomeSubClusterProto.newBuilder();
}
public ApplicationHomeSubClusterPBImpl(ApplicationHomeSubClusterProto proto) {
this.proto = proto;
viaProto = true;
}
public ApplicationHomeSubClusterProto getProto() {
mergeLocalToProto();
proto = viaProto ? proto : builder.build();
viaProto = true;
return proto;
}
private void mergeLocalToProto() {
if (viaProto) {
maybeInitBuilder();
}
mergeLocalToBuilder();
proto = builder.build();
viaProto = true;
}
private void maybeInitBuilder() {
if (viaProto || builder == null) {
builder = ApplicationHomeSubClusterProto.newBuilder(proto);
}
viaProto = false;
}
private void mergeLocalToBuilder() {
if (this.applicationId != null) {
builder.setApplicationId(convertToProtoFormat(this.applicationId));
}
if (this.homeSubCluster != null) {
builder.setHomeSubCluster(convertToProtoFormat(this.homeSubCluster));
}
}
@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 ApplicationId getApplicationId() {
ApplicationHomeSubClusterProtoOrBuilder p = viaProto ? proto : builder;
if (!p.hasApplicationId()) {
return null;
}
this.applicationId = convertFromProtoFormat(p.getApplicationId());
return applicationId;
}
@Override
public void setApplicationId(ApplicationId applicationId) {
maybeInitBuilder();
if (applicationId == null) {
builder.clearApplicationId();
return;
}
this.applicationId = applicationId;
}
@Override
public SubClusterId getHomeSubCluster() {
ApplicationHomeSubClusterProtoOrBuilder p = viaProto ? proto : builder;
if (this.homeSubCluster != null) {
return this.homeSubCluster;
}
if (!p.hasHomeSubCluster()) {
return null;
}
this.homeSubCluster = convertFromProtoFormat(p.getHomeSubCluster());
return this.homeSubCluster;
}
@Override
public void setHomeSubCluster(SubClusterId homeSubCluster) {
maybeInitBuilder();
if (homeSubCluster == null) {
builder.clearHomeSubCluster();
}
this.homeSubCluster = homeSubCluster;
}
private SubClusterId convertFromProtoFormat(SubClusterIdProto subClusterId) {
return new SubClusterIdPBImpl(subClusterId);
}
private SubClusterIdProto convertToProtoFormat(SubClusterId subClusterId) {
return ((SubClusterIdPBImpl) subClusterId).getProto();
}
private ApplicationId convertFromProtoFormat(ApplicationIdProto appId) {
return new ApplicationIdPBImpl(appId);
}
private ApplicationIdProto convertToProtoFormat(ApplicationId appId) {
return ((ApplicationIdPBImpl) appId).getProto();
}
}

View File

@ -0,0 +1,130 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records.impl.pb;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.DeleteApplicationHomeSubClusterRequestProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.DeleteApplicationHomeSubClusterRequestProtoOrBuilder;
import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto;
import org.apache.hadoop.yarn.server.federation.store.records.DeleteApplicationHomeSubClusterRequest;
import com.google.protobuf.TextFormat;
/**
* Protocol buffer based implementation of
* {@link DeleteApplicationHomeSubClusterRequest}.
*/
@Private
@Unstable
public class DeleteApplicationHomeSubClusterRequestPBImpl
extends DeleteApplicationHomeSubClusterRequest {
private DeleteApplicationHomeSubClusterRequestProto proto =
DeleteApplicationHomeSubClusterRequestProto.getDefaultInstance();
private DeleteApplicationHomeSubClusterRequestProto.Builder builder = null;
private boolean viaProto = false;
public DeleteApplicationHomeSubClusterRequestPBImpl() {
builder = DeleteApplicationHomeSubClusterRequestProto.newBuilder();
}
public DeleteApplicationHomeSubClusterRequestPBImpl(
DeleteApplicationHomeSubClusterRequestProto proto) {
this.proto = proto;
viaProto = true;
}
public DeleteApplicationHomeSubClusterRequestProto getProto() {
mergeLocalToProto();
proto = viaProto ? proto : builder.build();
viaProto = true;
return proto;
}
private void mergeLocalToProto() {
if (viaProto) {
maybeInitBuilder();
}
mergeLocalToBuilder();
proto = builder.build();
viaProto = true;
}
private void maybeInitBuilder() {
if (viaProto || builder == null) {
builder = DeleteApplicationHomeSubClusterRequestProto.newBuilder(proto);
}
viaProto = false;
}
private void mergeLocalToBuilder() {
}
@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 ApplicationId getApplicationId() {
DeleteApplicationHomeSubClusterRequestProtoOrBuilder p =
viaProto ? proto : builder;
if (!p.hasApplicationId()) {
return null;
}
return convertFromProtoFormat(p.getApplicationId());
}
@Override
public void setApplicationId(ApplicationId applicationId) {
maybeInitBuilder();
if (applicationId == null) {
builder.clearApplicationId();
return;
}
builder.setApplicationId(convertToProtoFormat(applicationId));
}
private ApplicationId convertFromProtoFormat(ApplicationIdProto appId) {
return new ApplicationIdPBImpl(appId);
}
private ApplicationIdProto convertToProtoFormat(ApplicationId appId) {
return ((ApplicationIdPBImpl) appId).getProto();
}
}

View File

@ -0,0 +1,78 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records.impl.pb;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.DeleteApplicationHomeSubClusterResponseProto;
import org.apache.hadoop.yarn.server.federation.store.records.DeleteApplicationHomeSubClusterResponse;
import com.google.protobuf.TextFormat;
/**
* Protocol buffer based implementation of
* {@link DeleteApplicationHomeSubClusterResponse}.
*/
@Private
@Unstable
public class DeleteApplicationHomeSubClusterResponsePBImpl
extends DeleteApplicationHomeSubClusterResponse {
private DeleteApplicationHomeSubClusterResponseProto proto =
DeleteApplicationHomeSubClusterResponseProto.getDefaultInstance();
private DeleteApplicationHomeSubClusterResponseProto.Builder builder = null;
private boolean viaProto = false;
public DeleteApplicationHomeSubClusterResponsePBImpl() {
builder = DeleteApplicationHomeSubClusterResponseProto.newBuilder();
}
public DeleteApplicationHomeSubClusterResponsePBImpl(
DeleteApplicationHomeSubClusterResponseProto proto) {
this.proto = proto;
viaProto = true;
}
public DeleteApplicationHomeSubClusterResponseProto 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());
}
}

View File

@ -0,0 +1,135 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records.impl.pb;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationHomeSubClusterRequestProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationHomeSubClusterRequestProtoOrBuilder;
import org.apache.hadoop.yarn.proto.YarnProtos.ApplicationIdProto;
import org.apache.hadoop.yarn.server.federation.store.records.GetApplicationHomeSubClusterRequest;
import com.google.protobuf.TextFormat;
/**
* Protocol buffer based implementation of
* {@link GetApplicationHomeSubClusterRequest}.
*/
@Private
@Unstable
public class GetApplicationHomeSubClusterRequestPBImpl
extends GetApplicationHomeSubClusterRequest {
private GetApplicationHomeSubClusterRequestProto proto =
GetApplicationHomeSubClusterRequestProto.getDefaultInstance();
private GetApplicationHomeSubClusterRequestProto.Builder builder = null;
private boolean viaProto = false;
private ApplicationId applicationId = null;
public GetApplicationHomeSubClusterRequestPBImpl() {
builder = GetApplicationHomeSubClusterRequestProto.newBuilder();
}
public GetApplicationHomeSubClusterRequestPBImpl(
GetApplicationHomeSubClusterRequestProto proto) {
this.proto = proto;
viaProto = true;
}
public GetApplicationHomeSubClusterRequestProto getProto() {
mergeLocalToProto();
proto = viaProto ? proto : builder.build();
viaProto = true;
return proto;
}
private void mergeLocalToProto() {
if (viaProto) {
maybeInitBuilder();
}
mergeLocalToBuilder();
proto = builder.build();
viaProto = true;
}
private void maybeInitBuilder() {
if (viaProto || builder == null) {
builder = GetApplicationHomeSubClusterRequestProto.newBuilder(proto);
}
viaProto = false;
}
private void mergeLocalToBuilder() {
if (this.applicationId != null) {
builder.setApplicationId(convertToProtoFormat(this.applicationId));
}
}
@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 ApplicationId getApplicationId() {
GetApplicationHomeSubClusterRequestProtoOrBuilder p =
viaProto ? proto : builder;
if (!p.hasApplicationId()) {
return null;
}
this.applicationId = convertFromProtoFormat(p.getApplicationId());
return applicationId;
}
@Override
public void setApplicationId(ApplicationId applicationId) {
maybeInitBuilder();
if (applicationId == null) {
builder.clearApplicationId();
return;
}
this.applicationId = applicationId;
}
private ApplicationId convertFromProtoFormat(ApplicationIdProto appId) {
return new ApplicationIdPBImpl(appId);
}
private ApplicationIdProto convertToProtoFormat(ApplicationId appId) {
return ((ApplicationIdPBImpl) appId).getProto();
}
}

View File

@ -0,0 +1,132 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records.impl.pb;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.ApplicationHomeSubClusterProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationHomeSubClusterResponseProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationHomeSubClusterResponseProtoOrBuilder;
import org.apache.hadoop.yarn.server.federation.store.records.ApplicationHomeSubCluster;
import org.apache.hadoop.yarn.server.federation.store.records.GetApplicationHomeSubClusterResponse;
import com.google.protobuf.TextFormat;
/**
* Protocol buffer based implementation of
* {@link GetApplicationHomeSubClusterResponse}.
*/
@Private
@Unstable
public class GetApplicationHomeSubClusterResponsePBImpl
extends GetApplicationHomeSubClusterResponse {
private GetApplicationHomeSubClusterResponseProto proto =
GetApplicationHomeSubClusterResponseProto.getDefaultInstance();
private GetApplicationHomeSubClusterResponseProto.Builder builder = null;
private boolean viaProto = false;
public GetApplicationHomeSubClusterResponsePBImpl() {
builder = GetApplicationHomeSubClusterResponseProto.newBuilder();
}
public GetApplicationHomeSubClusterResponsePBImpl(
GetApplicationHomeSubClusterResponseProto proto) {
this.proto = proto;
viaProto = true;
}
public GetApplicationHomeSubClusterResponseProto getProto() {
mergeLocalToProto();
proto = viaProto ? proto : builder.build();
viaProto = true;
return proto;
}
private void mergeLocalToProto() {
if (viaProto) {
maybeInitBuilder();
}
mergeLocalToBuilder();
proto = builder.build();
viaProto = true;
}
private void maybeInitBuilder() {
if (viaProto || builder == null) {
builder = GetApplicationHomeSubClusterResponseProto.newBuilder(proto);
}
viaProto = false;
}
private void mergeLocalToBuilder() {
}
@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 ApplicationHomeSubCluster getApplicationHomeSubCluster() {
GetApplicationHomeSubClusterResponseProtoOrBuilder p =
viaProto ? proto : builder;
if (!p.hasAppSubclusterMap()) {
return null;
}
return convertFromProtoFormat(p.getAppSubclusterMap());
}
@Override
public void setApplicationHomeSubCluster(
ApplicationHomeSubCluster applicationInfo) {
maybeInitBuilder();
if (applicationInfo == null) {
builder.clearAppSubclusterMap();
return;
}
builder.setAppSubclusterMap(convertToProtoFormat(applicationInfo));
}
private ApplicationHomeSubCluster convertFromProtoFormat(
ApplicationHomeSubClusterProto sc) {
return new ApplicationHomeSubClusterPBImpl(sc);
}
private ApplicationHomeSubClusterProto convertToProtoFormat(
ApplicationHomeSubCluster sc) {
return ((ApplicationHomeSubClusterPBImpl) sc).getProto();
}
}

View File

@ -0,0 +1,78 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records.impl.pb;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationsHomeSubClusterRequestProto;
import org.apache.hadoop.yarn.server.federation.store.records.GetApplicationsHomeSubClusterRequest;
import com.google.protobuf.TextFormat;
/**
* Protocol buffer based implementation of
* {@link GetApplicationsHomeSubClusterRequest}.
*/
@Private
@Unstable
public class GetApplicationsHomeSubClusterRequestPBImpl
extends GetApplicationsHomeSubClusterRequest {
private GetApplicationsHomeSubClusterRequestProto proto =
GetApplicationsHomeSubClusterRequestProto.getDefaultInstance();
private GetApplicationsHomeSubClusterRequestProto.Builder builder = null;
private boolean viaProto = false;
public GetApplicationsHomeSubClusterRequestPBImpl() {
builder = GetApplicationsHomeSubClusterRequestProto.newBuilder();
}
public GetApplicationsHomeSubClusterRequestPBImpl(
GetApplicationsHomeSubClusterRequestProto proto) {
this.proto = proto;
viaProto = true;
}
public GetApplicationsHomeSubClusterRequestProto 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());
}
}

View File

@ -0,0 +1,190 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records.impl.pb;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.ApplicationHomeSubClusterProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationsHomeSubClusterResponseProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationsHomeSubClusterResponseProtoOrBuilder;
import org.apache.hadoop.yarn.server.federation.store.records.ApplicationHomeSubCluster;
import org.apache.hadoop.yarn.server.federation.store.records.GetApplicationsHomeSubClusterResponse;
import com.google.protobuf.TextFormat;
/**
* Protocol buffer based implementation of
* {@link GetApplicationsHomeSubClusterResponse}.
*/
@Private
@Unstable
public class GetApplicationsHomeSubClusterResponsePBImpl
extends GetApplicationsHomeSubClusterResponse {
private GetApplicationsHomeSubClusterResponseProto proto =
GetApplicationsHomeSubClusterResponseProto.getDefaultInstance();
private GetApplicationsHomeSubClusterResponseProto.Builder builder = null;
private boolean viaProto = false;
private List<ApplicationHomeSubCluster> appsHomeSubCluster;
public GetApplicationsHomeSubClusterResponsePBImpl() {
builder = GetApplicationsHomeSubClusterResponseProto.newBuilder();
}
public GetApplicationsHomeSubClusterResponsePBImpl(
GetApplicationsHomeSubClusterResponseProto proto) {
this.proto = proto;
viaProto = true;
}
public GetApplicationsHomeSubClusterResponseProto getProto() {
mergeLocalToProto();
proto = viaProto ? proto : builder.build();
viaProto = true;
return proto;
}
private void mergeLocalToProto() {
if (viaProto) {
maybeInitBuilder();
}
mergeLocalToBuilder();
proto = builder.build();
viaProto = true;
}
private void maybeInitBuilder() {
if (viaProto || builder == null) {
builder = GetApplicationsHomeSubClusterResponseProto.newBuilder(proto);
}
viaProto = false;
}
private void mergeLocalToBuilder() {
if (this.appsHomeSubCluster != null) {
addSubClustersInfoToProto();
}
}
@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 List<ApplicationHomeSubCluster> getAppsHomeSubClusters() {
initSubClustersInfoList();
return appsHomeSubCluster;
}
@Override
public void setAppsHomeSubClusters(
List<ApplicationHomeSubCluster> appsHomeSubClusters) {
maybeInitBuilder();
if (appsHomeSubClusters == null) {
builder.clearAppSubclusterMap();
return;
}
this.appsHomeSubCluster = appsHomeSubClusters;
}
private void initSubClustersInfoList() {
if (this.appsHomeSubCluster != null) {
return;
}
GetApplicationsHomeSubClusterResponseProtoOrBuilder p =
viaProto ? proto : builder;
List<ApplicationHomeSubClusterProto> subClusterInfosList =
p.getAppSubclusterMapList();
appsHomeSubCluster = new ArrayList<ApplicationHomeSubCluster>();
for (ApplicationHomeSubClusterProto r : subClusterInfosList) {
appsHomeSubCluster.add(convertFromProtoFormat(r));
}
}
private void addSubClustersInfoToProto() {
maybeInitBuilder();
builder.clearAppSubclusterMap();
if (appsHomeSubCluster == null) {
return;
}
Iterable<ApplicationHomeSubClusterProto> iterable =
new Iterable<ApplicationHomeSubClusterProto>() {
@Override
public Iterator<ApplicationHomeSubClusterProto> iterator() {
return new Iterator<ApplicationHomeSubClusterProto>() {
private Iterator<ApplicationHomeSubCluster> iter =
appsHomeSubCluster.iterator();
@Override
public boolean hasNext() {
return iter.hasNext();
}
@Override
public ApplicationHomeSubClusterProto next() {
return convertToProtoFormat(iter.next());
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
};
builder.addAllAppSubclusterMap(iterable);
}
private ApplicationHomeSubCluster convertFromProtoFormat(
ApplicationHomeSubClusterProto sc) {
return new ApplicationHomeSubClusterPBImpl(sc);
}
private ApplicationHomeSubClusterProto convertToProtoFormat(
ApplicationHomeSubCluster sc) {
return ((ApplicationHomeSubClusterPBImpl) sc).getProto();
}
}

View File

@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the * to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance * "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at * with the License. You may obtain a copy of the License at
* * <p>
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* * <p>
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

View File

@ -0,0 +1,132 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records.impl.pb;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.ApplicationHomeSubClusterProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.UpdateApplicationHomeSubClusterRequestProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.UpdateApplicationHomeSubClusterRequestProtoOrBuilder;
import org.apache.hadoop.yarn.server.federation.store.records.ApplicationHomeSubCluster;
import org.apache.hadoop.yarn.server.federation.store.records.UpdateApplicationHomeSubClusterRequest;
import com.google.protobuf.TextFormat;
/**
* Protocol buffer based implementation of
* {@link UpdateApplicationHomeSubClusterRequest} .
*/
@Private
@Unstable
public class UpdateApplicationHomeSubClusterRequestPBImpl
extends UpdateApplicationHomeSubClusterRequest {
private UpdateApplicationHomeSubClusterRequestProto proto =
UpdateApplicationHomeSubClusterRequestProto.getDefaultInstance();
private UpdateApplicationHomeSubClusterRequestProto.Builder builder = null;
private boolean viaProto = false;
public UpdateApplicationHomeSubClusterRequestPBImpl() {
builder = UpdateApplicationHomeSubClusterRequestProto.newBuilder();
}
public UpdateApplicationHomeSubClusterRequestPBImpl(
UpdateApplicationHomeSubClusterRequestProto proto) {
this.proto = proto;
viaProto = true;
}
public UpdateApplicationHomeSubClusterRequestProto getProto() {
mergeLocalToProto();
proto = viaProto ? proto : builder.build();
viaProto = true;
return proto;
}
private void mergeLocalToProto() {
if (viaProto) {
maybeInitBuilder();
}
mergeLocalToBuilder();
proto = builder.build();
viaProto = true;
}
private void maybeInitBuilder() {
if (viaProto || builder == null) {
builder = UpdateApplicationHomeSubClusterRequestProto.newBuilder(proto);
}
viaProto = false;
}
private void mergeLocalToBuilder() {
}
@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 ApplicationHomeSubCluster getApplicationHomeSubCluster() {
UpdateApplicationHomeSubClusterRequestProtoOrBuilder p =
viaProto ? proto : builder;
if (!p.hasAppSubclusterMap()) {
return null;
}
return convertFromProtoFormat(p.getAppSubclusterMap());
}
@Override
public void setApplicationHomeSubCluster(
ApplicationHomeSubCluster applicationInfo) {
maybeInitBuilder();
if (applicationInfo == null) {
builder.clearAppSubclusterMap();
return;
}
builder.setAppSubclusterMap(convertToProtoFormat(applicationInfo));
}
private ApplicationHomeSubCluster convertFromProtoFormat(
ApplicationHomeSubClusterProto sc) {
return new ApplicationHomeSubClusterPBImpl(sc);
}
private ApplicationHomeSubClusterProto convertToProtoFormat(
ApplicationHomeSubCluster sc) {
return ((ApplicationHomeSubClusterPBImpl) sc).getProto();
}
}

View File

@ -0,0 +1,78 @@
/**
* 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.store.records.impl.pb;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.UpdateApplicationHomeSubClusterResponseProto;
import org.apache.hadoop.yarn.server.federation.store.records.UpdateApplicationHomeSubClusterResponse;
import com.google.protobuf.TextFormat;
/**
* Protocol buffer based implementation of
* {@link UpdateApplicationHomeSubClusterResponse}.
*/
@Private
@Unstable
public class UpdateApplicationHomeSubClusterResponsePBImpl
extends UpdateApplicationHomeSubClusterResponse {
private UpdateApplicationHomeSubClusterResponseProto proto =
UpdateApplicationHomeSubClusterResponseProto.getDefaultInstance();
private UpdateApplicationHomeSubClusterResponseProto.Builder builder = null;
private boolean viaProto = false;
public UpdateApplicationHomeSubClusterResponsePBImpl() {
builder = UpdateApplicationHomeSubClusterResponseProto.newBuilder();
}
public UpdateApplicationHomeSubClusterResponsePBImpl(
UpdateApplicationHomeSubClusterResponseProto proto) {
this.proto = proto;
viaProto = true;
}
public UpdateApplicationHomeSubClusterResponseProto 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());
}
}

View File

@ -91,3 +91,46 @@ message GetSubClustersInfoRequestProto {
message GetSubClustersInfoResponseProto { message GetSubClustersInfoResponseProto {
repeated SubClusterInfoProto sub_cluster_infos = 1; repeated SubClusterInfoProto sub_cluster_infos = 1;
} }
message ApplicationHomeSubClusterProto {
optional ApplicationIdProto application_id = 1;
optional SubClusterIdProto home_sub_cluster = 2;
}
message AddApplicationHomeSubClusterRequestProto {
optional ApplicationHomeSubClusterProto app_subcluster_map = 1;
}
message AddApplicationHomeSubClusterResponseProto {
}
message UpdateApplicationHomeSubClusterRequestProto {
optional ApplicationHomeSubClusterProto app_subcluster_map = 1;
}
message UpdateApplicationHomeSubClusterResponseProto {
}
message GetApplicationHomeSubClusterRequestProto {
optional ApplicationIdProto application_id = 1;
}
message GetApplicationHomeSubClusterResponseProto {
optional ApplicationHomeSubClusterProto app_subcluster_map = 1;
}
message GetApplicationsHomeSubClusterRequestProto {
}
message GetApplicationsHomeSubClusterResponseProto {
repeated ApplicationHomeSubClusterProto app_subcluster_map = 1;
}
message DeleteApplicationHomeSubClusterRequestProto {
optional ApplicationIdProto application_id = 1;
}
message DeleteApplicationHomeSubClusterResponseProto {
}

View File

@ -19,6 +19,14 @@ package org.apache.hadoop.yarn.server.federation.store.records;
import org.apache.hadoop.yarn.api.BasePBImplRecordsTest; import org.apache.hadoop.yarn.api.BasePBImplRecordsTest;
import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.AddApplicationHomeSubClusterRequestProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.AddApplicationHomeSubClusterResponseProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.DeleteApplicationHomeSubClusterRequestProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.DeleteApplicationHomeSubClusterResponseProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationHomeSubClusterRequestProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationHomeSubClusterResponseProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationsHomeSubClusterRequestProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetApplicationsHomeSubClusterResponseProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetSubClusterInfoRequestProto; import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetSubClusterInfoRequestProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetSubClusterInfoResponseProto; import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetSubClusterInfoResponseProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetSubClustersInfoRequestProto; import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.GetSubClustersInfoRequestProto;
@ -31,6 +39,16 @@ import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.SubClu
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.SubClusterInfoProto; import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.SubClusterInfoProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.SubClusterRegisterRequestProto; import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.SubClusterRegisterRequestProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.SubClusterRegisterResponseProto; import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.SubClusterRegisterResponseProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.UpdateApplicationHomeSubClusterRequestProto;
import org.apache.hadoop.yarn.federation.proto.YarnServerFederationProtos.UpdateApplicationHomeSubClusterResponseProto;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.AddApplicationHomeSubClusterRequestPBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.AddApplicationHomeSubClusterResponsePBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.DeleteApplicationHomeSubClusterRequestPBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.DeleteApplicationHomeSubClusterResponsePBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.GetApplicationHomeSubClusterRequestPBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.GetApplicationHomeSubClusterResponsePBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.GetApplicationsHomeSubClusterRequestPBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.GetApplicationsHomeSubClusterResponsePBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.GetSubClusterInfoRequestPBImpl; import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.GetSubClusterInfoRequestPBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.GetSubClusterInfoResponsePBImpl; import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.GetSubClusterInfoResponsePBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.GetSubClustersInfoRequestPBImpl; import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.GetSubClustersInfoRequestPBImpl;
@ -43,6 +61,8 @@ import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.SubCluster
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.SubClusterInfoPBImpl; import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.SubClusterInfoPBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.SubClusterRegisterRequestPBImpl; import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.SubClusterRegisterRequestPBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.SubClusterRegisterResponsePBImpl; import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.SubClusterRegisterResponsePBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.UpdateApplicationHomeSubClusterRequestPBImpl;
import org.apache.hadoop.yarn.server.federation.store.records.impl.pb.UpdateApplicationHomeSubClusterResponsePBImpl;
import org.apache.hadoop.yarn.server.records.Version; import org.apache.hadoop.yarn.server.records.Version;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@ -58,6 +78,7 @@ public class TestFederationProtocolRecords extends BasePBImplRecordsTest {
generateByNewInstance(Version.class); generateByNewInstance(Version.class);
generateByNewInstance(SubClusterId.class); generateByNewInstance(SubClusterId.class);
generateByNewInstance(SubClusterInfo.class); generateByNewInstance(SubClusterInfo.class);
generateByNewInstance(ApplicationHomeSubCluster.class);
} }
@Test @Test
@ -130,4 +151,64 @@ public class TestFederationProtocolRecords extends BasePBImplRecordsTest {
GetSubClustersInfoResponseProto.class); GetSubClustersInfoResponseProto.class);
} }
@Test
public void testAddApplicationHomeSubClusterRequest() throws Exception {
validatePBImplRecord(AddApplicationHomeSubClusterRequestPBImpl.class,
AddApplicationHomeSubClusterRequestProto.class);
}
@Test
public void testAddApplicationHomeSubClusterResponse() throws Exception {
validatePBImplRecord(AddApplicationHomeSubClusterResponsePBImpl.class,
AddApplicationHomeSubClusterResponseProto.class);
}
@Test
public void testUpdateApplicationHomeSubClusterRequest() throws Exception {
validatePBImplRecord(UpdateApplicationHomeSubClusterRequestPBImpl.class,
UpdateApplicationHomeSubClusterRequestProto.class);
}
@Test
public void testUpdateApplicationHomeSubClusterResponse() throws Exception {
validatePBImplRecord(UpdateApplicationHomeSubClusterResponsePBImpl.class,
UpdateApplicationHomeSubClusterResponseProto.class);
}
@Test
public void testGetApplicationHomeSubClusterRequest() throws Exception {
validatePBImplRecord(GetApplicationHomeSubClusterRequestPBImpl.class,
GetApplicationHomeSubClusterRequestProto.class);
}
@Test
public void testGetApplicationHomeSubClusterResponse() throws Exception {
validatePBImplRecord(GetApplicationHomeSubClusterResponsePBImpl.class,
GetApplicationHomeSubClusterResponseProto.class);
}
@Test
public void testGetApplicationsHomeSubClusterRequest() throws Exception {
validatePBImplRecord(GetApplicationsHomeSubClusterRequestPBImpl.class,
GetApplicationsHomeSubClusterRequestProto.class);
}
@Test
public void testGetApplicationsHomeSubClusterResponse() throws Exception {
validatePBImplRecord(GetApplicationsHomeSubClusterResponsePBImpl.class,
GetApplicationsHomeSubClusterResponseProto.class);
}
@Test
public void testDeleteApplicationHomeSubClusterRequest() throws Exception {
validatePBImplRecord(DeleteApplicationHomeSubClusterRequestPBImpl.class,
DeleteApplicationHomeSubClusterRequestProto.class);
}
@Test
public void testDeleteApplicationHomeSubClusterResponse() throws Exception {
validatePBImplRecord(DeleteApplicationHomeSubClusterResponsePBImpl.class,
DeleteApplicationHomeSubClusterResponseProto.class);
}
} }