repo
stringlengths 1
191
⌀ | file
stringlengths 23
351
| code
stringlengths 0
5.32M
| file_length
int64 0
5.32M
| avg_line_length
float64 0
2.9k
| max_line_length
int64 0
288k
| extension_type
stringclasses 1
value |
---|---|---|---|---|---|---|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ClientSCMProtocolPB.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api;
import org.apache.hadoop.ipc.ProtocolInfo;
import org.apache.hadoop.yarn.proto.ClientSCMProtocol.ClientSCMProtocolService;
@ProtocolInfo(protocolName = "org.apache.hadoop.yarn.api.ClientSCMProtocolPB",
protocolVersion = 1)
public interface ClientSCMProtocolPB extends
ClientSCMProtocolService.BlockingInterface {
}
| 1,169 | 39.344828 | 79 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ContainerManagementProtocol.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api;
import java.io.IOException;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesRequest;
import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusesResponse;
import org.apache.hadoop.yarn.api.protocolrecords.StartContainerRequest;
import org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest;
import org.apache.hadoop.yarn.api.protocolrecords.StartContainersResponse;
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersRequest;
import org.apache.hadoop.yarn.api.protocolrecords.StopContainersResponse;
import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
import org.apache.hadoop.yarn.api.records.ContainerStatus;
import org.apache.hadoop.yarn.exceptions.NMNotYetReadyException;
import org.apache.hadoop.yarn.exceptions.YarnException;
/**
* <p>The protocol between an <code>ApplicationMaster</code> and a
* <code>NodeManager</code> to start/stop containers and to get status
* of running containers.</p>
*
* <p>If security is enabled the <code>NodeManager</code> verifies that the
* <code>ApplicationMaster</code> has truly been allocated the container
* by the <code>ResourceManager</code> and also verifies all interactions such
* as stopping the container or obtaining status information for the container.
* </p>
*/
@Public
@Stable
public interface ContainerManagementProtocol {
/**
* <p>
* The <code>ApplicationMaster</code> provides a list of
* {@link StartContainerRequest}s to a <code>NodeManager</code> to
* <em>start</em> {@link Container}s allocated to it using this interface.
* </p>
*
* <p>
* The <code>ApplicationMaster</code> has to provide details such as allocated
* resource capability, security tokens (if enabled), command to be executed
* to start the container, environment for the process, necessary
* binaries/jar/shared-objects etc. via the {@link ContainerLaunchContext} in
* the {@link StartContainerRequest}.
* </p>
*
* <p>
* The <code>NodeManager</code> sends a response via
* {@link StartContainersResponse} which includes a list of
* {@link Container}s of successfully launched {@link Container}s, a
* containerId-to-exception map for each failed {@link StartContainerRequest} in
* which the exception indicates errors from per container and a
* allServicesMetaData map between the names of auxiliary services and their
* corresponding meta-data. Note: None-container-specific exceptions will
* still be thrown by the API method itself.
* </p>
* <p>
* The <code>ApplicationMaster</code> can use
* {@link #getContainerStatuses(GetContainerStatusesRequest)} to get updated
* statuses of the to-be-launched or launched containers.
* </p>
*
* @param request
* request to start a list of containers
* @return response including conatinerIds of all successfully launched
* containers, a containerId-to-exception map for failed requests and
* a allServicesMetaData map.
* @throws YarnException
* @throws IOException
* @throws NMNotYetReadyException
* This exception is thrown when NM starts from scratch but has not
* yet connected with RM.
*/
@Public
@Stable
StartContainersResponse startContainers(StartContainersRequest request)
throws YarnException, IOException;
/**
* <p>
* The <code>ApplicationMaster</code> requests a <code>NodeManager</code> to
* <em>stop</em> a list of {@link Container}s allocated to it using this
* interface.
* </p>
*
* <p>
* The <code>ApplicationMaster</code> sends a {@link StopContainersRequest}
* which includes the {@link ContainerId}s of the containers to be stopped.
* </p>
*
* <p>
* The <code>NodeManager</code> sends a response via
* {@link StopContainersResponse} which includes a list of {@link ContainerId}
* s of successfully stopped containers, a containerId-to-exception map for
* each failed request in which the exception indicates errors from per
* container. Note: None-container-specific exceptions will still be thrown by
* the API method itself. <code>ApplicationMaster</code> can use
* {@link #getContainerStatuses(GetContainerStatusesRequest)} to get updated
* statuses of the containers.
* </p>
*
* @param request
* request to stop a list of containers
* @return response which includes a list of containerIds of successfully
* stopped containers, a containerId-to-exception map for failed
* requests.
* @throws YarnException
* @throws IOException
*/
@Public
@Stable
StopContainersResponse stopContainers(StopContainersRequest request)
throws YarnException, IOException;
/**
* <p>
* The API used by the <code>ApplicationMaster</code> to request for current
* statuses of <code>Container</code>s from the <code>NodeManager</code>.
* </p>
*
* <p>
* The <code>ApplicationMaster</code> sends a
* {@link GetContainerStatusesRequest} which includes the {@link ContainerId}s
* of all containers whose statuses are needed.
* </p>
*
* <p>
* The <code>NodeManager</code> responds with
* {@link GetContainerStatusesResponse} which includes a list of
* {@link ContainerStatus} of the successfully queried containers and a
* containerId-to-exception map for each failed request in which the exception
* indicates errors from per container. Note: None-container-specific
* exceptions will still be thrown by the API method itself.
* </p>
*
* @param request
* request to get <code>ContainerStatus</code>es of containers with
* the specified <code>ContainerId</code>s
* @return response containing the list of <code>ContainerStatus</code> of the
* successfully queried containers and a containerId-to-exception map
* for failed requests.
*
* @throws YarnException
* @throws IOException
*/
@Public
@Stable
GetContainerStatusesResponse getContainerStatuses(
GetContainerStatusesRequest request) throws YarnException,
IOException;
}
| 7,212 | 40.454023 | 82 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ApplicationMasterProtocol.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api;
import java.io.IOException;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.io.retry.AtMostOnce;
import org.apache.hadoop.io.retry.Idempotent;
import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest;
import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterResponse;
import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterResponse;
import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.exceptions.InvalidApplicationMasterRequestException;
import org.apache.hadoop.yarn.exceptions.InvalidResourceBlacklistRequestException;
import org.apache.hadoop.yarn.exceptions.InvalidResourceRequestException;
import org.apache.hadoop.yarn.exceptions.YarnException;
/**
* <p>The protocol between a live instance of <code>ApplicationMaster</code>
* and the <code>ResourceManager</code>.</p>
*
* <p>This is used by the <code>ApplicationMaster</code> to register/unregister
* and to request and obtain resources in the cluster from the
* <code>ResourceManager</code>.</p>
*/
@Public
@Stable
public interface ApplicationMasterProtocol {
/**
* <p>
* The interface used by a new <code>ApplicationMaster</code> to register with
* the <code>ResourceManager</code>.
* </p>
*
* <p>
* The <code>ApplicationMaster</code> needs to provide details such as RPC
* Port, HTTP tracking url etc. as specified in
* {@link RegisterApplicationMasterRequest}.
* </p>
*
* <p>
* The <code>ResourceManager</code> responds with critical details such as
* maximum resource capabilities in the cluster as specified in
* {@link RegisterApplicationMasterResponse}.
* </p>
*
* @param request
* registration request
* @return registration respose
* @throws YarnException
* @throws IOException
* @throws InvalidApplicationMasterRequestException
* The exception is thrown when an ApplicationMaster tries to
* register more then once.
* @see RegisterApplicationMasterRequest
* @see RegisterApplicationMasterResponse
*/
@Public
@Stable
@Idempotent
public RegisterApplicationMasterResponse registerApplicationMaster(
RegisterApplicationMasterRequest request)
throws YarnException, IOException;
/**
* <p>The interface used by an <code>ApplicationMaster</code> to notify the
* <code>ResourceManager</code> about its completion (success or failed).</p>
*
* <p>The <code>ApplicationMaster</code> has to provide details such as
* final state, diagnostics (in case of failures) etc. as specified in
* {@link FinishApplicationMasterRequest}.</p>
*
* <p>The <code>ResourceManager</code> responds with
* {@link FinishApplicationMasterResponse}.</p>
*
* @param request completion request
* @return completion response
* @throws YarnException
* @throws IOException
* @see FinishApplicationMasterRequest
* @see FinishApplicationMasterResponse
*/
@Public
@Stable
@AtMostOnce
public FinishApplicationMasterResponse finishApplicationMaster(
FinishApplicationMasterRequest request)
throws YarnException, IOException;
/**
* <p>
* The main interface between an <code>ApplicationMaster</code> and the
* <code>ResourceManager</code>.
* </p>
*
* <p>
* The <code>ApplicationMaster</code> uses this interface to provide a list of
* {@link ResourceRequest} and returns unused {@link Container} allocated to
* it via {@link AllocateRequest}. Optionally, the
* <code>ApplicationMaster</code> can also <em>blacklist</em> resources which
* it doesn't want to use.
* </p>
*
* <p>
* This also doubles up as a <em>heartbeat</em> to let the
* <code>ResourceManager</code> know that the <code>ApplicationMaster</code>
* is alive. Thus, applications should periodically make this call to be kept
* alive. The frequency depends on
* {@link YarnConfiguration#RM_AM_EXPIRY_INTERVAL_MS} which defaults to
* {@link YarnConfiguration#DEFAULT_RM_AM_EXPIRY_INTERVAL_MS}.
* </p>
*
* <p>
* The <code>ResourceManager</code> responds with list of allocated
* {@link Container}, status of completed containers and headroom information
* for the application.
* </p>
*
* <p>
* The <code>ApplicationMaster</code> can use the available headroom
* (resources) to decide how to utilized allocated resources and make informed
* decisions about future resource requests.
* </p>
*
* @param request
* allocation request
* @return allocation response
* @throws YarnException
* @throws IOException
* @throws InvalidApplicationMasterRequestException
* This exception is thrown when an ApplicationMaster calls allocate
* without registering first.
* @throws InvalidResourceBlacklistRequestException
* This exception is thrown when an application provides an invalid
* specification for blacklist of resources.
* @throws InvalidResourceRequestException
* This exception is thrown when a {@link ResourceRequest} is out of
* the range of the configured lower and upper limits on the
* resources.
* @see AllocateRequest
* @see AllocateResponse
*/
@Public
@Stable
@AtMostOnce
public AllocateResponse allocate(AllocateRequest request)
throws YarnException, IOException;
}
| 6,711 | 37.797688 | 84 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/ClientSCMProtocol.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api;
import java.io.IOException;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.protocolrecords.ReleaseSharedCacheResourceRequest;
import org.apache.hadoop.yarn.api.protocolrecords.ReleaseSharedCacheResourceResponse;
import org.apache.hadoop.yarn.api.protocolrecords.UseSharedCacheResourceRequest;
import org.apache.hadoop.yarn.api.protocolrecords.UseSharedCacheResourceResponse;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.exceptions.YarnException;
/**
* <p>
* The protocol between clients and the <code>SharedCacheManager</code> to claim
* and release resources in the shared cache.
* </p>
*/
@Public
@Unstable
public interface ClientSCMProtocol {
/**
* <p>
* The interface used by clients to claim a resource with the
* <code>SharedCacheManager.</code> The client uses a checksum to identify the
* resource and an {@link ApplicationId} to identify which application will be
* using the resource.
* </p>
*
* <p>
* The <code>SharedCacheManager</code> responds with whether or not the
* resource exists in the cache. If the resource exists, a <code>Path</code>
* to the resource in the shared cache is returned. If the resource does not
* exist, the response is empty.
* </p>
*
* @param request request to claim a resource in the shared cache
* @return response indicating if the resource is already in the cache
* @throws YarnException
* @throws IOException
*/
public UseSharedCacheResourceResponse use(
UseSharedCacheResourceRequest request) throws YarnException, IOException;
/**
* <p>
* The interface used by clients to release a resource with the
* <code>SharedCacheManager.</code> This method is called once an application
* is no longer using a claimed resource in the shared cache. The client uses
* a checksum to identify the resource and an {@link ApplicationId} to
* identify which application is releasing the resource.
* </p>
*
* <p>
* Note: This method is an optimization and the client is not required to call
* it for correctness.
* </p>
*
* <p>
* Currently the <code>SharedCacheManager</code> sends an empty response.
* </p>
*
* @param request request to release a resource in the shared cache
* @return (empty) response on releasing the resource
* @throws YarnException
* @throws IOException
*/
public ReleaseSharedCacheResourceResponse release(
ReleaseSharedCacheResourceRequest request) throws YarnException, IOException;
}
| 3,501 | 37.483516 | 85 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueInfoResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.records.QueueInfo;
import org.apache.hadoop.yarn.util.Records;
/**
* The response sent by the {@code ResourceManager} to a client
* requesting information about queues in the system.
* <p>
* The response includes a {@link QueueInfo} which has details such as
* queue name, used/total capacities, running applications, child queues etc.
*
* @see QueueInfo
* @see ApplicationClientProtocol#getQueueInfo(GetQueueInfoRequest)
*/
@Public
@Stable
public abstract class GetQueueInfoResponse {
@Private
@Unstable
public static GetQueueInfoResponse newInstance(QueueInfo queueInfo) {
GetQueueInfoResponse response = Records.newRecord(GetQueueInfoResponse.class);
response.setQueueInfo(queueInfo);
return response;
}
/**
* Get the <code>QueueInfo</code> for the specified queue.
* @return <code>QueueInfo</code> for the specified queue
*/
@Public
@Stable
public abstract QueueInfo getQueueInfo();
@Private
@Unstable
public abstract void setQueueInfo(QueueInfo queueInfo);
}
| 2,248 | 34.698413 | 82 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/MoveApplicationAcrossQueuesResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The response sent by the <code>ResourceManager</code> to the client moving
* a submitted application to a different queue.
* </p>
* <p>
* A response without exception means that the move has completed successfully.
* </p>
*
* @see ApplicationClientProtocol#moveApplicationAcrossQueues(MoveApplicationAcrossQueuesRequest)
*/
@Public
@Unstable
public class MoveApplicationAcrossQueuesResponse {
@Private
@Unstable
public MoveApplicationAcrossQueuesResponse newInstance() {
MoveApplicationAcrossQueuesResponse response =
Records.newRecord(MoveApplicationAcrossQueuesResponse.class);
return response;
}
}
| 1,816 | 36.854167 | 97 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetApplicationsRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.EnumSet;
import java.util.Set;
import org.apache.commons.lang.math.LongRange;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The request from clients to get a report of Applications
* in the cluster from the <code>ResourceManager</code>.</p>
*
* @see ApplicationClientProtocol#getApplications(GetApplicationsRequest)
*/
@Public
@Stable
public abstract class GetApplicationsRequest {
@Public
@Stable
public static GetApplicationsRequest newInstance() {
GetApplicationsRequest request =
Records.newRecord(GetApplicationsRequest.class);
return request;
}
/**
* <p>
* The request from clients to get a report of Applications matching the
* giving application types in the cluster from the
* <code>ResourceManager</code>.
* </p>
*
* @see ApplicationClientProtocol#getApplications(GetApplicationsRequest)
*
* <p>Setting any of the parameters to null, would just disable that
* filter</p>
*
* @param scope {@link ApplicationsRequestScope} to filter by
* @param users list of users to filter by
* @param queues list of scheduler queues to filter by
* @param applicationTypes types of applications
* @param applicationTags application tags to filter by
* @param applicationStates application states to filter by
* @param startRange range of application start times to filter by
* @param finishRange range of application finish times to filter by
* @param limit number of applications to limit to
* @return {@link GetApplicationsRequest} to be used with
* {@link ApplicationClientProtocol#getApplications(GetApplicationsRequest)}
*/
@Public
@Stable
public static GetApplicationsRequest newInstance(
ApplicationsRequestScope scope,
Set<String> users,
Set<String> queues,
Set<String> applicationTypes,
Set<String> applicationTags,
EnumSet<YarnApplicationState> applicationStates,
LongRange startRange,
LongRange finishRange,
Long limit) {
GetApplicationsRequest request =
Records.newRecord(GetApplicationsRequest.class);
if (scope != null) {
request.setScope(scope);
}
request.setUsers(users);
request.setQueues(queues);
request.setApplicationTypes(applicationTypes);
request.setApplicationTags(applicationTags);
request.setApplicationStates(applicationStates);
if (startRange != null) {
request.setStartRange(
startRange.getMinimumLong(), startRange.getMaximumLong());
}
if (finishRange != null) {
request.setFinishRange(
finishRange.getMinimumLong(), finishRange.getMaximumLong());
}
if (limit != null) {
request.setLimit(limit);
}
return request;
}
/**
* <p>
* The request from clients to get a report of Applications matching the
* giving application types in the cluster from the
* <code>ResourceManager</code>.
* </p>
*
* @param scope {@link ApplicationsRequestScope} to filter by
* @see ApplicationClientProtocol#getApplications(GetApplicationsRequest)
*/
@Public
@Stable
public static GetApplicationsRequest newInstance(
ApplicationsRequestScope scope) {
GetApplicationsRequest request =
Records.newRecord(GetApplicationsRequest.class);
request.setScope(scope);
return request;
}
/**
* <p>
* The request from clients to get a report of Applications matching the
* giving application types in the cluster from the
* <code>ResourceManager</code>.
* </p>
*
*
* @see ApplicationClientProtocol#getApplications(GetApplicationsRequest)
*/
@Public
@Stable
public static GetApplicationsRequest
newInstance(Set<String> applicationTypes) {
GetApplicationsRequest request =
Records.newRecord(GetApplicationsRequest.class);
request.setApplicationTypes(applicationTypes);
return request;
}
/**
* <p>
* The request from clients to get a report of Applications matching the
* giving application states in the cluster from the
* <code>ResourceManager</code>.
* </p>
*
*
* @see ApplicationClientProtocol#getApplications(GetApplicationsRequest)
*/
@Public
@Stable
public static GetApplicationsRequest newInstance(
EnumSet<YarnApplicationState> applicationStates) {
GetApplicationsRequest request =
Records.newRecord(GetApplicationsRequest.class);
request.setApplicationStates(applicationStates);
return request;
}
/**
* <p>
* The request from clients to get a report of Applications matching the
* giving and application types and application types in the cluster from the
* <code>ResourceManager</code>.
* </p>
*
*
* @see ApplicationClientProtocol#getApplications(GetApplicationsRequest)
*/
@Public
@Stable
public static GetApplicationsRequest newInstance(
Set<String> applicationTypes,
EnumSet<YarnApplicationState> applicationStates) {
GetApplicationsRequest request =
Records.newRecord(GetApplicationsRequest.class);
request.setApplicationTypes(applicationTypes);
request.setApplicationStates(applicationStates);
return request;
}
/**
* Get the application types to filter applications on
*
* @return Set of Application Types to filter on
*/
@Public
@Stable
public abstract Set<String> getApplicationTypes();
/**
* Set the application types to filter applications on
*
* @param applicationTypes
* A Set of Application Types to filter on.
* If not defined, match all applications
*/
@Private
@Unstable
public abstract void
setApplicationTypes(Set<String> applicationTypes);
/**
* Get the application states to filter applications on
*
* @return Set of Application states to filter on
*/
@Public
@Stable
public abstract EnumSet<YarnApplicationState> getApplicationStates();
/**
* Set the application states to filter applications on
*
* @param applicationStates
* A Set of Application states to filter on.
* If not defined, match all running applications
*/
@Private
@Unstable
public abstract void
setApplicationStates(EnumSet<YarnApplicationState> applicationStates);
/**
* Set the application states to filter applications on
*
* @param applicationStates all lower-case string representation of the
* application states to filter on
*/
@Private
@Unstable
public abstract void setApplicationStates(Set<String> applicationStates);
/**
* Get the users to filter applications on
*
* @return set of users to filter applications on
*/
@Private
@Unstable
public abstract Set<String> getUsers();
/**
* Set the users to filter applications on
*
* @param users set of users to filter applications on
*/
@Private
@Unstable
public abstract void setUsers(Set<String> users);
/**
* Get the queues to filter applications on
*
* @return set of queues to filter applications on
*/
@Private
@Unstable
public abstract Set<String> getQueues();
/**
* Set the queue to filter applications on
*
* @param queue user to filter applications on
*/
@Private
@Unstable
public abstract void setQueues(Set<String> queue);
/**
* Get the limit on the number applications to return
*
* @return number of applications to limit to
*/
@Private
@Unstable
public abstract long getLimit();
/**
* Limit the number applications to return
*
* @param limit number of applications to limit to
*/
@Private
@Unstable
public abstract void setLimit(long limit);
/**
* Get the range of start times to filter applications on
*
* @return {@link LongRange} of start times to filter applications on
*/
@Private
@Unstable
public abstract LongRange getStartRange();
/**
* Set the range of start times to filter applications on
*
* @param range
*/
@Private
@Unstable
public abstract void setStartRange(LongRange range);
/**
* Set the range of start times to filter applications on
*
* @param begin beginning of the range
* @param end end of the range
* @throws IllegalArgumentException
*/
@Private
@Unstable
public abstract void setStartRange(long begin, long end)
throws IllegalArgumentException;
/**
* Get the range of finish times to filter applications on
*
* @return {@link LongRange} of finish times to filter applications on
*/
@Private
@Unstable
public abstract LongRange getFinishRange();
/**
* Set the range of finish times to filter applications on
*
* @param range
*/
@Private
@Unstable
public abstract void setFinishRange(LongRange range);
/**
* Set the range of finish times to filter applications on
*
* @param begin beginning of the range
* @param end end of the range
* @throws IllegalArgumentException
*/
@Private
@Unstable
public abstract void setFinishRange(long begin, long end);
/**
* Get the tags to filter applications on
*
* @return list of tags to filter on
*/
@Private
@Unstable
public abstract Set<String> getApplicationTags();
/**
* Set the list of tags to filter applications on
*
* @param tags list of tags to filter on
*/
@Private
@Unstable
public abstract void setApplicationTags(Set<String> tags);
/**
* Get the {@link ApplicationsRequestScope} of applications to be filtered.
*
* @return {@link ApplicationsRequestScope} of applications to return.
*/
@Private
@Unstable
public abstract ApplicationsRequestScope getScope();
/**
* Set the {@link ApplicationsRequestScope} of applications to filter.
*
* @param scope scope to use for filtering applications
*/
@Private
@Unstable
public abstract void setScope(ApplicationsRequestScope scope);
}
| 11,132 | 27.328244 | 79 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/SubmitApplicationResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The response sent by the <code>ResourceManager</code> to a client on
* application submission.</p>
*
* <p>Currently, this is empty.</p>
*
* @see ApplicationClientProtocol#submitApplication(SubmitApplicationRequest)
*/
@Public
@Stable
public abstract class SubmitApplicationResponse {
@Private
@Unstable
public static SubmitApplicationResponse newInstance() {
SubmitApplicationResponse response =
Records.newRecord(SubmitApplicationResponse.class);
return response;
}
}
| 1,747 | 36.191489 | 77 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainersRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The request which contains a list of {@link StartContainerRequest} sent by
* the <code>ApplicationMaster</code> to the <code>NodeManager</code> to
* <em>start</em> containers.
* </p>
*
* <p>
* In each {@link StartContainerRequest}, the <code>ApplicationMaster</code> has
* to provide details such as allocated resource capability, security tokens (if
* enabled), command to be executed to start the container, environment for the
* process, necessary binaries/jar/shared-objects etc. via the
* {@link ContainerLaunchContext}.
* </p>
*
* @see ContainerManagementProtocol#startContainers(StartContainersRequest)
*/
@Public
@Stable
public abstract class StartContainersRequest {
@Public
@Stable
public static StartContainersRequest newInstance(
List<StartContainerRequest> requests) {
StartContainersRequest request =
Records.newRecord(StartContainersRequest.class);
request.setStartContainerRequests(requests);
return request;
}
/**
* Get a list of {@link StartContainerRequest} to start containers.
* @return a list of {@link StartContainerRequest} to start containers.
*/
@Public
@Stable
public abstract List<StartContainerRequest> getStartContainerRequests();
/**
* Set a list of {@link StartContainerRequest} to start containers.
* @param request a list of {@link StartContainerRequest} to start containers
*/
@Public
@Stable
public abstract void setStartContainerRequests(
List<StartContainerRequest> request);
}
| 2,715 | 34.272727 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainersResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
import org.apache.hadoop.yarn.api.records.ContainerReport;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The response sent by the <code>ResourceManager</code> to a client requesting
* a list of {@link ContainerReport} for containers.
* </p>
*
* <p>
* The <code>ContainerReport</code> for each container includes the container
* details.
* </p>
*
* @see ContainerReport
* @see ApplicationHistoryProtocol#getContainers(GetContainersRequest)
*/
@Public
@Unstable
public abstract class GetContainersResponse {
@Public
@Unstable
public static GetContainersResponse newInstance(
List<ContainerReport> containers) {
GetContainersResponse response =
Records.newRecord(GetContainersResponse.class);
response.setContainerList(containers);
return response;
}
/**
* Get a list of <code>ContainerReport</code> for all the containers of an
* application attempt.
*
* @return a list of <code>ContainerReport</code> for all the containers of an
* application attempt
*
*/
@Public
@Unstable
public abstract List<ContainerReport> getContainerList();
/**
* Set a list of <code>ContainerReport</code> for all the containers of an
* application attempt.
*
* @param containers
* a list of <code>ContainerReport</code> for all the containers of
* an application attempt
*
*/
@Public
@Unstable
public abstract void setContainerList(List<ContainerReport> containers);
}
| 2,581 | 30.487805 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/package-info.java
|
/*
* 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.
*/
@InterfaceAudience.Public
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience;
| 944 | 41.954545 | 75 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ApplicationsRequestScope.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
/**
* Enumeration that controls the scope of applications fetched
*/
@InterfaceAudience.Public
@InterfaceStability.Unstable
public enum ApplicationsRequestScope {
/** All jobs */
ALL,
/** Jobs viewable by current user */
VIEWABLE,
/** Jobs owned by current user */
OWN
}
| 1,268 | 31.538462 | 75 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetDelegationTokenResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.security.token.delegation.AbstractDelegationTokenIdentifier;
import org.apache.hadoop.yarn.api.records.Token;
import org.apache.hadoop.yarn.util.Records;
/**
* Response to a {@link GetDelegationTokenRequest} request
* from the client. The response contains the token that
* can be used by the containers to talk to ClientRMService.
*
*/
@Public
@Stable
public abstract class GetDelegationTokenResponse {
@Private
@Unstable
public static GetDelegationTokenResponse newInstance(Token rmDTToken) {
GetDelegationTokenResponse response =
Records.newRecord(GetDelegationTokenResponse.class);
response.setRMDelegationToken(rmDTToken);
return response;
}
/**
* The Delegation tokens have a identifier which maps to
* {@link AbstractDelegationTokenIdentifier}.
*
*/
@Public
@Stable
public abstract Token getRMDelegationToken();
@Private
@Unstable
public abstract void setRMDelegationToken(Token rmDTToken);
}
| 2,122 | 33.241935 | 85 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/KillApplicationResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.util.Records;
/**
* The response sent by the <code>ResourceManager</code> to the client aborting
* a submitted application.
* <p>
* The response, includes:
* <ul>
* <li>
* A flag which indicates that the process of killing the application is
* completed or not.
* </li>
* </ul>
* Note: user is recommended to wait until this flag becomes true, otherwise if
* the <code>ResourceManager</code> crashes before the process of killing the
* application is completed, the <code>ResourceManager</code> may retry this
* application on recovery.
*
* @see ApplicationClientProtocol#forceKillApplication(KillApplicationRequest)
*/
@Public
@Stable
public abstract class KillApplicationResponse {
@Private
@Unstable
public static KillApplicationResponse newInstance(boolean isKillCompleted) {
KillApplicationResponse response =
Records.newRecord(KillApplicationResponse.class);
response.setIsKillCompleted(isKillCompleted);
return response;
}
/**
* Get the flag which indicates that the process of killing application is completed or not.
*/
@Public
@Stable
public abstract boolean getIsKillCompleted();
/**
* Set the flag which indicates that the process of killing application is completed or not.
*/
@Private
@Unstable
public abstract void setIsKillCompleted(boolean isKillCompleted);
}
| 2,587 | 34.944444 | 94 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/RegisterApplicationMasterResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.nio.ByteBuffer;
import java.util.EnumSet;
import java.util.List;
import java.util.Map;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationAccessType;
import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.NMToken;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.proto.YarnServiceProtos.SchedulerResourceTypes;
import org.apache.hadoop.yarn.util.Records;
/**
* The response sent by the {@code ResourceManager} to a new
* {@code ApplicationMaster} on registration.
* <p>
* The response contains critical details such as:
* <ul>
* <li>Maximum capability for allocated resources in the cluster.</li>
* <li>{@code ApplicationACL}s for the application.</li>
* <li>ClientToAMToken master key.</li>
* </ul>
*
* @see ApplicationMasterProtocol#registerApplicationMaster(RegisterApplicationMasterRequest)
*/
@Public
@Stable
public abstract class RegisterApplicationMasterResponse {
@Private
@Unstable
public static RegisterApplicationMasterResponse newInstance(
Resource minCapability, Resource maxCapability,
Map<ApplicationAccessType, String> acls, ByteBuffer key,
List<Container> containersFromPreviousAttempt, String queue,
List<NMToken> nmTokensFromPreviousAttempts) {
RegisterApplicationMasterResponse response =
Records.newRecord(RegisterApplicationMasterResponse.class);
response.setMaximumResourceCapability(maxCapability);
response.setApplicationACLs(acls);
response.setClientToAMTokenMasterKey(key);
response.setContainersFromPreviousAttempts(containersFromPreviousAttempt);
response.setNMTokensFromPreviousAttempts(nmTokensFromPreviousAttempts);
response.setQueue(queue);
return response;
}
/**
* Get the maximum capability for any {@link Resource} allocated by the
* <code>ResourceManager</code> in the cluster.
* @return maximum capability of allocated resources in the cluster
*/
@Public
@Stable
public abstract Resource getMaximumResourceCapability();
@Private
@Unstable
public abstract void setMaximumResourceCapability(Resource capability);
/**
* Get the <code>ApplicationACL</code>s for the application.
* @return all the <code>ApplicationACL</code>s
*/
@Public
@Stable
public abstract Map<ApplicationAccessType, String> getApplicationACLs();
/**
* Set the <code>ApplicationACL</code>s for the application.
* @param acls
*/
@Private
@Unstable
public abstract void setApplicationACLs(Map<ApplicationAccessType, String> acls);
/**
* <p>Get ClientToAMToken master key.</p>
* <p>The ClientToAMToken master key is sent to <code>ApplicationMaster</code>
* by <code>ResourceManager</code> via {@link RegisterApplicationMasterResponse}
* , used to verify corresponding ClientToAMToken.</p>
*/
@Public
@Stable
public abstract ByteBuffer getClientToAMTokenMasterKey();
/**
* Set ClientToAMToken master key.
*/
@Public
@Stable
public abstract void setClientToAMTokenMasterKey(ByteBuffer key);
/**
* <p>Get the queue that the application was placed in.<p>
*/
@Public
@Stable
public abstract String getQueue();
/**
* <p>Set the queue that the application was placed in.<p>
*/
@Public
@Stable
public abstract void setQueue(String queue);
/**
* <p>
* Get the list of running containers as viewed by
* <code>ResourceManager</code> from previous application attempts.
* </p>
*
* @return the list of running containers as viewed by
* <code>ResourceManager</code> from previous application attempts
* @see RegisterApplicationMasterResponse#getNMTokensFromPreviousAttempts()
*/
@Public
@Unstable
public abstract List<Container> getContainersFromPreviousAttempts();
/**
* Set the list of running containers as viewed by
* <code>ResourceManager</code> from previous application attempts.
*
* @param containersFromPreviousAttempt
* the list of running containers as viewed by
* <code>ResourceManager</code> from previous application attempts.
*/
@Private
@Unstable
public abstract void setContainersFromPreviousAttempts(
List<Container> containersFromPreviousAttempt);
/**
* Get the list of NMTokens for communicating with the NMs where the
* containers of previous application attempts are running.
*
* @return the list of NMTokens for communicating with the NMs where the
* containers of previous application attempts are running.
*
* @see RegisterApplicationMasterResponse#getContainersFromPreviousAttempts()
*/
@Public
@Stable
public abstract List<NMToken> getNMTokensFromPreviousAttempts();
/**
* Set the list of NMTokens for communicating with the NMs where the the
* containers of previous application attempts are running.
*
* @param nmTokens
* the list of NMTokens for communicating with the NMs where the
* containers of previous application attempts are running.
*/
@Private
@Unstable
public abstract void setNMTokensFromPreviousAttempts(List<NMToken> nmTokens);
/**
* Get a set of the resource types considered by the scheduler.
*
* @return a Map of RM settings
*/
@Public
@Unstable
public abstract EnumSet<SchedulerResourceTypes> getSchedulerResourceTypes();
/**
* Set the resource types used by the scheduler.
*
* @param types
* a set of the resource types that the scheduler considers during
* scheduling
*/
@Private
@Unstable
public abstract void setSchedulerResourceTypes(
EnumSet<SchedulerResourceTypes> types);
}
| 6,896 | 32.480583 | 93 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
import org.apache.hadoop.yarn.api.records.AMCommand;
import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.ContainerResourceDecrease;
import org.apache.hadoop.yarn.api.records.ContainerResourceIncrease;
import org.apache.hadoop.yarn.api.records.ContainerStatus;
import org.apache.hadoop.yarn.api.records.NMToken;
import org.apache.hadoop.yarn.api.records.NodeReport;
import org.apache.hadoop.yarn.api.records.PreemptionMessage;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.api.records.Token;
import org.apache.hadoop.yarn.util.Records;
/**
* The response sent by the <code>ResourceManager</code> the
* <code>ApplicationMaster</code> during resource negotiation.
* <p>
* The response, includes:
* <ul>
* <li>Response ID to track duplicate responses.</li>
* <li>
* An AMCommand sent by ResourceManager to let the
* {@code ApplicationMaster} take some actions (resync, shutdown etc.).
* </li>
* <li>A list of newly allocated {@link Container}.</li>
* <li>A list of completed {@link Container}s' statuses.</li>
* <li>
* The available headroom for resources in the cluster for the
* application.
* </li>
* <li>A list of nodes whose status has been updated.</li>
* <li>The number of available nodes in a cluster.</li>
* <li>A description of resources requested back by the cluster</li>
* <li>AMRMToken, if AMRMToken has been rolled over</li>
* </ul>
*
* @see ApplicationMasterProtocol#allocate(AllocateRequest)
*/
@Public
@Stable
public abstract class AllocateResponse {
@Public
@Stable
public static AllocateResponse newInstance(int responseId,
List<ContainerStatus> completedContainers,
List<Container> allocatedContainers, List<NodeReport> updatedNodes,
Resource availResources, AMCommand command, int numClusterNodes,
PreemptionMessage preempt, List<NMToken> nmTokens) {
AllocateResponse response = Records.newRecord(AllocateResponse.class);
response.setNumClusterNodes(numClusterNodes);
response.setResponseId(responseId);
response.setCompletedContainersStatuses(completedContainers);
response.setAllocatedContainers(allocatedContainers);
response.setUpdatedNodes(updatedNodes);
response.setAvailableResources(availResources);
response.setAMCommand(command);
response.setPreemptionMessage(preempt);
response.setNMTokens(nmTokens);
return response;
}
@Public
@Stable
public static AllocateResponse newInstance(int responseId,
List<ContainerStatus> completedContainers,
List<Container> allocatedContainers, List<NodeReport> updatedNodes,
Resource availResources, AMCommand command, int numClusterNodes,
PreemptionMessage preempt, List<NMToken> nmTokens,
List<ContainerResourceIncrease> increasedContainers,
List<ContainerResourceDecrease> decreasedContainers) {
AllocateResponse response = newInstance(responseId, completedContainers,
allocatedContainers, updatedNodes, availResources, command,
numClusterNodes, preempt, nmTokens);
response.setIncreasedContainers(increasedContainers);
response.setDecreasedContainers(decreasedContainers);
return response;
}
@Private
@Unstable
public static AllocateResponse newInstance(int responseId,
List<ContainerStatus> completedContainers,
List<Container> allocatedContainers, List<NodeReport> updatedNodes,
Resource availResources, AMCommand command, int numClusterNodes,
PreemptionMessage preempt, List<NMToken> nmTokens, Token amRMToken,
List<ContainerResourceIncrease> increasedContainers,
List<ContainerResourceDecrease> decreasedContainers) {
AllocateResponse response =
newInstance(responseId, completedContainers, allocatedContainers,
updatedNodes, availResources, command, numClusterNodes, preempt,
nmTokens, increasedContainers, decreasedContainers);
response.setAMRMToken(amRMToken);
return response;
}
/**
* If the <code>ResourceManager</code> needs the
* <code>ApplicationMaster</code> to take some action then it will send an
* AMCommand to the <code>ApplicationMaster</code>. See <code>AMCommand</code>
* for details on commands and actions for them.
* @return <code>AMCommand</code> if the <code>ApplicationMaster</code> should
* take action, <code>null</code> otherwise
* @see AMCommand
*/
@Public
@Stable
public abstract AMCommand getAMCommand();
@Private
@Unstable
public abstract void setAMCommand(AMCommand command);
/**
* Get the <em>last response id</em>.
* @return <em>last response id</em>
*/
@Public
@Stable
public abstract int getResponseId();
@Private
@Unstable
public abstract void setResponseId(int responseId);
/**
* Get the list of <em>newly allocated</em> <code>Container</code> by the
* <code>ResourceManager</code>.
* @return list of <em>newly allocated</em> <code>Container</code>
*/
@Public
@Stable
public abstract List<Container> getAllocatedContainers();
/**
* Set the list of <em>newly allocated</em> <code>Container</code> by the
* <code>ResourceManager</code>.
* @param containers list of <em>newly allocated</em> <code>Container</code>
*/
@Private
@Unstable
public abstract void setAllocatedContainers(List<Container> containers);
/**
* Get the <em>available headroom</em> for resources in the cluster for the
* application.
* @return limit of available headroom for resources in the cluster for the
* application
*/
@Public
@Stable
public abstract Resource getAvailableResources();
@Private
@Unstable
public abstract void setAvailableResources(Resource limit);
/**
* Get the list of <em>completed containers' statuses</em>.
* @return the list of <em>completed containers' statuses</em>
*/
@Public
@Stable
public abstract List<ContainerStatus> getCompletedContainersStatuses();
@Private
@Unstable
public abstract void setCompletedContainersStatuses(List<ContainerStatus> containers);
/**
* Get the list of <em>updated <code>NodeReport</code>s</em>. Updates could
* be changes in health, availability etc of the nodes.
* @return The delta of updated nodes since the last response
*/
@Public
@Stable
public abstract List<NodeReport> getUpdatedNodes();
@Private
@Unstable
public abstract void setUpdatedNodes(final List<NodeReport> updatedNodes);
/**
* Get the number of hosts available on the cluster.
* @return the available host count.
*/
@Public
@Stable
public abstract int getNumClusterNodes();
@Private
@Unstable
public abstract void setNumClusterNodes(int numNodes);
/**
* Get the description of containers owned by the AM, but requested back by
* the cluster. Note that the RM may have an inconsistent view of the
* resources owned by the AM. These messages are advisory, and the AM may
* elect to ignore them.
* <p>
* The message is a snapshot of the resources the RM wants back from the AM.
* While demand persists, the RM will repeat its request; applications should
* not interpret each message as a request for <em>additional</em>
* resources on top of previous messages. Resources requested consistently
* over some duration may be forcibly killed by the RM.
*
* @return A specification of the resources to reclaim from this AM.
*/
@Public
@Evolving
public abstract PreemptionMessage getPreemptionMessage();
@Private
@Unstable
public abstract void setPreemptionMessage(PreemptionMessage request);
/**
* Get the list of NMTokens required for communicating with NM. New NMTokens
* issued only if
* <p>
* 1) AM is receiving first container on underlying NodeManager.<br>
* OR<br>
* 2) NMToken master key rolled over in ResourceManager and AM is getting new
* container on the same underlying NodeManager.
* <p>
* AM will receive one NMToken per NM irrespective of the number of containers
* issued on same NM. AM is expected to store these tokens until issued a
* new token for the same NM.
*/
@Public
@Stable
public abstract List<NMToken> getNMTokens();
@Private
@Unstable
public abstract void setNMTokens(List<NMToken> nmTokens);
/**
* Get the list of newly increased containers by <code>ResourceManager</code>
*/
@Public
@Stable
public abstract List<ContainerResourceIncrease> getIncreasedContainers();
/**
* Set the list of newly increased containers by <code>ResourceManager</code>
*/
@Private
@Unstable
public abstract void setIncreasedContainers(
List<ContainerResourceIncrease> increasedContainers);
/**
* Get the list of newly decreased containers by <code>NodeManager</code>
*/
@Public
@Stable
public abstract List<ContainerResourceDecrease> getDecreasedContainers();
/**
* Set the list of newly decreased containers by <code>NodeManager</code>
*/
@Private
@Unstable
public abstract void setDecreasedContainers(
List<ContainerResourceDecrease> decreasedContainers);
/**
* The AMRMToken that belong to this attempt
*
* @return The AMRMToken that belong to this attempt
*/
@Public
@Unstable
public abstract Token getAMRMToken();
@Private
@Unstable
public abstract void setAMRMToken(Token amRMToken);
}
| 10,700 | 33.743506 | 88 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReleaseSharedCacheResourceRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ApplicationId;
/**
* <p>The request from clients to release a resource in the shared cache.</p>
*/
@Public
@Unstable
public abstract class ReleaseSharedCacheResourceRequest {
/**
* Get the <code>ApplicationId</code> of the resource to be released.
*
* @return <code>ApplicationId</code>
*/
@Public
@Unstable
public abstract ApplicationId getAppId();
/**
* Set the <code>ApplicationId</code> of the resource to be released.
*
* @param id <code>ApplicationId</code>
*/
@Public
@Unstable
public abstract void setAppId(ApplicationId id);
/**
* Get the <code>key</code> of the resource to be released.
*
* @return <code>key</code>
*/
@Public
@Unstable
public abstract String getResourceKey();
/**
* Set the <code>key</code> of the resource to be released.
*
* @param key unique identifier for the resource
*/
@Public
@Unstable
public abstract void setResourceKey(String key);
}
| 1,998 | 28.397059 | 77 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
import org.apache.hadoop.yarn.api.records.NMToken;
import org.apache.hadoop.yarn.api.records.Token;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The request sent by the <code>ApplicationMaster</code> to the
* <code>NodeManager</code> to <em>start</em> a container.</p>
*
* <p>The <code>ApplicationMaster</code> has to provide details such as
* allocated resource capability, security tokens (if enabled), command
* to be executed to start the container, environment for the process,
* necessary binaries/jar/shared-objects etc. via the
* {@link ContainerLaunchContext}.</p>
*
* @see ContainerManagementProtocol#startContainers(StartContainersRequest)
*/
@Public
@Stable
public abstract class StartContainerRequest {
@Public
@Stable
public static StartContainerRequest newInstance(
ContainerLaunchContext context, Token container) {
StartContainerRequest request =
Records.newRecord(StartContainerRequest.class);
request.setContainerLaunchContext(context);
request.setContainerToken(container);
return request;
}
/**
* Get the <code>ContainerLaunchContext</code> for the container to be started
* by the <code>NodeManager</code>.
*
* @return <code>ContainerLaunchContext</code> for the container to be started
* by the <code>NodeManager</code>
*/
@Public
@Stable
public abstract ContainerLaunchContext getContainerLaunchContext();
/**
* Set the <code>ContainerLaunchContext</code> for the container to be started
* by the <code>NodeManager</code>
* @param context <code>ContainerLaunchContext</code> for the container to be
* started by the <code>NodeManager</code>
*/
@Public
@Stable
public abstract void setContainerLaunchContext(ContainerLaunchContext context);
/**
* Get the container token to be used for authorization during starting
* container.
* <p>
* Note: {@link NMToken} will be used for authenticating communication with
* {@code NodeManager}.
* @return the container token to be used for authorization during starting
* container.
* @see NMToken
* @see ContainerManagementProtocol#startContainers(StartContainersRequest)
*/
@Public
@Stable
public abstract Token getContainerToken();
@Public
@Stable
public abstract void setContainerToken(Token container);
}
| 3,479 | 35.631579 | 81 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationUpdateResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ReservationDefinition;
import org.apache.hadoop.yarn.util.Records;
/**
* {@link ReservationUpdateResponse} contains the answer of the admission
* control system in the {@code ResourceManager} to a reservation update
* operation. Currently response is empty if the operation was successful, if
* not an exception reporting reason for a failure.
*
* @see ReservationDefinition
*
*/
@Public
@Unstable
public abstract class ReservationUpdateResponse {
@Private
@Unstable
public static ReservationUpdateResponse newInstance() {
ReservationUpdateResponse response =
Records.newRecord(ReservationUpdateResponse.class);
return response;
}
}
| 1,775 | 35.244898 | 77 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/SubmitApplicationRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The request sent by a client to <em>submit an application</em> to the
* <code>ResourceManager</code>.</p>
*
* <p>The request, via {@link ApplicationSubmissionContext}, contains
* details such as queue, {@link Resource} required to run the
* <code>ApplicationMaster</code>, the equivalent of
* {@link ContainerLaunchContext} for launching the
* <code>ApplicationMaster</code> etc.
*
* @see ApplicationClientProtocol#submitApplication(SubmitApplicationRequest)
*/
@Public
@Stable
public abstract class SubmitApplicationRequest {
@Public
@Stable
public static SubmitApplicationRequest newInstance(
ApplicationSubmissionContext context) {
SubmitApplicationRequest request =
Records.newRecord(SubmitApplicationRequest.class);
request.setApplicationSubmissionContext(context);
return request;
}
/**
* Get the <code>ApplicationSubmissionContext</code> for the application.
* @return <code>ApplicationSubmissionContext</code> for the application
*/
@Public
@Stable
public abstract ApplicationSubmissionContext getApplicationSubmissionContext();
/**
* Set the <code>ApplicationSubmissionContext</code> for the application.
* @param context <code>ApplicationSubmissionContext</code> for the
* application
*/
@Public
@Stable
public abstract void setApplicationSubmissionContext(
ApplicationSubmissionContext context);
}
| 2,721 | 36.287671 | 81 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/MoveApplicationAcrossQueuesRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The request sent by the client to the <code>ResourceManager</code>
* to move a submitted application to a different queue.</p>
*
* <p>The request includes the {@link ApplicationId} of the application to be
* moved and the queue to place it in.</p>
*
* @see ApplicationClientProtocol#moveApplicationAcrossQueues(MoveApplicationAcrossQueuesRequest)
*/
@Public
@Unstable
public abstract class MoveApplicationAcrossQueuesRequest {
public static MoveApplicationAcrossQueuesRequest newInstance(ApplicationId appId, String queue) {
MoveApplicationAcrossQueuesRequest request =
Records.newRecord(MoveApplicationAcrossQueuesRequest.class);
request.setApplicationId(appId);
request.setTargetQueue(queue);
return request;
}
/**
* Get the <code>ApplicationId</code> of the application to be moved.
* @return <code>ApplicationId</code> of the application to be moved
*/
public abstract ApplicationId getApplicationId();
/**
* Set the <code>ApplicationId</code> of the application to be moved.
* @param appId <code>ApplicationId</code> of the application to be moved
*/
public abstract void setApplicationId(ApplicationId appId);
/**
* Get the queue to place the application in.
* @return the name of the queue to place the application in
*/
public abstract String getTargetQueue();
/**
* Get the queue to place the application in.
* @param queue the name of the queue to place the application in
*/
public abstract void setTargetQueue(String queue);
}
| 2,706 | 37.671429 | 99 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/FinishApplicationMasterRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.util.Records;
/**
* The finalization request sent by the {@code ApplicationMaster} to
* inform the {@code ResourceManager} about its completion.
* <p>
* The final request includes details such:
* <ul>
* <li>Final state of the {@code ApplicationMaster}</li>
* <li>
* Diagnostic information in case of failure of the
* {@code ApplicationMaster}
* </li>
* <li>Tracking URL</li>
* </ul>
*
* @see ApplicationMasterProtocol#finishApplicationMaster(FinishApplicationMasterRequest)
*/
@Public
@Stable
public abstract class FinishApplicationMasterRequest {
@Public
@Stable
public static FinishApplicationMasterRequest newInstance(
FinalApplicationStatus finalAppStatus, String diagnostics, String url) {
FinishApplicationMasterRequest request =
Records.newRecord(FinishApplicationMasterRequest.class);
request.setFinalApplicationStatus(finalAppStatus);
request.setDiagnostics(diagnostics);
request.setTrackingUrl(url);
return request;
}
/**
* Get <em>final state</em> of the <code>ApplicationMaster</code>.
* @return <em>final state</em> of the <code>ApplicationMaster</code>
*/
@Public
@Stable
public abstract FinalApplicationStatus getFinalApplicationStatus();
/**
* Set the <em>final state</em> of the <code>ApplicationMaster</code>
* @param finalState <em>final state</em> of the <code>ApplicationMaster</code>
*/
@Public
@Stable
public abstract void setFinalApplicationStatus(FinalApplicationStatus finalState);
/**
* Get <em>diagnostic information</em> on application failure.
* @return <em>diagnostic information</em> on application failure
*/
@Public
@Stable
public abstract String getDiagnostics();
/**
* Set <em>diagnostic information</em> on application failure.
* @param diagnostics <em>diagnostic information</em> on application failure
*/
@Public
@Stable
public abstract void setDiagnostics(String diagnostics);
/**
* Get the <em>tracking URL</em> for the <code>ApplicationMaster</code>.
* This url if contains scheme then that will be used by resource manager
* web application proxy otherwise it will default to http.
* @return <em>tracking URL</em>for the <code>ApplicationMaster</code>
*/
@Public
@Stable
public abstract String getTrackingUrl();
/**
* Set the <em>final tracking URL</em>for the <code>ApplicationMaster</code>.
* This is the web-URL to which ResourceManager or web-application proxy will
* redirect client/users once the application is finished and the
* <code>ApplicationMaster</code> is gone.
* <p>
* If the passed url has a scheme then that will be used by the
* ResourceManager and web-application proxy, otherwise the scheme will
* default to http.
* </p>
* <p>
* Empty, null, "N/A" strings are all valid besides a real URL. In case an url
* isn't explicitly passed, it defaults to "N/A" on the ResourceManager.
* <p>
*
* @param url
* <em>tracking URL</em>for the <code>ApplicationMaster</code>
*/
@Public
@Stable
public abstract void setTrackingUrl(String url);
}
| 4,287 | 33.580645 | 89 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetDelegationTokenRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.util.Records;
/**
* The request issued by the client to get a delegation token from
* the {@code ResourceManager}.
* for more information.
*/
@Public
@Stable
public abstract class GetDelegationTokenRequest {
@Public
@Stable
public static GetDelegationTokenRequest newInstance(String renewer) {
GetDelegationTokenRequest request =
Records.newRecord(GetDelegationTokenRequest.class);
request.setRenewer(renewer);
return request;
}
@Public
@Stable
public abstract String getRenewer();
@Public
@Stable
public abstract void setRenewer(String renewer);
}
| 1,621 | 30.803922 | 75 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/FinishApplicationMasterResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
import org.apache.hadoop.yarn.util.Records;
/**
* The response sent by the <code>ResourceManager</code> to a
* <code>ApplicationMaster</code> on it's completion.
* <p>
* The response, includes:
* <ul>
* <li>A flag which indicates that the application has successfully unregistered
* with the RM and the application can safely stop.</li>
* </ul>
* <p>
* Note: The flag indicates whether the application has successfully
* unregistered and is safe to stop. The application may stop after the flag is
* true. If the application stops before the flag is true then the RM may retry
* the application.
*
* @see ApplicationMasterProtocol#finishApplicationMaster(FinishApplicationMasterRequest)
*/
@Public
@Stable
public abstract class FinishApplicationMasterResponse {
@Private
@Unstable
public static FinishApplicationMasterResponse newInstance(
boolean isRemovedFromRMStateStore) {
FinishApplicationMasterResponse response =
Records.newRecord(FinishApplicationMasterResponse.class);
response.setIsUnregistered(isRemovedFromRMStateStore);
return response;
}
/**
* Get the flag which indicates that the application has successfully
* unregistered with the RM and the application can safely stop.
*/
@Public
@Stable
public abstract boolean getIsUnregistered();
/**
* Set the flag which indicates that the application has successfully
* unregistered with the RM and the application can safely stop.
*/
@Private
@Unstable
public abstract void setIsUnregistered(boolean isUnregistered);
}
| 2,758 | 35.786667 | 89 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetApplicationAttemptsResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The response sent by the <code>ResourceManager</code> to a client requesting
* a list of {@link ApplicationAttemptReport} for application attempts.
* </p>
*
* <p>
* The <code>ApplicationAttemptReport</code> for each application includes the
* details of an application attempt.
* </p>
*
* @see ApplicationAttemptReport
* @see ApplicationHistoryProtocol#getApplicationAttempts(GetApplicationAttemptsRequest)
*/
@Public
@Unstable
public abstract class GetApplicationAttemptsResponse {
@Public
@Unstable
public static GetApplicationAttemptsResponse newInstance(
List<ApplicationAttemptReport> applicationAttempts) {
GetApplicationAttemptsResponse response =
Records.newRecord(GetApplicationAttemptsResponse.class);
response.setApplicationAttemptList(applicationAttempts);
return response;
}
/**
* Get a list of <code>ApplicationReport</code> of an application.
*
* @return a list of <code>ApplicationReport</code> of an application
*/
@Public
@Unstable
public abstract List<ApplicationAttemptReport> getApplicationAttemptList();
/**
* Get a list of <code>ApplicationReport</code> of an application.
*
* @param applicationAttempts
* a list of <code>ApplicationReport</code> of an application
*/
@Public
@Unstable
public abstract void setApplicationAttemptList(
List<ApplicationAttemptReport> applicationAttempts);
}
| 2,631 | 33.181818 | 88 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainersResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.SerializedException;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The response sent by the <code>NodeManager</code> to the
* <code>ApplicationMaster</code> when asked to <em>start</em> an allocated
* container.
* </p>
*
* @see ContainerManagementProtocol#startContainers(StartContainersRequest)
*/
@Public
@Stable
public abstract class StartContainersResponse {
@Private
@Unstable
public static StartContainersResponse newInstance(
Map<String, ByteBuffer> servicesMetaData,
List<ContainerId> succeededContainers,
Map<ContainerId, SerializedException> failedContainers) {
StartContainersResponse response =
Records.newRecord(StartContainersResponse.class);
response.setAllServicesMetaData(servicesMetaData);
response.setSuccessfullyStartedContainers(succeededContainers);
response.setFailedRequests(failedContainers);
return response;
}
/**
* Get the list of <code>ContainerId</code> s of the containers that are
* started successfully.
*
* @return the list of <code>ContainerId</code> s of the containers that are
* started successfully.
* @see ContainerManagementProtocol#startContainers(StartContainersRequest)
*/
@Public
@Stable
public abstract List<ContainerId> getSuccessfullyStartedContainers();
@Private
@Unstable
public abstract void setSuccessfullyStartedContainers(
List<ContainerId> succeededContainers);
/**
* Get the containerId-to-exception map in which the exception indicates error
* from per container for failed requests
*/
@Public
@Stable
public abstract Map<ContainerId, SerializedException> getFailedRequests();
/**
* Set the containerId-to-exception map in which the exception indicates error
* from per container for failed requests
*/
@Private
@Unstable
public abstract void setFailedRequests(
Map<ContainerId, SerializedException> failedContainers);
/**
* <p>
* Get the meta-data from all auxiliary services running on the
* <code>NodeManager</code>.
* </p>
* <p>
* The meta-data is returned as a Map between the auxiliary service names and
* their corresponding per service meta-data as an opaque blob
* <code>ByteBuffer</code>
* </p>
*
* <p>
* To be able to interpret the per-service meta-data, you should consult the
* documentation for the Auxiliary-service configured on the NodeManager
* </p>
*
* @return a Map between the names of auxiliary services and their
* corresponding meta-data
*/
@Public
@Stable
public abstract Map<String, ByteBuffer> getAllServicesMetaData();
/**
* Set to the list of auxiliary services which have been started on the
* <code>NodeManager</code>. This is done only once when the
* <code>NodeManager</code> starts up
*
* @param allServicesMetaData
* A map from auxiliary service names to the opaque blob
* <code>ByteBuffer</code> for that auxiliary service
*/
@Private
@Unstable
public abstract void setAllServicesMetaData(
Map<String, ByteBuffer> allServicesMetaData);
}
| 4,495 | 33.060606 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueUserAclsInfoRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The request sent by clients to the <code>ResourceManager</code> to
* get queue acls for the <em>current user</em>.</p>
*
* <p>Currently, this is empty.</p>
*
* @see ApplicationClientProtocol#getQueueUserAcls(GetQueueUserAclsInfoRequest)
*/
@Public
@Stable
public abstract class GetQueueUserAclsInfoRequest {
@Public
@Stable
public static GetQueueUserAclsInfoRequest newInstance() {
GetQueueUserAclsInfoRequest request =
Records.newRecord(GetQueueUserAclsInfoRequest.class);
return request;
}
}
| 1,636 | 35.377778 | 79 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/RenewDelegationTokenResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* The response to a renewDelegationToken call to the {@code ResourceManager}.
*/
@Private
@Unstable
public abstract class RenewDelegationTokenResponse {
@Private
@Unstable
public static RenewDelegationTokenResponse newInstance(long expTime) {
RenewDelegationTokenResponse response =
Records.newRecord(RenewDelegationTokenResponse.class);
response.setNextExpirationTime(expTime);
return response;
}
@Private
@Unstable
public abstract long getNextExpirationTime();
@Private
@Unstable
public abstract void setNextExpirationTime(long expTime);
}
| 1,633 | 32.346939 | 78 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetNewApplicationRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The request sent by clients to get a new {@link ApplicationId} for
* submitting an application.</p>
*
* <p>Currently, this is empty.</p>
*
* @see ApplicationClientProtocol#getNewApplication(GetNewApplicationRequest)
*/
@Public
@Stable
public abstract class GetNewApplicationRequest {
@Public
@Stable
public static GetNewApplicationRequest newInstance() {
GetNewApplicationRequest request =
Records.newRecord(GetNewApplicationRequest.class);
return request;
}
}
| 1,660 | 35.108696 | 77 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainersResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.List;
import java.util.Map;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.SerializedException;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The response sent by the <code>NodeManager</code> to the
* <code>ApplicationMaster</code> when asked to <em>stop</em> allocated
* containers.
* </p>
*
* @see ContainerManagementProtocol#stopContainers(StopContainersRequest)
*/
@Public
@Stable
public abstract class StopContainersResponse {
@Private
@Unstable
public static StopContainersResponse newInstance(
List<ContainerId> succeededRequests,
Map<ContainerId, SerializedException> failedRequests) {
StopContainersResponse response =
Records.newRecord(StopContainersResponse.class);
response.setFailedRequests(failedRequests);
response.setSuccessfullyStoppedContainers(succeededRequests);
return response;
}
/**
* Get the list of containerIds of successfully stopped containers.
*
* @return the list of containerIds of successfully stopped containers.
*/
@Public
@Stable
public abstract List<ContainerId> getSuccessfullyStoppedContainers();
/**
* Set the list of containerIds of successfully stopped containers.
*/
@Private
@Unstable
public abstract void setSuccessfullyStoppedContainers(
List<ContainerId> succeededRequests);
/**
* Get the containerId-to-exception map in which the exception indicates error
* from per container for failed requests
*/
@Public
@Stable
public abstract Map<ContainerId, SerializedException> getFailedRequests();
/**
* Set the containerId-to-exception map in which the exception indicates error
* from per container for failed requests
*/
@Private
@Unstable
public abstract void setFailedRequests(
Map<ContainerId, SerializedException> failedRequests);
}
| 3,089 | 33.333333 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueUserAclsInfoResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.records.QueueACL;
import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The response sent by the <code>ResourceManager</code> to clients
* seeking queue acls for the user.</p>
*
* <p>The response contains a list of {@link QueueUserACLInfo} which
* provides information about {@link QueueACL} per queue.</p>
*
* @see QueueACL
* @see QueueUserACLInfo
* @see ApplicationClientProtocol#getQueueUserAcls(GetQueueUserAclsInfoRequest)
*/
@Public
@Stable
public abstract class GetQueueUserAclsInfoResponse {
@Private
@Unstable
public static GetQueueUserAclsInfoResponse newInstance(
List<QueueUserACLInfo> queueUserAclsList) {
GetQueueUserAclsInfoResponse response =
Records.newRecord(GetQueueUserAclsInfoResponse.class);
response.setUserAclsInfoList(queueUserAclsList);
return response;
}
/**
* Get the <code>QueueUserACLInfo</code> per queue for the user.
* @return <code>QueueUserACLInfo</code> per queue for the user
*/
@Public
@Stable
public abstract List<QueueUserACLInfo> getUserAclsInfoList();
@Private
@Unstable
public abstract void setUserAclsInfoList(
List<QueueUserACLInfo> queueUserAclsList);
}
| 2,491 | 34.098592 | 79 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationUpdateRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ReservationDefinition;
import org.apache.hadoop.yarn.api.records.ReservationId;
import org.apache.hadoop.yarn.util.Records;
/**
* {@link ReservationUpdateRequest} captures the set of requirements the user
* has to update an existing reservation.
*
* @see ReservationDefinition
*
*/
@Public
@Unstable
public abstract class ReservationUpdateRequest {
@Public
@Unstable
public static ReservationUpdateRequest newInstance(
ReservationDefinition reservationDefinition, ReservationId reservationId) {
ReservationUpdateRequest request =
Records.newRecord(ReservationUpdateRequest.class);
request.setReservationDefinition(reservationDefinition);
request.setReservationId(reservationId);
return request;
}
/**
* Get the {@link ReservationDefinition} representing the updated user
* constraints for this reservation
*
* @return the reservation definition representing user constraints
*/
@Public
@Unstable
public abstract ReservationDefinition getReservationDefinition();
/**
* Set the {@link ReservationDefinition} representing the updated user
* constraints for this reservation
*
* @param reservationDefinition the reservation request representing the
* reservation
*/
@Public
@Unstable
public abstract void setReservationDefinition(
ReservationDefinition reservationDefinition);
/**
* Get the {@link ReservationId}, that corresponds to a valid resource
* allocation in the scheduler (between start and end time of this
* reservation)
*
* @return the {@link ReservationId} representing the unique id of the
* corresponding reserved resource allocation in the scheduler
*/
@Public
@Unstable
public abstract ReservationId getReservationId();
/**
* Set the {@link ReservationId}, that correspond to a valid resource
* allocation in the scheduler (between start and end time of this
* reservation)
*
* @param reservationId the {@link ReservationId} representing the the unique
* id of the corresponding reserved resource allocation in the
* scheduler
*/
@Public
@Unstable
public abstract void setReservationId(ReservationId reservationId);
}
| 3,277 | 32.793814 | 81 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/CancelDelegationTokenRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.Token;
import org.apache.hadoop.yarn.util.Records;
/**
* The request issued by the client to the {@code ResourceManager} to cancel a
* delegation token.
*/
@Private
@Unstable
public abstract class CancelDelegationTokenRequest {
@Private
@Unstable
public static CancelDelegationTokenRequest newInstance(Token dToken) {
CancelDelegationTokenRequest request =
Records.newRecord(CancelDelegationTokenRequest.class);
request.setDelegationToken(dToken);
return request;
}
/**
* Get the delegation token requested to be cancelled.
* @return the delegation token requested to be cancelled.
*/
@Private
@Unstable
public abstract Token getDelegationToken();
@Private
@Unstable
public abstract void setDelegationToken(Token dToken);
}
| 1,821 | 32.127273 | 78 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReleaseSharedCacheResourceResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
/**
* <p>
* The response to clients from the <code>SharedCacheManager</code> when
* releasing a resource in the shared cache.
* </p>
*
* <p>
* Currently, this is empty.
* </p>
*/
@Public
@Unstable
public abstract class ReleaseSharedCacheResourceResponse {
}
| 1,264 | 32.289474 | 75 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusesRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ContainerStatus;
import org.apache.hadoop.yarn.util.Records;
/**
* The request sent by the <code>ApplicationMaster</code> to the
* <code>NodeManager</code> to get {@link ContainerStatus} of requested
* containers.
*
* @see ContainerManagementProtocol#getContainerStatuses(GetContainerStatusesRequest)
*/
@Public
@Stable
public abstract class GetContainerStatusesRequest {
@Public
@Stable
public static GetContainerStatusesRequest newInstance(
List<ContainerId> containerIds) {
GetContainerStatusesRequest request =
Records.newRecord(GetContainerStatusesRequest.class);
request.setContainerIds(containerIds);
return request;
}
/**
* Get the list of <code>ContainerId</code>s of containers for which to obtain
* the <code>ContainerStatus</code>.
*
* @return the list of <code>ContainerId</code>s of containers for which to
* obtain the <code>ContainerStatus</code>.
*/
@Public
@Stable
public abstract List<ContainerId> getContainerIds();
/**
* Set a list of <code>ContainerId</code>s of containers for which to obtain
* the <code>ContainerStatus</code>
*
* @param containerIds
* a list of <code>ContainerId</code>s of containers for which to
* obtain the <code>ContainerStatus</code>
*/
@Public
@Stable
public abstract void setContainerIds(List<ContainerId> containerIds);
}
| 2,579 | 33.864865 | 85 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/CancelDelegationTokenResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* The response from the {@code ResourceManager} to a cancelDelegationToken
* request.
*/
@Private
@Unstable
public abstract class CancelDelegationTokenResponse {
@Private
@Unstable
public static CancelDelegationTokenResponse newInstance() {
CancelDelegationTokenResponse response =
Records.newRecord(CancelDelegationTokenResponse.class);
return response;
}
}
| 1,432 | 34.825 | 75 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/KillApplicationRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The request sent by the client to the <code>ResourceManager</code>
* to abort a submitted application.</p>
*
* <p>The request includes the {@link ApplicationId} of the application to be
* aborted.</p>
*
* @see ApplicationClientProtocol#forceKillApplication(KillApplicationRequest)
*/
@Public
@Stable
public abstract class KillApplicationRequest {
@Public
@Stable
public static KillApplicationRequest newInstance(ApplicationId applicationId) {
KillApplicationRequest request =
Records.newRecord(KillApplicationRequest.class);
request.setApplicationId(applicationId);
return request;
}
/**
* Get the <code>ApplicationId</code> of the application to be aborted.
* @return <code>ApplicationId</code> of the application to be aborted
*/
@Public
@Stable
public abstract ApplicationId getApplicationId();
@Public
@Stable
public abstract void setApplicationId(ApplicationId applicationId);
}
| 2,117 | 33.721311 | 81 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/UseSharedCacheResourceResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
/**
* <p>
* The response from the SharedCacheManager to the client that indicates whether
* a requested resource exists in the cache.
* </p>
*/
@Public
@Unstable
public abstract class UseSharedCacheResourceResponse {
/**
* Get the <code>Path</code> corresponding to the requested resource in the
* shared cache.
*
* @return String A <code>Path</code> if the resource exists in the shared
* cache, <code>null</code> otherwise
*/
@Public
@Unstable
public abstract String getPath();
/**
* Set the <code>Path</code> corresponding to a resource in the shared cache.
*
* @param p A <code>Path</code> corresponding to a resource in the shared
* cache
*/
@Public
@Unstable
public abstract void setPath(String p);
}
| 1,778 | 30.767857 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetQueueInfoRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The request sent by clients to get <em>queue information</em>
* from the <code>ResourceManager</code>.</p>
*
* @see ApplicationClientProtocol#getQueueInfo(GetQueueInfoRequest)
*/
@Public
@Stable
public abstract class GetQueueInfoRequest {
@Public
@Stable
public static GetQueueInfoRequest
newInstance(String queueName, boolean includeApplications,
boolean includeChildQueues, boolean recursive) {
GetQueueInfoRequest request = Records.newRecord(GetQueueInfoRequest.class);
request.setQueueName(queueName);
request.setIncludeApplications(includeApplications);
request.setIncludeChildQueues(includeChildQueues);
request.setRecursive(recursive);
return request;
}
/**
* Get the <em>queue name</em> for which to get queue information.
* @return <em>queue name</em> for which to get queue information
*/
@Public
@Stable
public abstract String getQueueName();
/**
* Set the <em>queue name</em> for which to get queue information
* @param queueName <em>queue name</em> for which to get queue information
*/
@Public
@Stable
public abstract void setQueueName(String queueName);
/**
* Is information about <em>active applications</em> required?
* @return <code>true</code> if applications' information is to be included,
* else <code>false</code>
*/
@Public
@Stable
public abstract boolean getIncludeApplications();
/**
* Should we get fetch information about <em>active applications</em>?
* @param includeApplications fetch information about <em>active
* applications</em>?
*/
@Public
@Stable
public abstract void setIncludeApplications(boolean includeApplications);
/**
* Is information about <em>child queues</em> required?
* @return <code>true</code> if information about child queues is required,
* else <code>false</code>
*/
@Public
@Stable
public abstract boolean getIncludeChildQueues();
/**
* Should we fetch information about <em>child queues</em>?
* @param includeChildQueues fetch information about <em>child queues</em>?
*/
@Public
@Stable
public abstract void setIncludeChildQueues(boolean includeChildQueues);
/**
* Is information on the entire <em>child queue hierarchy</em> required?
* @return <code>true</code> if information about entire hierarchy is
* required, <code>false</code> otherwise
*/
@Public
@Stable
public abstract boolean getRecursive();
/**
* Should we fetch information on the entire <em>child queue hierarchy</em>?
* @param recursive fetch information on the entire <em>child queue
* hierarchy</em>?
*/
@Public
@Stable
public abstract void setRecursive(boolean recursive);
}
| 3,900 | 31.781513 | 79 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerReportResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ContainerReport;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The response sent by the <code>ResourceManager</code> to a client requesting
* a container report.
* </p>
*
* <p>
* The response includes a {@link ContainerReport} which has details of a
* container.
* </p>
*
*/
@Public
@Unstable
public abstract class GetContainerReportResponse {
@Public
@Unstable
public static GetContainerReportResponse newInstance(
ContainerReport containerReport) {
GetContainerReportResponse response =
Records.newRecord(GetContainerReportResponse.class);
response.setContainerReport(containerReport);
return response;
}
/**
* Get the <code>ContainerReport</code> for the container.
*
* @return <code>ContainerReport</code> for the container
*/
@Public
@Unstable
public abstract ContainerReport getContainerReport();
@Public
@Unstable
public abstract void setContainerReport(ContainerReport containerReport);
}
| 2,022 | 30.609375 | 79 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationDeleteResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ReservationDefinition;
import org.apache.hadoop.yarn.util.Records;
/**
* {@link ReservationDeleteResponse} contains the answer of the admission
* control system in the {@code ResourceManager} to a reservation delete
* operation. Currently response is empty if the operation was successful, if
* not an exception reporting reason for a failure.
*
* @see ReservationDefinition
*
*/
@Public
@Unstable
public abstract class ReservationDeleteResponse {
@Private
@Unstable
public static ReservationDeleteResponse newInstance() {
ReservationDeleteResponse response =
Records.newRecord(ReservationDeleteResponse.class);
return response;
}
}
| 1,775 | 35.244898 | 77 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetClusterNodeLabelsResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.yarn.api.records.NodeLabel;
import org.apache.hadoop.yarn.util.Records;
@Public
@Evolving
public abstract class GetClusterNodeLabelsResponse {
public static GetClusterNodeLabelsResponse newInstance(List<NodeLabel> labels) {
GetClusterNodeLabelsResponse request =
Records.newRecord(GetClusterNodeLabelsResponse.class);
request.setNodeLabels(labels);
return request;
}
@Public
@Evolving
public abstract void setNodeLabels(List<NodeLabel> labels);
@Public
@Evolving
public abstract List<NodeLabel> getNodeLabels();
}
| 1,598 | 33.76087 | 82 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/UseSharedCacheResourceRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ApplicationId;
/**
* <p>
* The request from clients to the <code>SharedCacheManager</code> that claims a
* resource in the shared cache.
* </p>
*/
@Public
@Unstable
public abstract class UseSharedCacheResourceRequest {
/**
* Get the <code>ApplicationId</code> of the resource to be used.
*
* @return <code>ApplicationId</code>
*/
@Public
@Unstable
public abstract ApplicationId getAppId();
/**
* Set the <code>ApplicationId</code> of the resource to be used.
*
* @param id <code>ApplicationId</code>
*/
@Public
@Unstable
public abstract void setAppId(ApplicationId id);
/**
* Get the <code>key</code> of the resource to be used.
*
* @return <code>key</code>
*/
@Public
@Unstable
public abstract String getResourceKey();
/**
* Set the <code>key</code> of the resource to be used.
*
* @param key unique identifier for the resource
*/
@Public
@Unstable
public abstract void setResourceKey(String key);
}
| 2,029 | 27.591549 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetClusterNodesResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.records.NodeReport;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The response sent by the <code>ResourceManager</code> to a client
* requesting a {@link NodeReport} for all nodes.</p>
*
* <p>The <code>NodeReport</code> contains per-node information such as
* available resources, number of containers, tracking url, rack name, health
* status etc.
*
* @see NodeReport
* @see ApplicationClientProtocol#getClusterNodes(GetClusterNodesRequest)
*/
@Public
@Stable
public abstract class GetClusterNodesResponse {
@Private
@Unstable
public static GetClusterNodesResponse
newInstance(List<NodeReport> nodeReports) {
GetClusterNodesResponse response =
Records.newRecord(GetClusterNodesResponse.class);
response.setNodeReports(nodeReports);
return response;
}
/**
* Get <code>NodeReport</code> for all nodes in the cluster.
* @return <code>NodeReport</code> for all nodes in the cluster
*/
@Public
@Stable
public abstract List<NodeReport> getNodeReports();
@Private
@Unstable
public abstract void setNodeReports(List<NodeReport> nodeReports);
}
| 2,369 | 33.852941 | 77 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/RegisterApplicationMasterRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
import org.apache.hadoop.yarn.util.Records;
/**
* The request sent by the {@code ApplicationMaster} to {@code ResourceManager}
* on registration.
* <p>
* The registration includes details such as:
* <ul>
* <li>Hostname on which the AM is running.</li>
* <li>RPC Port</li>
* <li>Tracking URL</li>
* </ul>
*
* @see ApplicationMasterProtocol#registerApplicationMaster(RegisterApplicationMasterRequest)
*/
@Public
@Stable
public abstract class RegisterApplicationMasterRequest {
/**
* Create a new instance of <code>RegisterApplicationMasterRequest</code>.
* If <em>port, trackingUrl</em> is not used, use the following default value:
* <ul>
* <li>port: -1</li>
* <li>trackingUrl: null</li>
* </ul>
* The port is allowed to be any integer larger than or equal to -1.
* @return the new instance of <code>RegisterApplicationMasterRequest</code>
*/
@Public
@Stable
public static RegisterApplicationMasterRequest newInstance(String host,
int port, String trackingUrl) {
RegisterApplicationMasterRequest request =
Records.newRecord(RegisterApplicationMasterRequest.class);
request.setHost(host);
request.setRpcPort(port);
request.setTrackingUrl(trackingUrl);
return request;
}
/**
* Get the <em>host</em> on which the <code>ApplicationMaster</code> is
* running.
* @return <em>host</em> on which the <code>ApplicationMaster</code> is running
*/
@Public
@Stable
public abstract String getHost();
/**
* Set the <em>host</em> on which the <code>ApplicationMaster</code> is
* running.
* @param host <em>host</em> on which the <code>ApplicationMaster</code>
* is running
*/
@Public
@Stable
public abstract void setHost(String host);
/**
* Get the <em>RPC port</em> on which the {@code ApplicationMaster} is
* responding.
* @return the <em>RPC port</em> on which the {@code ApplicationMaster}
* is responding
*/
@Public
@Stable
public abstract int getRpcPort();
/**
* Set the <em>RPC port</em> on which the {@code ApplicationMaster} is
* responding.
* @param port <em>RPC port</em> on which the {@code ApplicationMaster}
* is responding
*/
@Public
@Stable
public abstract void setRpcPort(int port);
/**
* Get the <em>tracking URL</em> for the <code>ApplicationMaster</code>.
* This url if contains scheme then that will be used by resource manager
* web application proxy otherwise it will default to http.
* @return <em>tracking URL</em> for the <code>ApplicationMaster</code>
*/
@Public
@Stable
public abstract String getTrackingUrl();
/**
* Set the <em>tracking URL</em>for the <code>ApplicationMaster</code> while
* it is running. This is the web-URL to which ResourceManager or
* web-application proxy will redirect client/users while the application and
* the <code>ApplicationMaster</code> are still running.
* <p>
* If the passed url has a scheme then that will be used by the
* ResourceManager and web-application proxy, otherwise the scheme will
* default to http.
* </p>
* <p>
* Empty, null, "N/A" strings are all valid besides a real URL. In case an url
* isn't explicitly passed, it defaults to "N/A" on the ResourceManager.
* <p>
*
* @param trackingUrl
* <em>tracking URL</em>for the <code>ApplicationMaster</code>
*/
@Public
@Stable
public abstract void setTrackingUrl(String trackingUrl);
}
| 4,568 | 32.595588 | 93 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetApplicationsResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The response sent by the <code>ResourceManager</code> to a client
* requesting an {@link ApplicationReport} for applications.</p>
*
* <p>The <code>ApplicationReport</code> for each application includes details
* such as user, queue, name, host on which the <code>ApplicationMaster</code>
* is running, RPC port, tracking URL, diagnostics, start time etc.</p>
*
* @see ApplicationReport
* @see ApplicationClientProtocol#getApplications(GetApplicationsRequest)
*/
@Public
@Stable
public abstract class GetApplicationsResponse {
@Private
@Unstable
public static GetApplicationsResponse newInstance(
List<ApplicationReport> applications) {
GetApplicationsResponse response =
Records.newRecord(GetApplicationsResponse.class);
response.setApplicationList(applications);
return response;
}
/**
* Get <code>ApplicationReport</code> for applications.
* @return <code>ApplicationReport</code> for applications
*/
@Public
@Stable
public abstract List<ApplicationReport> getApplicationList();
@Private
@Unstable
public abstract void setApplicationList(List<ApplicationReport> applications);
}
| 2,480 | 36.029851 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationDeleteRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ReservationDefinition;
import org.apache.hadoop.yarn.api.records.ReservationId;
import org.apache.hadoop.yarn.util.Records;
/**
* {@link ReservationDeleteRequest} captures the set of requirements the user
* has to delete an existing reservation.
*
* @see ReservationDefinition
*
*/
@Public
@Unstable
public abstract class ReservationDeleteRequest {
@Public
@Unstable
public static ReservationDeleteRequest newInstance(ReservationId reservationId) {
ReservationDeleteRequest request =
Records.newRecord(ReservationDeleteRequest.class);
request.setReservationId(reservationId);
return request;
}
/**
* Get the {@link ReservationId}, that corresponds to a valid resource
* allocation in the scheduler (between start and end time of this
* reservation)
*
* @return the {@link ReservationId} representing the unique id of the
* corresponding reserved resource allocation in the scheduler
*/
@Public
@Unstable
public abstract ReservationId getReservationId();
/**
* Set the {@link ReservationId}, that correspond to a valid resource
* allocation in the scheduler (between start and end time of this
* reservation)
*
* @param reservationId the {@link ReservationId} representing the the unique
* id of the corresponding reserved resource allocation in the
* scheduler
*/
@Public
@Unstable
public abstract void setReservationId(ReservationId reservationId);
}
| 2,520 | 33.534247 | 83 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetApplicationReportRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The request sent by a client to the <code>ResourceManager</code> to
* get an {@link ApplicationReport} for an application.</p>
*
* <p>The request should include the {@link ApplicationId} of the
* application.</p>
*
* @see ApplicationClientProtocol#getApplicationReport(GetApplicationReportRequest)
* @see ApplicationReport
*/
@Public
@Stable
public abstract class GetApplicationReportRequest {
@Public
@Stable
public static GetApplicationReportRequest newInstance(
ApplicationId applicationId) {
GetApplicationReportRequest request =
Records.newRecord(GetApplicationReportRequest.class);
request.setApplicationId(applicationId);
return request;
}
/**
* Get the <code>ApplicationId</code> of the application.
* @return <code>ApplicationId</code> of the application
*/
@Public
@Stable
public abstract ApplicationId getApplicationId();
/**
* Set the <code>ApplicationId</code> of the application
* @param applicationId <code>ApplicationId</code> of the application
*/
@Public
@Stable
public abstract void setApplicationId(ApplicationId applicationId);
}
| 2,364 | 33.779412 | 83 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainersRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The request from clients to get a list of container reports, which belong to
* an application attempt from the <code>ResourceManager</code>.
* </p>
*
* @see ApplicationHistoryProtocol#getContainers(GetContainersRequest)
*/
@Public
@Unstable
public abstract class GetContainersRequest {
@Public
@Unstable
public static GetContainersRequest newInstance(
ApplicationAttemptId applicationAttemptId) {
GetContainersRequest request =
Records.newRecord(GetContainersRequest.class);
request.setApplicationAttemptId(applicationAttemptId);
return request;
}
/**
* Get the <code>ApplicationAttemptId</code> of an application attempt.
*
* @return <code>ApplicationAttemptId</code> of an application attempt
*/
@Public
@Unstable
public abstract ApplicationAttemptId getApplicationAttemptId();
/**
* Set the <code>ApplicationAttemptId</code> of an application attempt
*
* @param applicationAttemptId
* <code>ApplicationAttemptId</code> of an application attempt
*/
@Public
@Unstable
public abstract void setApplicationAttemptId(
ApplicationAttemptId applicationAttemptId);
}
| 2,344 | 33.485294 | 79 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetClusterNodesRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.EnumSet;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.records.NodeState;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The request from clients to get a report of all nodes
* in the cluster from the <code>ResourceManager</code>.</p>
*
* The request will ask for all nodes in the given {@link NodeState}s.
*
* @see ApplicationClientProtocol#getClusterNodes(GetClusterNodesRequest)
*/
@Public
@Stable
public abstract class GetClusterNodesRequest {
@Public
@Stable
public static GetClusterNodesRequest newInstance(EnumSet<NodeState> states) {
GetClusterNodesRequest request =
Records.newRecord(GetClusterNodesRequest.class);
request.setNodeStates(states);
return request;
}
@Public
@Stable
public static GetClusterNodesRequest newInstance() {
GetClusterNodesRequest request =
Records.newRecord(GetClusterNodesRequest.class);
return request;
}
/**
* The state to filter the cluster nodes with.
*/
public abstract EnumSet<NodeState> getNodeStates();
/**
* The state to filter the cluster nodes with.
*/
public abstract void setNodeStates(EnumSet<NodeState> states);
}
| 2,224 | 32.208955 | 79 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetClusterMetricsRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The request sent by clients to get cluster metrics from the
* <code>ResourceManager</code>.</p>
*
* <p>Currently, this is empty.</p>
*
* @see ApplicationClientProtocol#getClusterMetrics(GetClusterMetricsRequest)
*/
@Public
@Stable
public abstract class GetClusterMetricsRequest {
@Public
@Stable
public static GetClusterMetricsRequest newInstance() {
GetClusterMetricsRequest request =
Records.newRecord(GetClusterMetricsRequest.class);
return request;
}
}
| 1,599 | 34.555556 | 77 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetApplicationReportResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The response sent by the <code>ResourceManager</code> to a client
* requesting an application report.</p>
*
* <p>The response includes an {@link ApplicationReport} which has details such
* as user, queue, name, host on which the <code>ApplicationMaster</code> is
* running, RPC port, tracking URL, diagnostics, start time etc.</p>
*
* @see ApplicationClientProtocol#getApplicationReport(GetApplicationReportRequest)
*/
@Public
@Stable
public abstract class GetApplicationReportResponse {
@Private
@Unstable
public static GetApplicationReportResponse newInstance(
ApplicationReport ApplicationReport) {
GetApplicationReportResponse response =
Records.newRecord(GetApplicationReportResponse.class);
response.setApplicationReport(ApplicationReport);
return response;
}
/**
* Get the <code>ApplicationReport</code> for the application.
* @return <code>ApplicationReport</code> for the application
*/
@Public
@Stable
public abstract ApplicationReport getApplicationReport();
@Private
@Unstable
public abstract void setApplicationReport(ApplicationReport ApplicationReport);
}
| 2,452 | 36.738462 | 83 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetLabelsToNodesRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.Set;
import org.apache.hadoop.yarn.util.Records;
public abstract class GetLabelsToNodesRequest {
public static GetLabelsToNodesRequest newInstance() {
return Records.newRecord(GetLabelsToNodesRequest.class);
}
public static GetLabelsToNodesRequest newInstance(Set<String> nodeLabels) {
GetLabelsToNodesRequest request =
Records.newRecord(GetLabelsToNodesRequest.class);
request.setNodeLabels(nodeLabels);
return request;
}
public abstract void setNodeLabels(Set<String> nodeLabels);
public abstract Set<String> getNodeLabels();
}
| 1,433 | 33.97561 | 77 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/AllocateRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ResourceBlacklistRequest;
import org.apache.hadoop.yarn.api.records.ContainerResourceIncreaseRequest;
import org.apache.hadoop.yarn.api.records.ResourceRequest;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The core request sent by the <code>ApplicationMaster</code> to the
* <code>ResourceManager</code> to obtain resources in the cluster.</p>
*
* <p>The request includes:
* <ul>
* <li>A response id to track duplicate responses.</li>
* <li>Progress information.</li>
* <li>
* A list of {@link ResourceRequest} to inform the
* <code>ResourceManager</code> about the application's
* resource requirements.
* </li>
* <li>
* A list of unused {@link Container} which are being returned.
* </li>
* </ul>
*
* @see ApplicationMasterProtocol#allocate(AllocateRequest)
*/
@Public
@Stable
public abstract class AllocateRequest {
@Public
@Stable
public static AllocateRequest newInstance(int responseID, float appProgress,
List<ResourceRequest> resourceAsk,
List<ContainerId> containersToBeReleased,
ResourceBlacklistRequest resourceBlacklistRequest) {
return newInstance(responseID, appProgress, resourceAsk,
containersToBeReleased, resourceBlacklistRequest, null);
}
@Public
@Stable
public static AllocateRequest newInstance(int responseID, float appProgress,
List<ResourceRequest> resourceAsk,
List<ContainerId> containersToBeReleased,
ResourceBlacklistRequest resourceBlacklistRequest,
List<ContainerResourceIncreaseRequest> increaseRequests) {
AllocateRequest allocateRequest = Records.newRecord(AllocateRequest.class);
allocateRequest.setResponseId(responseID);
allocateRequest.setProgress(appProgress);
allocateRequest.setAskList(resourceAsk);
allocateRequest.setReleaseList(containersToBeReleased);
allocateRequest.setResourceBlacklistRequest(resourceBlacklistRequest);
allocateRequest.setIncreaseRequests(increaseRequests);
return allocateRequest;
}
/**
* Get the <em>response id</em> used to track duplicate responses.
* @return <em>response id</em>
*/
@Public
@Stable
public abstract int getResponseId();
/**
* Set the <em>response id</em> used to track duplicate responses.
* @param id <em>response id</em>
*/
@Public
@Stable
public abstract void setResponseId(int id);
/**
* Get the <em>current progress</em> of application.
* @return <em>current progress</em> of application
*/
@Public
@Stable
public abstract float getProgress();
/**
* Set the <em>current progress</em> of application
* @param progress <em>current progress</em> of application
*/
@Public
@Stable
public abstract void setProgress(float progress);
/**
* Get the list of <code>ResourceRequest</code> to update the
* <code>ResourceManager</code> about the application's resource requirements.
* @return the list of <code>ResourceRequest</code>
* @see ResourceRequest
*/
@Public
@Stable
public abstract List<ResourceRequest> getAskList();
/**
* Set list of <code>ResourceRequest</code> to update the
* <code>ResourceManager</code> about the application's resource requirements.
* @param resourceRequests list of <code>ResourceRequest</code> to update the
* <code>ResourceManager</code> about the application's
* resource requirements
* @see ResourceRequest
*/
@Public
@Stable
public abstract void setAskList(List<ResourceRequest> resourceRequests);
/**
* Get the list of <code>ContainerId</code> of containers being
* released by the <code>ApplicationMaster</code>.
* @return list of <code>ContainerId</code> of containers being
* released by the <code>ApplicationMaster</code>
*/
@Public
@Stable
public abstract List<ContainerId> getReleaseList();
/**
* Set the list of <code>ContainerId</code> of containers being
* released by the <code>ApplicationMaster</code>
* @param releaseContainers list of <code>ContainerId</code> of
* containers being released by the
* <code>ApplicationMaster</code>
*/
@Public
@Stable
public abstract void setReleaseList(List<ContainerId> releaseContainers);
/**
* Get the <code>ResourceBlacklistRequest</code> being sent by the
* <code>ApplicationMaster</code>.
* @return the <code>ResourceBlacklistRequest</code> being sent by the
* <code>ApplicationMaster</code>
* @see ResourceBlacklistRequest
*/
@Public
@Stable
public abstract ResourceBlacklistRequest getResourceBlacklistRequest();
/**
* Set the <code>ResourceBlacklistRequest</code> to inform the
* <code>ResourceManager</code> about the blacklist additions and removals
* per the <code>ApplicationMaster</code>.
*
* @param resourceBlacklistRequest the <code>ResourceBlacklistRequest</code>
* to inform the <code>ResourceManager</code> about
* the blacklist additions and removals
* per the <code>ApplicationMaster</code>
* @see ResourceBlacklistRequest
*/
@Public
@Stable
public abstract void setResourceBlacklistRequest(
ResourceBlacklistRequest resourceBlacklistRequest);
/**
* Get the <code>ContainerResourceIncreaseRequest</code> being sent by the
* <code>ApplicationMaster</code>
*/
@Public
@Stable
public abstract List<ContainerResourceIncreaseRequest> getIncreaseRequests();
/**
* Set the <code>ContainerResourceIncreaseRequest</code> to inform the
* <code>ResourceManager</code> about some container's resources need to be
* increased
*/
@Public
@Stable
public abstract void setIncreaseRequests(
List<ContainerResourceIncreaseRequest> increaseRequests);
}
| 7,122 | 33.916667 | 81 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerStatusesResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.List;
import java.util.Map;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ContainerStatus;
import org.apache.hadoop.yarn.api.records.SerializedException;
import org.apache.hadoop.yarn.util.Records;
/**
* The response sent by the <code>NodeManager</code> to the
* <code>ApplicationMaster</code> when asked to obtain the
* <code>ContainerStatus</code> of requested containers.
*
* @see ContainerManagementProtocol#getContainerStatuses(GetContainerStatusesRequest)
*/
@Public
@Stable
public abstract class GetContainerStatusesResponse {
@Private
@Unstable
public static GetContainerStatusesResponse newInstance(
List<ContainerStatus> statuses,
Map<ContainerId, SerializedException> failedRequests) {
GetContainerStatusesResponse response =
Records.newRecord(GetContainerStatusesResponse.class);
response.setContainerStatuses(statuses);
response.setFailedRequests(failedRequests);
return response;
}
/**
* Get the <code>ContainerStatus</code>es of the requested containers.
*
* @return <code>ContainerStatus</code>es of the requested containers.
*/
@Public
@Stable
public abstract List<ContainerStatus> getContainerStatuses();
/**
* Set the <code>ContainerStatus</code>es of the requested containers.
*/
@Private
@Unstable
public abstract void setContainerStatuses(List<ContainerStatus> statuses);
/**
* Get the containerId-to-exception map in which the exception indicates error
* from per container for failed requests
*/
@Public
@Stable
public abstract Map<ContainerId, SerializedException> getFailedRequests();
/**
* Set the containerId-to-exception map in which the exception indicates error
* from per container for failed requests
*/
@Private
@Unstable
public abstract void setFailedRequests(
Map<ContainerId, SerializedException> failedContainers);
}
| 3,149 | 34 | 85 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetLabelsToNodesResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.Map;
import java.util.Set;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.NodeLabel;
import org.apache.hadoop.yarn.util.Records;
public abstract class GetLabelsToNodesResponse {
public static GetLabelsToNodesResponse newInstance(
Map<NodeLabel, Set<NodeId>> map) {
GetLabelsToNodesResponse response =
Records.newRecord(GetLabelsToNodesResponse.class);
response.setLabelsToNodes(map);
return response;
}
@Public
@Evolving
public abstract void setLabelsToNodes(Map<NodeLabel, Set<NodeId>> map);
@Public
@Evolving
public abstract Map<NodeLabel, Set<NodeId>> getLabelsToNodes();
}
| 1,661 | 35.130435 | 74 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetApplicationAttemptReportResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The response sent by the <code>ResourceManager</code> to a client requesting
* an application attempt report.
* </p>
*
* <p>
* The response includes an {@link ApplicationAttemptReport} which has the
* details about the particular application attempt
* </p>
*
* @see ApplicationAttemptReport
* @see ApplicationHistoryProtocol#getApplicationAttemptReport(GetApplicationAttemptReportRequest)
*/
@Public
@Unstable
public abstract class GetApplicationAttemptReportResponse {
@Public
@Unstable
public static GetApplicationAttemptReportResponse newInstance(
ApplicationAttemptReport ApplicationAttemptReport) {
GetApplicationAttemptReportResponse response =
Records.newRecord(GetApplicationAttemptReportResponse.class);
response.setApplicationAttemptReport(ApplicationAttemptReport);
return response;
}
/**
* Get the <code>ApplicationAttemptReport</code> for the application attempt.
*
* @return <code>ApplicationAttemptReport</code> for the application attempt
*/
@Public
@Unstable
public abstract ApplicationAttemptReport getApplicationAttemptReport();
/**
* Get the <code>ApplicationAttemptReport</code> for the application attempt.
*
* @param applicationAttemptReport
* <code>ApplicationAttemptReport</code> for the application attempt
*/
@Public
@Unstable
public abstract void setApplicationAttemptReport(
ApplicationAttemptReport applicationAttemptReport);
}
| 2,653 | 34.386667 | 98 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetApplicationAttemptReportRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptReport;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The request sent by a client to the <code>ResourceManager</code> to get an
* {@link ApplicationAttemptReport} for an application attempt.
* </p>
*
* <p>
* The request should include the {@link ApplicationAttemptId} of the
* application attempt.
* </p>
*
* @see ApplicationAttemptReport
* @see ApplicationHistoryProtocol#getApplicationAttemptReport(GetApplicationAttemptReportRequest)
*/
@Public
@Unstable
public abstract class GetApplicationAttemptReportRequest {
@Public
@Unstable
public static GetApplicationAttemptReportRequest newInstance(
ApplicationAttemptId applicationAttemptId) {
GetApplicationAttemptReportRequest request =
Records.newRecord(GetApplicationAttemptReportRequest.class);
request.setApplicationAttemptId(applicationAttemptId);
return request;
}
/**
* Get the <code>ApplicationAttemptId</code> of an application attempt.
*
* @return <code>ApplicationAttemptId</code> of an application attempt
*/
@Public
@Unstable
public abstract ApplicationAttemptId getApplicationAttemptId();
/**
* Set the <code>ApplicationAttemptId</code> of an application attempt
*
* @param applicationAttemptId
* <code>ApplicationAttemptId</code> of an application attempt
*/
@Public
@Unstable
public abstract void setApplicationAttemptId(
ApplicationAttemptId applicationAttemptId);
}
| 2,640 | 33.75 | 98 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetClusterMetricsResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.records.YarnClusterMetrics;
import org.apache.hadoop.yarn.util.Records;
/**
* The response sent by the <code>ResourceManager</code> to a client
* requesting cluster metrics.
*
* @see YarnClusterMetrics
* @see ApplicationClientProtocol#getClusterMetrics(GetClusterMetricsRequest)
*/
@Public
@Stable
public abstract class GetClusterMetricsResponse {
@Private
@Unstable
public static GetClusterMetricsResponse
newInstance(YarnClusterMetrics metrics) {
GetClusterMetricsResponse response =
Records.newRecord(GetClusterMetricsResponse.class);
response.setClusterMetrics(metrics);
return response;
}
/**
* Get the <code>YarnClusterMetrics</code> for the cluster.
* @return <code>YarnClusterMetrics</code> for the cluster
*/
@Public
@Stable
public abstract YarnClusterMetrics getClusterMetrics();
@Private
@Unstable
public abstract void setClusterMetrics(YarnClusterMetrics metrics);
}
| 2,174 | 34.080645 | 77 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationSubmissionRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.QueueInfo;
import org.apache.hadoop.yarn.api.records.ReservationDefinition;
import org.apache.hadoop.yarn.util.Records;
/**
* {@link ReservationSubmissionRequest} captures the set of requirements the
* user has to create a reservation.
*
* @see ReservationDefinition
*
*/
@Public
@Unstable
public abstract class ReservationSubmissionRequest {
@Public
@Unstable
public static ReservationSubmissionRequest newInstance(
ReservationDefinition reservationDefinition, String queueName) {
ReservationSubmissionRequest request =
Records.newRecord(ReservationSubmissionRequest.class);
request.setReservationDefinition(reservationDefinition);
request.setQueue(queueName);
return request;
}
/**
* Get the {@link ReservationDefinition} representing the user constraints for
* this reservation
*
* @return the reservation definition representing user constraints
*/
@Public
@Unstable
public abstract ReservationDefinition getReservationDefinition();
/**
* Set the {@link ReservationDefinition} representing the user constraints for
* this reservation
*
* @param reservationDefinition the reservation request representing the
* reservation
*/
@Public
@Unstable
public abstract void setReservationDefinition(
ReservationDefinition reservationDefinition);
/**
* Get the name of the {@code Plan} that corresponds to the name of the
* {@link QueueInfo} in the scheduler to which the reservation will be
* submitted to.
*
* @return the name of the {@code Plan} that corresponds to the name of the
* {@link QueueInfo} in the scheduler to which the reservation will be
* submitted to
*/
@Public
@Unstable
public abstract String getQueue();
/**
* Set the name of the {@code Plan} that corresponds to the name of the
* {@link QueueInfo} in the scheduler to which the reservation will be
* submitted to
*
* @param queueName the name of the parent {@code Plan} that corresponds to
* the name of the {@link QueueInfo} in the scheduler to which the
* reservation will be submitted to
*/
@Public
@Unstable
public abstract void setQueue(String queueName);
}
| 3,286 | 32.540816 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetContainerReportRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.api.records.ContainerReport;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The request sent by a client to the <code>ResourceManager</code> to get an
* {@link ContainerReport} for a container.
* </p>
*/
@Public
@Unstable
public abstract class GetContainerReportRequest {
@Public
@Unstable
public static GetContainerReportRequest newInstance(ContainerId containerId) {
GetContainerReportRequest request =
Records.newRecord(GetContainerReportRequest.class);
request.setContainerId(containerId);
return request;
}
/**
* Get the <code>ContainerId</code> of the Container.
*
* @return <code>ContainerId</code> of the Container
*/
@Public
@Unstable
public abstract ContainerId getContainerId();
/**
* Set the <code>ContainerId</code> of the container
*
* @param containerId
* <code>ContainerId</code> of the container
*/
@Public
@Unstable
public abstract void setContainerId(ContainerId containerId);
}
| 2,079 | 31 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetClusterNodeLabelsRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.yarn.util.Records;
@Public
@Evolving
public abstract class GetClusterNodeLabelsRequest {
public static GetClusterNodeLabelsRequest newInstance() {
return Records.newRecord(GetClusterNodeLabelsRequest.class);
}
}
| 1,242 | 37.84375 | 75 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetNodesToLabelsResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.Map;
import java.util.Set;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.yarn.api.records.NodeId;
import org.apache.hadoop.yarn.api.records.NodeLabel;
import org.apache.hadoop.yarn.util.Records;
public abstract class GetNodesToLabelsResponse {
public static GetNodesToLabelsResponse newInstance(
Map<NodeId, Set<NodeLabel>> map) {
GetNodesToLabelsResponse response =
Records.newRecord(GetNodesToLabelsResponse.class);
response.setNodeToLabels(map);
return response;
}
@Public
@Evolving
public abstract void setNodeToLabels(Map<NodeId, Set<NodeLabel>> map);
@Public
@Evolving
public abstract Map<NodeId, Set<NodeLabel>> getNodeToLabels();
}
| 1,662 | 34.382979 | 74 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetNodesToLabelsRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.yarn.util.Records;
public abstract class GetNodesToLabelsRequest {
public static GetNodesToLabelsRequest newInstance() {
return Records.newRecord(GetNodesToLabelsRequest.class);
}
}
| 1,060 | 38.296296 | 74 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/RenewDelegationTokenRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.Token;
import org.apache.hadoop.yarn.util.Records;
/**
* The request issued by the client to renew a delegation token from
* the {@code ResourceManager}.
*/
@Private
@Unstable
public abstract class RenewDelegationTokenRequest {
@Private
@Unstable
public static RenewDelegationTokenRequest newInstance(Token dToken) {
RenewDelegationTokenRequest request =
Records.newRecord(RenewDelegationTokenRequest.class);
request.setDelegationToken(dToken);
return request;
}
/**
* Get the delegation token requested to be renewed by the client.
* @return the delegation token requested to be renewed by the client.
*/
@Private
@Unstable
public abstract Token getDelegationToken();
@Private
@Unstable
public abstract void setDelegationToken(Token dToken);
}
| 1,841 | 33.111111 | 75 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ReservationSubmissionResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.records.ReservationDefinition;
import org.apache.hadoop.yarn.api.records.ReservationId;
import org.apache.hadoop.yarn.util.Records;
/**
* {@link ReservationSubmissionResponse} contains the answer of the admission
* control system in the {@code ResourceManager} to a reservation create
* operation. Response contains a {@link ReservationId} if the operation was
* successful, if not an exception reporting reason for a failure.
*
* @see ReservationDefinition
*
*/
@Public
@Unstable
public abstract class ReservationSubmissionResponse {
@Private
@Unstable
public static ReservationSubmissionResponse newInstance(
ReservationId reservationId) {
ReservationSubmissionResponse response =
Records.newRecord(ReservationSubmissionResponse.class);
response.setReservationId(reservationId);
return response;
}
/**
* Get the {@link ReservationId}, that corresponds to a valid resource
* allocation in the scheduler (between start and end time of this
* reservation)
*
* @return the {@link ReservationId} representing the unique id of the
* corresponding reserved resource allocation in the scheduler
*/
@Public
@Unstable
public abstract ReservationId getReservationId();
/**
* Set the {@link ReservationId}, that correspond to a valid resource
* allocation in the scheduler (between start and end time of this
* reservation)
*
* @param reservationId the {@link ReservationId} representing the the unique
* id of the corresponding reserved resource allocation in the
* scheduler
*/
@Private
@Unstable
public abstract void setReservationId(ReservationId reservationId);
}
| 2,794 | 35.298701 | 79 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetNewApplicationResponse.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The response sent by the <code>ResourceManager</code> to the client for
* a request to get a new {@link ApplicationId} for submitting applications.</p>
*
* <p>Clients can submit an application with the returned
* {@link ApplicationId}.</p>
*
* @see ApplicationClientProtocol#getNewApplication(GetNewApplicationRequest)
*/
@Public
@Stable
public abstract class GetNewApplicationResponse {
@Private
@Unstable
public static GetNewApplicationResponse newInstance(
ApplicationId applicationId, Resource minCapability,
Resource maxCapability) {
GetNewApplicationResponse response =
Records.newRecord(GetNewApplicationResponse.class);
response.setApplicationId(applicationId);
response.setMaximumResourceCapability(maxCapability);
return response;
}
/**
* Get the <em>new</em> <code>ApplicationId</code> allocated by the
* <code>ResourceManager</code>.
* @return <em>new</em> <code>ApplicationId</code> allocated by the
* <code>ResourceManager</code>
*/
@Public
@Stable
public abstract ApplicationId getApplicationId();
@Private
@Unstable
public abstract void setApplicationId(ApplicationId applicationId);
/**
* Get the maximum capability for any {@link Resource} allocated by the
* <code>ResourceManager</code> in the cluster.
* @return maximum capability of allocated resources in the cluster
*/
@Public
@Stable
public abstract Resource getMaximumResourceCapability();
@Private
@Unstable
public abstract void setMaximumResourceCapability(Resource capability);
}
| 2,941 | 34.878049 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StopContainersRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
import org.apache.hadoop.yarn.api.records.ContainerId;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The request sent by the <code>ApplicationMaster</code> to the
* <code>NodeManager</code> to <em>stop</em> containers.</p>
*
* @see ContainerManagementProtocol#stopContainers(StopContainersRequest)
*/
@Public
@Stable
public abstract class StopContainersRequest {
@Public
@Stable
public static StopContainersRequest newInstance(List<ContainerId> containerIds) {
StopContainersRequest request =
Records.newRecord(StopContainersRequest.class);
request.setContainerIds(containerIds);
return request;
}
/**
* Get the <code>ContainerId</code>s of the containers to be stopped.
* @return <code>ContainerId</code>s of containers to be stopped
*/
@Public
@Stable
public abstract List<ContainerId> getContainerIds();
/**
* Set the <code>ContainerId</code>s of the containers to be stopped.
* @param containerIds <code>ContainerId</code>s of the containers to be stopped
*/
@Public
@Stable
public abstract void setContainerIds(List<ContainerId> containerIds);
}
| 2,197 | 33.34375 | 83 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/GetApplicationAttemptsRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.protocolrecords;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationHistoryProtocol;
import org.apache.hadoop.yarn.api.records.ApplicationId;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>
* The request from clients to get a list of application attempt reports of an
* application from the <code>ResourceManager</code>.
* </p>
*
* @see ApplicationHistoryProtocol#getApplicationAttempts(GetApplicationAttemptsRequest)
*/
@Public
@Unstable
public abstract class GetApplicationAttemptsRequest {
@Public
@Unstable
public static GetApplicationAttemptsRequest newInstance(
ApplicationId applicationId) {
GetApplicationAttemptsRequest request =
Records.newRecord(GetApplicationAttemptsRequest.class);
request.setApplicationId(applicationId);
return request;
}
/**
* Get the <code>ApplicationId</code> of an application
*
* @return <code>ApplicationId</code> of an application
*/
@Public
@Unstable
public abstract ApplicationId getApplicationId();
/**
* Set the <code>ApplicationId</code> of an application
*
* @param applicationId
* <code>ApplicationId</code> of an application
*/
@Public
@Unstable
public abstract void setApplicationId(ApplicationId applicationId);
}
| 2,242 | 31.985294 | 88 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeId.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* <p><code>NodeId</code> is the unique identifier for a node.</p>
*
* <p>It includes the <em>hostname</em> and <em>port</em> to uniquely
* identify the node. Thus, it is unique across restarts of any
* <code>NodeManager</code>.</p>
*/
@Public
@Stable
public abstract class NodeId implements Comparable<NodeId> {
@Private
@Unstable
public static NodeId newInstance(String host, int port) {
NodeId nodeId = Records.newRecord(NodeId.class);
nodeId.setHost(host);
nodeId.setPort(port);
nodeId.build();
return nodeId;
}
/**
* Get the <em>hostname</em> of the node.
* @return <em>hostname</em> of the node
*/
@Public
@Stable
public abstract String getHost();
@Private
@Unstable
protected abstract void setHost(String host);
/**
* Get the <em>port</em> for communicating with the node.
* @return <em>port</em> for communicating with the node
*/
@Public
@Stable
public abstract int getPort();
@Private
@Unstable
protected abstract void setPort(int port);
@Override
public String toString() {
return this.getHost() + ":" + this.getPort();
}
@Override
public int hashCode() {
final int prime = 493217;
int result = 8501;
result = prime * result + this.getHost().hashCode();
result = prime * result + this.getPort();
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NodeId other = (NodeId) obj;
if (!this.getHost().equals(other.getHost()))
return false;
if (this.getPort() != other.getPort())
return false;
return true;
}
@Override
public int compareTo(NodeId other) {
int hostCompare = this.getHost().compareTo(other.getHost());
if (hostCompare == 0) {
if (this.getPort() > other.getPort()) {
return 1;
} else if (this.getPort() < other.getPort()) {
return -1;
}
return 0;
}
return hostCompare;
}
protected abstract void build();
}
| 3,278 | 26.788136 | 75 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeReport.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import java.util.Set;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.util.Records;
/**
* {@code NodeReport} is a summary of runtime information of a node
* in the cluster.
* <p>
* It includes details such as:
* <ul>
* <li>{@link NodeId} of the node.</li>
* <li>HTTP Tracking URL of the node.</li>
* <li>Rack name for the node.</li>
* <li>Used {@link Resource} on the node.</li>
* <li>Total available {@link Resource} of the node.</li>
* <li>Number of running containers on the node.</li>
* </ul>
*
* @see ApplicationClientProtocol#getClusterNodes(org.apache.hadoop.yarn.api.protocolrecords.GetClusterNodesRequest)
*/
@Public
@Stable
public abstract class NodeReport {
@Private
@Unstable
public static NodeReport newInstance(NodeId nodeId, NodeState nodeState,
String httpAddress, String rackName, Resource used, Resource capability,
int numContainers, String healthReport, long lastHealthReportTime) {
return newInstance(nodeId, nodeState, httpAddress, rackName, used,
capability, numContainers, healthReport, lastHealthReportTime, null);
}
@Private
@Unstable
public static NodeReport newInstance(NodeId nodeId, NodeState nodeState,
String httpAddress, String rackName, Resource used, Resource capability,
int numContainers, String healthReport, long lastHealthReportTime,
Set<String> nodeLabels) {
NodeReport nodeReport = Records.newRecord(NodeReport.class);
nodeReport.setNodeId(nodeId);
nodeReport.setNodeState(nodeState);
nodeReport.setHttpAddress(httpAddress);
nodeReport.setRackName(rackName);
nodeReport.setUsed(used);
nodeReport.setCapability(capability);
nodeReport.setNumContainers(numContainers);
nodeReport.setHealthReport(healthReport);
nodeReport.setLastHealthReportTime(lastHealthReportTime);
nodeReport.setNodeLabels(nodeLabels);
return nodeReport;
}
/**
* Get the <code>NodeId</code> of the node.
* @return <code>NodeId</code> of the node
*/
@Public
@Stable
public abstract NodeId getNodeId();
@Private
@Unstable
public abstract void setNodeId(NodeId nodeId);
/**
* Get the <code>NodeState</code> of the node.
* @return <code>NodeState</code> of the node
*/
@Public
@Stable
public abstract NodeState getNodeState();
@Private
@Unstable
public abstract void setNodeState(NodeState nodeState);
/**
* Get the <em>http address</em> of the node.
* @return <em>http address</em> of the node
*/
@Public
@Stable
public abstract String getHttpAddress();
@Private
@Unstable
public abstract void setHttpAddress(String httpAddress);
/**
* Get the <em>rack name</em> for the node.
* @return <em>rack name</em> for the node
*/
@Public
@Stable
public abstract String getRackName();
@Private
@Unstable
public abstract void setRackName(String rackName);
/**
* Get <em>used</em> <code>Resource</code> on the node.
* @return <em>used</em> <code>Resource</code> on the node
*/
@Public
@Stable
public abstract Resource getUsed();
@Private
@Unstable
public abstract void setUsed(Resource used);
/**
* Get the <em>total</em> <code>Resource</code> on the node.
* @return <em>total</em> <code>Resource</code> on the node
*/
@Public
@Stable
public abstract Resource getCapability();
@Private
@Unstable
public abstract void setCapability(Resource capability);
/**
* Get the <em>number of allocated containers</em> on the node.
* @return <em>number of allocated containers</em> on the node
*/
@Private
@Unstable
public abstract int getNumContainers();
@Private
@Unstable
public abstract void setNumContainers(int numContainers);
/**
* Get the <em>diagnostic health report</em> of the node.
* @return <em>diagnostic health report</em> of the node
*/
@Public
@Stable
public abstract String getHealthReport();
@Private
@Unstable
public abstract void setHealthReport(String healthReport);
/**
* Get the <em>last timestamp</em> at which the health report was received.
* @return <em>last timestamp</em> at which the health report was received
*/
@Public
@Stable
public abstract long getLastHealthReportTime();
@Private
@Unstable
public abstract void setLastHealthReportTime(long lastHealthReport);
/**
* Get labels of this node
* @return labels of this node
*/
@Public
@Stable
public abstract Set<String> getNodeLabels();
@Private
@Unstable
public abstract void setNodeLabels(Set<String> nodeLabels);
}
| 5,775 | 27.88 | 116 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationAttemptReport.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* {@code ApplicationAttemptReport} is a report of an application attempt.
* <p>
* It includes details such as:
* <ul>
* <li>{@link ApplicationAttemptId} of the application.</li>
* <li>Host on which the <code>ApplicationMaster</code> of this attempt is
* running.</li>
* <li>RPC port of the <code>ApplicationMaster</code> of this attempt.</li>
* <li>Tracking URL.</li>
* <li>Diagnostic information in case of errors.</li>
* <li>{@link YarnApplicationAttemptState} of the application attempt.</li>
* <li>{@link ContainerId} of the master Container.</li>
* </ul>
*/
@Public
@Unstable
public abstract class ApplicationAttemptReport {
@Private
@Unstable
public static ApplicationAttemptReport newInstance(
ApplicationAttemptId applicationAttemptId, String host, int rpcPort,
String url, String oUrl, String diagnostics,
YarnApplicationAttemptState state, ContainerId amContainerId,
long startTime, long finishTime) {
ApplicationAttemptReport report =
Records.newRecord(ApplicationAttemptReport.class);
report.setApplicationAttemptId(applicationAttemptId);
report.setHost(host);
report.setRpcPort(rpcPort);
report.setTrackingUrl(url);
report.setOriginalTrackingUrl(oUrl);
report.setDiagnostics(diagnostics);
report.setYarnApplicationAttemptState(state);
report.setAMContainerId(amContainerId);
report.setStartTime(startTime);
report.setFinishTime(finishTime);
return report;
}
public static ApplicationAttemptReport newInstance(
ApplicationAttemptId applicationAttemptId, String host, int rpcPort,
String url, String oUrl, String diagnostics,
YarnApplicationAttemptState state, ContainerId amContainerId) {
return newInstance(applicationAttemptId, host, rpcPort, url, oUrl,
diagnostics, state, amContainerId, 0L, 0L);
}
/**
* Get the <em>YarnApplicationAttemptState</em> of the application attempt.
*
* @return <em>YarnApplicationAttemptState</em> of the application attempt
*/
@Public
@Unstable
public abstract YarnApplicationAttemptState getYarnApplicationAttemptState();
@Private
@Unstable
public abstract void setYarnApplicationAttemptState(
YarnApplicationAttemptState yarnApplicationAttemptState);
/**
* Get the <em>RPC port</em> of this attempt <code>ApplicationMaster</code>.
*
* @return <em>RPC port</em> of this attempt <code>ApplicationMaster</code>
*/
@Public
@Unstable
public abstract int getRpcPort();
@Private
@Unstable
public abstract void setRpcPort(int rpcPort);
/**
* Get the <em>host</em> on which this attempt of
* <code>ApplicationMaster</code> is running.
*
* @return <em>host</em> on which this attempt of
* <code>ApplicationMaster</code> is running
*/
@Public
@Unstable
public abstract String getHost();
@Private
@Unstable
public abstract void setHost(String host);
/**
* Get the <em>diagnositic information</em> of the application attempt in case
* of errors.
*
* @return <em>diagnositic information</em> of the application attempt in case
* of errors
*/
@Public
@Unstable
public abstract String getDiagnostics();
@Private
@Unstable
public abstract void setDiagnostics(String diagnostics);
/**
* Get the <em>tracking url</em> for the application attempt.
*
* @return <em>tracking url</em> for the application attempt
*/
@Public
@Unstable
public abstract String getTrackingUrl();
@Private
@Unstable
public abstract void setTrackingUrl(String url);
/**
* Get the <em>original tracking url</em> for the application attempt.
*
* @return <em>original tracking url</em> for the application attempt
*/
@Public
@Unstable
public abstract String getOriginalTrackingUrl();
@Private
@Unstable
public abstract void setOriginalTrackingUrl(String oUrl);
/**
* Get the <code>ApplicationAttemptId</code> of this attempt of the
* application
*
* @return <code>ApplicationAttemptId</code> of the attempt
*/
@Public
@Unstable
public abstract ApplicationAttemptId getApplicationAttemptId();
@Private
@Unstable
public abstract void setApplicationAttemptId(
ApplicationAttemptId applicationAttemptId);
/**
* Get the <code>ContainerId</code> of AMContainer for this attempt
*
* @return <code>ContainerId</code> of the attempt
*/
@Public
@Unstable
public abstract ContainerId getAMContainerId();
@Private
@Unstable
public abstract void setAMContainerId(ContainerId amContainerId);
@Public
@Unstable
public abstract long getStartTime();
@Private
@Unstable
public abstract void setStartTime(long startTime);
/**
* Get the <em>finish time</em> of the application.
*
* @return <em>finish time</em> of the application
*/
@Public
@Unstable
public abstract long getFinishTime();
@Private
@Unstable
public abstract void setFinishTime(long finishTime);
}
| 6,117 | 28.555556 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerStatus.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* {@code ContainerStatus} represents the current status of a
* {@code Container}.
* <p>
* It provides details such as:
* <ul>
* <li>{@code ContainerId} of the container.</li>
* <li>{@code ContainerState} of the container.</li>
* <li><em>Exit status</em> of a completed container.</li>
* <li><em>Diagnostic</em> message for a failed container.</li>
* </ul>
*/
@Public
@Stable
public abstract class ContainerStatus {
@Private
@Unstable
public static ContainerStatus newInstance(ContainerId containerId,
ContainerState containerState, String diagnostics, int exitStatus) {
ContainerStatus containerStatus = Records.newRecord(ContainerStatus.class);
containerStatus.setState(containerState);
containerStatus.setContainerId(containerId);
containerStatus.setDiagnostics(diagnostics);
containerStatus.setExitStatus(exitStatus);
return containerStatus;
}
/**
* Get the <code>ContainerId</code> of the container.
* @return <code>ContainerId</code> of the container
*/
@Public
@Stable
public abstract ContainerId getContainerId();
@Private
@Unstable
public abstract void setContainerId(ContainerId containerId);
/**
* Get the <code>ContainerState</code> of the container.
* @return <code>ContainerState</code> of the container
*/
@Public
@Stable
public abstract ContainerState getState();
@Private
@Unstable
public abstract void setState(ContainerState state);
/**
* <p>Get the <em>exit status</em> for the container.</p>
*
* <p>Note: This is valid only for completed containers i.e. containers
* with state {@link ContainerState#COMPLETE}.
* Otherwise, it returns an ContainerExitStatus.INVALID.
* </p>
*
* <p>Containers killed by the framework, either due to being released by
* the application or being 'lost' due to node failures etc. have a special
* exit code of ContainerExitStatus.ABORTED.</p>
*
* <p>When threshold number of the nodemanager-local-directories or
* threshold number of the nodemanager-log-directories become bad, then
* container is not launched and is exited with ContainersExitStatus.DISKS_FAILED.
* </p>
*
* @return <em>exit status</em> for the container
*/
@Public
@Unstable
public abstract int getExitStatus();
@Private
@Unstable
public abstract void setExitStatus(int exitStatus);
/**
* Get <em>diagnostic messages</em> for failed containers.
* @return <em>diagnostic messages</em> for failed containers
*/
@Public
@Stable
public abstract String getDiagnostics();
@Private
@Unstable
public abstract void setDiagnostics(String diagnostics);
}
| 3,835 | 31.508475 | 84 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/package-info.java
|
/*
* 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.
*/
@InterfaceAudience.Public
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience;
| 936 | 41.590909 | 75 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/SerializedException.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
@Private
@Unstable
public abstract class SerializedException {
@Private
@Unstable
public static SerializedException newInstance(Throwable e) {
SerializedException exception =
Records.newRecord(SerializedException.class);
exception.init(e);
return exception;
}
/**
* Constructs a new <code>SerializedException</code> with the specified detail
* message and cause.
*/
@Private
@Unstable
public abstract void init(String message, Throwable cause);
/**
* Constructs a new <code>SerializedException</code> with the specified detail
* message.
*/
@Private
@Unstable
public abstract void init(String message);
/**
* Constructs a new <code>SerializedException</code> with the specified cause.
*/
@Private
@Unstable
public abstract void init(Throwable cause);
/**
* Get the detail message string of this exception.
* @return the detail message string of this exception.
*/
@Private
@Unstable
public abstract String getMessage();
/**
* Get the backtrace of this exception.
* @return the backtrace of this exception.
*/
@Private
@Unstable
public abstract String getRemoteTrace();
/**
* Get the cause of this exception or null if the cause is nonexistent or
* unknown.
* @return the cause of this exception.
*/
@Private
@Unstable
public abstract SerializedException getCause();
/**
* Deserialize the exception to a new Throwable.
* @return the Throwable form of this serialized exception.
*/
@Private
@Unstable
public abstract Throwable deSerialize();
private void stringify(StringBuilder sb) {
sb.append(getMessage())
.append("\n")
.append(getRemoteTrace());
final SerializedException cause = getCause();
if (cause != null) {
sb.append("Caused by: ");
cause.stringify(sb);
}
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder(128);
stringify(sb);
return sb.toString();
}
}
| 3,051 | 26.495495 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import java.nio.ByteBuffer;
import java.util.List;
import java.util.Map;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
import org.apache.hadoop.yarn.server.api.ApplicationInitializationContext;
import org.apache.hadoop.yarn.server.api.AuxiliaryService;
import org.apache.hadoop.yarn.util.Records;
/**
* {@code ContainerLaunchContext} represents all of the information
* needed by the {@code NodeManager} to launch a container.
* <p>
* It includes details such as:
* <ul>
* <li>{@link ContainerId} of the container.</li>
* <li>{@link Resource} allocated to the container.</li>
* <li>User to whom the container is allocated.</li>
* <li>Security tokens (if security is enabled).</li>
* <li>
* {@link LocalResource} necessary for running the container such
* as binaries, jar, shared-objects, side-files etc.
* </li>
* <li>Optional, application-specific binary service data.</li>
* <li>Environment variables for the launched process.</li>
* <li>Command to launch the container.</li>
* </ul>
*
* @see ContainerManagementProtocol#startContainers(org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest)
*/
@Public
@Stable
public abstract class ContainerLaunchContext {
@Public
@Stable
public static ContainerLaunchContext newInstance(
Map<String, LocalResource> localResources,
Map<String, String> environment, List<String> commands,
Map<String, ByteBuffer> serviceData, ByteBuffer tokens,
Map<ApplicationAccessType, String> acls) {
ContainerLaunchContext container =
Records.newRecord(ContainerLaunchContext.class);
container.setLocalResources(localResources);
container.setEnvironment(environment);
container.setCommands(commands);
container.setServiceData(serviceData);
container.setTokens(tokens);
container.setApplicationACLs(acls);
return container;
}
/**
* Get all the tokens needed by this container. It may include file-system
* tokens, ApplicationMaster related tokens if this container is an
* ApplicationMaster or framework level tokens needed by this container to
* communicate to various services in a secure manner.
*
* @return tokens needed by this container.
*/
@Public
@Stable
public abstract ByteBuffer getTokens();
/**
* Set security tokens needed by this container.
* @param tokens security tokens
*/
@Public
@Stable
public abstract void setTokens(ByteBuffer tokens);
/**
* Get <code>LocalResource</code> required by the container.
* @return all <code>LocalResource</code> required by the container
*/
@Public
@Stable
public abstract Map<String, LocalResource> getLocalResources();
/**
* Set <code>LocalResource</code> required by the container. All pre-existing
* Map entries are cleared before adding the new Map
* @param localResources <code>LocalResource</code> required by the container
*/
@Public
@Stable
public abstract void setLocalResources(Map<String, LocalResource> localResources);
/**
* <p>
* Get application-specific binary <em>service data</em>. This is a map keyed
* by the name of each {@link AuxiliaryService} that is configured on a
* NodeManager and value correspond to the application specific data targeted
* for the keyed {@link AuxiliaryService}.
* </p>
*
* <p>
* This will be used to initialize this application on the specific
* {@link AuxiliaryService} running on the NodeManager by calling
* {@link AuxiliaryService#initializeApplication(ApplicationInitializationContext)}
* </p>
*
* @return application-specific binary <em>service data</em>
*/
@Public
@Stable
public abstract Map<String, ByteBuffer> getServiceData();
/**
* <p>
* Set application-specific binary <em>service data</em>. This is a map keyed
* by the name of each {@link AuxiliaryService} that is configured on a
* NodeManager and value correspond to the application specific data targeted
* for the keyed {@link AuxiliaryService}. All pre-existing Map entries are
* preserved.
* </p>
*
* @param serviceData
* application-specific binary <em>service data</em>
*/
@Public
@Stable
public abstract void setServiceData(Map<String, ByteBuffer> serviceData);
/**
* Get <em>environment variables</em> for the container.
* @return <em>environment variables</em> for the container
*/
@Public
@Stable
public abstract Map<String, String> getEnvironment();
/**
* Add <em>environment variables</em> for the container. All pre-existing Map
* entries are cleared before adding the new Map
* @param environment <em>environment variables</em> for the container
*/
@Public
@Stable
public abstract void setEnvironment(Map<String, String> environment);
/**
* Get the list of <em>commands</em> for launching the container.
* @return the list of <em>commands</em> for launching the container
*/
@Public
@Stable
public abstract List<String> getCommands();
/**
* Add the list of <em>commands</em> for launching the container. All
* pre-existing List entries are cleared before adding the new List
* @param commands the list of <em>commands</em> for launching the container
*/
@Public
@Stable
public abstract void setCommands(List<String> commands);
/**
* Get the <code>ApplicationACL</code>s for the application.
* @return all the <code>ApplicationACL</code>s
*/
@Public
@Stable
public abstract Map<ApplicationAccessType, String> getApplicationACLs();
/**
* Set the <code>ApplicationACL</code>s for the application. All pre-existing
* Map entries are cleared before adding the new Map
* @param acls <code>ApplicationACL</code>s for the application
*/
@Public
@Stable
public abstract void setApplicationACLs(Map<ApplicationAccessType, String> acls);
}
| 6,881 | 33.582915 | 118 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NMToken.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
import org.apache.hadoop.yarn.util.Records;
/**
* <p>The NMToken is used for authenticating communication with
* <code>NodeManager</code></p>
* <p>It is issued by <code>ResourceMananger</code> when <code>ApplicationMaster</code>
* negotiates resource with <code>ResourceManager</code> and
* validated on <code>NodeManager</code> side.</p>
* @see AllocateResponse#getNMTokens()
*/
@Public
@Stable
public abstract class NMToken {
@Private
@Unstable
public static NMToken newInstance(NodeId nodeId, Token token) {
NMToken nmToken = Records.newRecord(NMToken.class);
nmToken.setNodeId(nodeId);
nmToken.setToken(token);
return nmToken;
}
/**
* Get the {@link NodeId} of the <code>NodeManager</code> for which the NMToken
* is used to authenticate.
* @return the {@link NodeId} of the <code>NodeManager</code> for which the
* NMToken is used to authenticate.
*/
@Public
@Stable
public abstract NodeId getNodeId();
@Public
@Stable
public abstract void setNodeId(NodeId nodeId);
/**
* Get the {@link Token} used for authenticating with <code>NodeManager</code>
* @return the {@link Token} used for authenticating with <code>NodeManager</code>
*/
@Public
@Stable
public abstract Token getToken();
@Public
@Stable
public abstract void setToken(Token token);
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result =
prime * result + ((getNodeId() == null) ? 0 : getNodeId().hashCode());
result =
prime * result + ((getToken() == null) ? 0 : getToken().hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
NMToken other = (NMToken) obj;
if (getNodeId() == null) {
if (other.getNodeId() != null)
return false;
} else if (!getNodeId().equals(other.getNodeId()))
return false;
if (getToken() == null) {
if (other.getToken() != null)
return false;
} else if (!getToken().equals(other.getToken()))
return false;
return true;
}
}
| 3,397 | 30.174312 | 87 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerState.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
/**
* <p>State of a <code>Container</code>.</p>
*/
@Public
@Stable
public enum ContainerState {
/** New container */
NEW,
/** Running container */
RUNNING,
/** Completed container */
COMPLETE
}
| 1,202 | 30.657895 | 75 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/StrictPreemptionContract.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import java.util.Set;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* Enumeration of particular allocations to be reclaimed. The platform will
* reclaim exactly these resources, so the <code>ApplicationMaster</code> (AM)
* may attempt to checkpoint work or adjust its execution plan to accommodate
* it. In contrast to {@link PreemptionContract}, the AM has no flexibility in
* selecting which resources to return to the cluster.
* @see PreemptionMessage
*/
@Public
@Evolving
public abstract class StrictPreemptionContract {
@Private
@Unstable
public static StrictPreemptionContract newInstance(Set<PreemptionContainer> containers) {
StrictPreemptionContract contract =
Records.newRecord(StrictPreemptionContract.class);
contract.setContainers(containers);
return contract;
}
/**
* Get the set of {@link PreemptionContainer} specifying containers owned by
* the <code>ApplicationMaster</code> that may be reclaimed by the
* <code>ResourceManager</code>.
* @return the set of {@link ContainerId} to be preempted.
*/
@Public
@Evolving
public abstract Set<PreemptionContainer> getContainers();
@Private
@Unstable
public abstract void setContainers(Set<PreemptionContainer> containers);
}
| 2,380 | 36.203125 | 91 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/YarnClusterMetrics.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* <p><code>YarnClusterMetrics</code> represents cluster metrics.</p>
*
* <p>Currently only number of <code>NodeManager</code>s is provided.</p>
*/
@Public
@Stable
public abstract class YarnClusterMetrics {
@Private
@Unstable
public static YarnClusterMetrics newInstance(int numNodeManagers) {
YarnClusterMetrics metrics = Records.newRecord(YarnClusterMetrics.class);
metrics.setNumNodeManagers(numNodeManagers);
return metrics;
}
/**
* Get the number of <code>NodeManager</code>s in the cluster.
* @return number of <code>NodeManager</code>s in the cluster
*/
@Public
@Stable
public abstract int getNumNodeManagers();
@Private
@Unstable
public abstract void setNumNodeManagers(int numNodeManagers);
/**
* Get the number of <code>DecommissionedNodeManager</code>s in the cluster.
*
* @return number of <code>DecommissionedNodeManager</code>s in the cluster
*/
@Public
@Unstable
public abstract int getNumDecommissionedNodeManagers();
@Private
@Unstable
public abstract void setNumDecommissionedNodeManagers(
int numDecommissionedNodeManagers);
/**
* Get the number of <code>ActiveNodeManager</code>s in the cluster.
*
* @return number of <code>ActiveNodeManager</code>s in the cluster
*/
@Public
@Unstable
public abstract int getNumActiveNodeManagers();
@Private
@Unstable
public abstract void setNumActiveNodeManagers(int numActiveNodeManagers);
/**
* Get the number of <code>LostNodeManager</code>s in the cluster.
*
* @return number of <code>LostNodeManager</code>s in the cluster
*/
@Public
@Unstable
public abstract int getNumLostNodeManagers();
@Private
@Unstable
public abstract void setNumLostNodeManagers(int numLostNodeManagers);
/**
* Get the number of <code>UnhealthyNodeManager</code>s in the cluster.
*
* @return number of <code>UnhealthyNodeManager</code>s in the cluster
*/
@Public
@Unstable
public abstract int getNumUnhealthyNodeManagers();
@Private
@Unstable
public abstract void setNumUnhealthyNodeManagers(int numUnhealthNodeManagers);
/**
* Get the number of <code>RebootedNodeManager</code>s in the cluster.
*
* @return number of <code>RebootedNodeManager</code>s in the cluster
*/
@Public
@Unstable
public abstract int getNumRebootedNodeManagers();
@Private
@Unstable
public abstract void setNumRebootedNodeManagers(int numRebootedNodeManagers);
}
| 3,647 | 28.658537 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueStatistics.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
import org.apache.hadoop.yarn.util.Records;
@InterfaceAudience.Public
@InterfaceStability.Unstable
public abstract class QueueStatistics {
@InterfaceAudience.Private
@InterfaceStability.Unstable
public static QueueStatistics newInstance(long submitted, long running,
long pending, long completed, long killed, long failed, long activeUsers,
long availableMemoryMB, long allocatedMemoryMB, long pendingMemoryMB,
long reservedMemoryMB, long availableVCores, long allocatedVCores,
long pendingVCores, long reservedVCores) {
QueueStatistics statistics = Records.newRecord(QueueStatistics.class);
statistics.setNumAppsSubmitted(submitted);
statistics.setNumAppsRunning(running);
statistics.setNumAppsPending(pending);
statistics.setNumAppsCompleted(completed);
statistics.setNumAppsKilled(killed);
statistics.setNumAppsFailed(failed);
statistics.setNumActiveUsers(activeUsers);
statistics.setAvailableMemoryMB(availableMemoryMB);
statistics.setAllocatedMemoryMB(allocatedMemoryMB);
statistics.setPendingMemoryMB(pendingMemoryMB);
statistics.setReservedMemoryMB(reservedMemoryMB);
statistics.setAvailableVCores(availableVCores);
statistics.setAllocatedVCores(allocatedVCores);
statistics.setPendingVCores(pendingVCores);
statistics.setReservedVCores(reservedVCores);
return statistics;
}
/**
* Get the number of apps submitted
*
* @return the number of apps submitted
*/
public abstract long getNumAppsSubmitted();
/**
* Set the number of apps submitted
*
* @param numAppsSubmitted
* the number of apps submitted
*/
public abstract void setNumAppsSubmitted(long numAppsSubmitted);
/**
* Get the number of running apps
*
* @return the number of running apps
*/
public abstract long getNumAppsRunning();
/**
* Set the number of running apps
*
* @param numAppsRunning
* the number of running apps
*/
public abstract void setNumAppsRunning(long numAppsRunning);
/**
* Get the number of pending apps
*
* @return the number of pending apps
*/
public abstract long getNumAppsPending();
/**
* Set the number of pending apps
*
* @param numAppsPending
* the number of pending apps
*/
public abstract void setNumAppsPending(long numAppsPending);
/**
* Get the number of completed apps
*
* @return the number of completed apps
*/
public abstract long getNumAppsCompleted();
/**
* Set the number of completed apps
*
* @param numAppsCompleted
* the number of completed apps
*/
public abstract void setNumAppsCompleted(long numAppsCompleted);
/**
* Get the number of killed apps
*
* @return the number of killed apps
*/
public abstract long getNumAppsKilled();
/**
* Set the number of killed apps
*
* @param numAppsKilled
* the number of killed apps
*/
public abstract void setNumAppsKilled(long numAppsKilled);
/**
* Get the number of failed apps
*
* @return the number of failed apps
*/
public abstract long getNumAppsFailed();
/**
* Set the number of failed apps
*
* @param numAppsFailed
* the number of failed apps
*/
public abstract void setNumAppsFailed(long numAppsFailed);
/**
* Get the number of active users
*
* @return the number of active users
*/
public abstract long getNumActiveUsers();
/**
* Set the number of active users
*
* @param numActiveUsers
* the number of active users
*/
public abstract void setNumActiveUsers(long numActiveUsers);
/**
* Get the available memory in MB
*
* @return the available memory
*/
public abstract long getAvailableMemoryMB();
/**
* Set the available memory in MB
*
* @param availableMemoryMB
* the available memory
*/
public abstract void setAvailableMemoryMB(long availableMemoryMB);
/**
* Get the allocated memory in MB
*
* @return the allocated memory
*/
public abstract long getAllocatedMemoryMB();
/**
* Set the allocated memory in MB
*
* @param allocatedMemoryMB
* the allocate memory
*/
public abstract void setAllocatedMemoryMB(long allocatedMemoryMB);
/**
* Get the pending memory in MB
*
* @return the pending memory
*/
public abstract long getPendingMemoryMB();
/**
* Set the pending memory in MB
*
* @param pendingMemoryMB
* the pending memory
*/
public abstract void setPendingMemoryMB(long pendingMemoryMB);
/**
* Get the reserved memory in MB
*
* @return the reserved memory
*/
public abstract long getReservedMemoryMB();
/**
* Set the reserved memory in MB
*
* @param reservedMemoryMB
* the reserved memory
*/
public abstract void setReservedMemoryMB(long reservedMemoryMB);
/**
* Get the available vcores
*
* @return the available vcores
*/
public abstract long getAvailableVCores();
/**
* Set the available vcores
*
* @param availableVCores
* the available vcores
*/
public abstract void setAvailableVCores(long availableVCores);
/**
* Get the allocated vcores
*
* @return the allocated vcores
*/
public abstract long getAllocatedVCores();
/**
* Set the allocated vcores
*
* @param allocatedVCores
* the allocated vcores
*/
public abstract void setAllocatedVCores(long allocatedVCores);
/**
* Get the pending vcores
*
* @return the pending vcores
*/
public abstract long getPendingVCores();
/**
* Set the pending vcores
*
* @param pendingVCores
* the pending vcores
*/
public abstract void setPendingVCores(long pendingVCores);
/**
* Get the number of pending containers.
* @return the number of pending containers.
*/
public abstract long getPendingContainers();
/**
* Set the number of pending containers.
* @param pendingContainers the pending containers.
*/
public abstract void setPendingContainers(long pendingContainers);
/**
* Get the number of allocated containers.
* @return the number of allocated containers.
*/
public abstract long getAllocatedContainers();
/**
* Set the number of allocated containers.
* @param allocatedContainers the allocated containers.
*/
public abstract void setAllocatedContainers(long allocatedContainers);
/**
* Get the number of reserved containers.
* @return the number of reserved containers.
*/
public abstract long getReservedContainers();
/**
* Set the number of reserved containers.
* @param reservedContainers the reserved containers.
*/
public abstract void setReservedContainers(long reservedContainers);
/**
* Get the reserved vcores
*
* @return the reserved vcores
*/
public abstract long getReservedVCores();
/**
* Set the reserved vcores
*
* @param reservedVCores
* the reserved vcores
*/
public abstract void setReservedVCores(long reservedVCores);
}
| 8,131 | 24.734177 | 79 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/PreemptionContainer.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* Specific container requested back by the <code>ResourceManager</code>.
* @see PreemptionContract
* @see StrictPreemptionContract
*/
@Public
@Evolving
public abstract class PreemptionContainer {
@Private
@Unstable
public static PreemptionContainer newInstance(ContainerId id) {
PreemptionContainer container = Records.newRecord(PreemptionContainer.class);
container.setId(id);
return container;
}
/**
* @return Container referenced by this handle.
*/
@Public
@Evolving
public abstract ContainerId getId();
@Private
@Unstable
public abstract void setId(ContainerId id);
}
| 1,792 | 31.6 | 81 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationSubmissionContext.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import java.util.Set;
import org.apache.hadoop.classification.InterfaceAudience.LimitedPrivate;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.util.Records;
/**
* {@code ApplicationSubmissionContext} represents all of the
* information needed by the {@code ResourceManager} to launch
* the {@code ApplicationMaster} for an application.
* <p>
* It includes details such as:
* <ul>
* <li>{@link ApplicationId} of the application.</li>
* <li>Application user.</li>
* <li>Application name.</li>
* <li>{@link Priority} of the application.</li>
* <li>
* {@link ContainerLaunchContext} of the container in which the
* <code>ApplicationMaster</code> is executed.
* </li>
* <li>
* maxAppAttempts. The maximum number of application attempts.
* It should be no larger than the global number of max attempts in the
* Yarn configuration.
* </li>
* <li>
* attemptFailuresValidityInterval. The default value is -1.
* when attemptFailuresValidityInterval in milliseconds is set to
* {@literal >} 0, the failure number will no take failures which happen
* out of the validityInterval into failure count. If failure count
* reaches to maxAppAttempts, the application will be failed.
* </li>
* <li>Optional, application-specific {@link LogAggregationContext}</li>
* </ul>
*
* @see ContainerLaunchContext
* @see ApplicationClientProtocol#submitApplication(org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest)
*/
@Public
@Stable
public abstract class ApplicationSubmissionContext {
@Public
@Stable
public static ApplicationSubmissionContext newInstance(
ApplicationId applicationId, String applicationName, String queue,
Priority priority, ContainerLaunchContext amContainer,
boolean isUnmanagedAM, boolean cancelTokensWhenComplete,
int maxAppAttempts, Resource resource, String applicationType,
boolean keepContainers, String appLabelExpression,
String amContainerLabelExpression) {
ApplicationSubmissionContext context =
Records.newRecord(ApplicationSubmissionContext.class);
context.setApplicationId(applicationId);
context.setApplicationName(applicationName);
context.setQueue(queue);
context.setPriority(priority);
context.setAMContainerSpec(amContainer);
context.setUnmanagedAM(isUnmanagedAM);
context.setCancelTokensWhenComplete(cancelTokensWhenComplete);
context.setMaxAppAttempts(maxAppAttempts);
context.setApplicationType(applicationType);
context.setKeepContainersAcrossApplicationAttempts(keepContainers);
context.setNodeLabelExpression(appLabelExpression);
context.setResource(resource);
ResourceRequest amReq = Records.newRecord(ResourceRequest.class);
amReq.setResourceName(ResourceRequest.ANY);
amReq.setCapability(resource);
amReq.setNumContainers(1);
amReq.setRelaxLocality(true);
amReq.setNodeLabelExpression(amContainerLabelExpression);
context.setAMContainerResourceRequest(amReq);
return context;
}
public static ApplicationSubmissionContext newInstance(
ApplicationId applicationId, String applicationName, String queue,
Priority priority, ContainerLaunchContext amContainer,
boolean isUnmanagedAM, boolean cancelTokensWhenComplete,
int maxAppAttempts, Resource resource, String applicationType,
boolean keepContainers) {
return newInstance(applicationId, applicationName, queue, priority,
amContainer, isUnmanagedAM, cancelTokensWhenComplete, maxAppAttempts,
resource, applicationType, keepContainers, null, null);
}
@Public
@Stable
public static ApplicationSubmissionContext newInstance(
ApplicationId applicationId, String applicationName, String queue,
Priority priority, ContainerLaunchContext amContainer,
boolean isUnmanagedAM, boolean cancelTokensWhenComplete,
int maxAppAttempts, Resource resource, String applicationType) {
return newInstance(applicationId, applicationName, queue, priority,
amContainer, isUnmanagedAM, cancelTokensWhenComplete, maxAppAttempts,
resource, applicationType, false, null, null);
}
@Public
@Stable
public static ApplicationSubmissionContext newInstance(
ApplicationId applicationId, String applicationName, String queue,
Priority priority, ContainerLaunchContext amContainer,
boolean isUnmanagedAM, boolean cancelTokensWhenComplete,
int maxAppAttempts, Resource resource) {
return newInstance(applicationId, applicationName, queue, priority,
amContainer, isUnmanagedAM, cancelTokensWhenComplete, maxAppAttempts,
resource, null);
}
@Public
@Stable
public static ApplicationSubmissionContext newInstance(
ApplicationId applicationId, String applicationName, String queue,
ContainerLaunchContext amContainer, boolean isUnmanagedAM,
boolean cancelTokensWhenComplete, int maxAppAttempts,
String applicationType, boolean keepContainers,
String appLabelExpression, ResourceRequest resourceRequest) {
ApplicationSubmissionContext context =
Records.newRecord(ApplicationSubmissionContext.class);
context.setApplicationId(applicationId);
context.setApplicationName(applicationName);
context.setQueue(queue);
context.setAMContainerSpec(amContainer);
context.setUnmanagedAM(isUnmanagedAM);
context.setCancelTokensWhenComplete(cancelTokensWhenComplete);
context.setMaxAppAttempts(maxAppAttempts);
context.setApplicationType(applicationType);
context.setKeepContainersAcrossApplicationAttempts(keepContainers);
context.setNodeLabelExpression(appLabelExpression);
context.setAMContainerResourceRequest(resourceRequest);
return context;
}
@Public
@Stable
public static ApplicationSubmissionContext newInstance(
ApplicationId applicationId, String applicationName, String queue,
Priority priority, ContainerLaunchContext amContainer,
boolean isUnmanagedAM, boolean cancelTokensWhenComplete,
int maxAppAttempts, Resource resource, String applicationType,
boolean keepContainers, long attemptFailuresValidityInterval) {
ApplicationSubmissionContext context =
newInstance(applicationId, applicationName, queue, priority,
amContainer, isUnmanagedAM, cancelTokensWhenComplete, maxAppAttempts,
resource, applicationType, keepContainers);
context.setAttemptFailuresValidityInterval(attemptFailuresValidityInterval);
return context;
}
@Public
@Stable
public static ApplicationSubmissionContext newInstance(
ApplicationId applicationId, String applicationName, String queue,
Priority priority, ContainerLaunchContext amContainer,
boolean isUnmanagedAM, boolean cancelTokensWhenComplete,
int maxAppAttempts, Resource resource, String applicationType,
boolean keepContainers, LogAggregationContext logAggregationContext) {
ApplicationSubmissionContext context =
newInstance(applicationId, applicationName, queue, priority,
amContainer, isUnmanagedAM, cancelTokensWhenComplete, maxAppAttempts,
resource, applicationType, keepContainers);
context.setLogAggregationContext(logAggregationContext);
return context;
}
/**
* Get the <code>ApplicationId</code> of the submitted application.
* @return <code>ApplicationId</code> of the submitted application
*/
@Public
@Stable
public abstract ApplicationId getApplicationId();
/**
* Set the <code>ApplicationId</code> of the submitted application.
* @param applicationId <code>ApplicationId</code> of the submitted
* application
*/
@Public
@Stable
public abstract void setApplicationId(ApplicationId applicationId);
/**
* Get the application <em>name</em>.
* @return application name
*/
@Public
@Stable
public abstract String getApplicationName();
/**
* Set the application <em>name</em>.
* @param applicationName application name
*/
@Public
@Stable
public abstract void setApplicationName(String applicationName);
/**
* Get the <em>queue</em> to which the application is being submitted.
* @return <em>queue</em> to which the application is being submitted
*/
@Public
@Stable
public abstract String getQueue();
/**
* Set the <em>queue</em> to which the application is being submitted
* @param queue <em>queue</em> to which the application is being submitted
*/
@Public
@Stable
public abstract void setQueue(String queue);
/**
* Get the <code>Priority</code> of the application.
* @return <code>Priority</code> of the application
*/
@Public
@Stable
public abstract Priority getPriority();
/**
* Set the <code>Priority</code> of the application.
* @param priority <code>Priority</code> of the application
*/
@Private
@Unstable
public abstract void setPriority(Priority priority);
/**
* Get the <code>ContainerLaunchContext</code> to describe the
* <code>Container</code> with which the <code>ApplicationMaster</code> is
* launched.
* @return <code>ContainerLaunchContext</code> for the
* <code>ApplicationMaster</code> container
*/
@Public
@Stable
public abstract ContainerLaunchContext getAMContainerSpec();
/**
* Set the <code>ContainerLaunchContext</code> to describe the
* <code>Container</code> with which the <code>ApplicationMaster</code> is
* launched.
* @param amContainer <code>ContainerLaunchContext</code> for the
* <code>ApplicationMaster</code> container
*/
@Public
@Stable
public abstract void setAMContainerSpec(ContainerLaunchContext amContainer);
/**
* Get if the RM should manage the execution of the AM.
* If true, then the RM
* will not allocate a container for the AM and start it. It will expect the
* AM to be launched and connect to the RM within the AM liveliness period and
* fail the app otherwise. The client should launch the AM only after the RM
* has ACCEPTED the application and changed the <code>YarnApplicationState</code>.
* Such apps will not be retried by the RM on app attempt failure.
* The default value is false.
* @return true if the AM is not managed by the RM
*/
@Public
@Stable
public abstract boolean getUnmanagedAM();
/**
* @param value true if RM should not manage the AM
*/
@Public
@Stable
public abstract void setUnmanagedAM(boolean value);
/**
* @return true if tokens should be canceled when the app completes.
*/
@LimitedPrivate("mapreduce")
@Unstable
public abstract boolean getCancelTokensWhenComplete();
/**
* Set to false if tokens should not be canceled when the app finished else
* false. WARNING: this is not recommended unless you want your single job
* tokens to be reused by others jobs.
* @param cancel true if tokens should be canceled when the app finishes.
*/
@LimitedPrivate("mapreduce")
@Unstable
public abstract void setCancelTokensWhenComplete(boolean cancel);
/**
* @return the number of max attempts of the application to be submitted
*/
@Public
@Stable
public abstract int getMaxAppAttempts();
/**
* Set the number of max attempts of the application to be submitted. WARNING:
* it should be no larger than the global number of max attempts in the Yarn
* configuration.
* @param maxAppAttempts the number of max attempts of the application
* to be submitted.
*/
@Public
@Stable
public abstract void setMaxAppAttempts(int maxAppAttempts);
/**
* Get the resource required by the <code>ApplicationMaster</code> for this
* application. Please note this will be DEPRECATED, use <em>getResource</em>
* in <em>getAMContainerResourceRequest</em> instead.
*
* @return the resource required by the <code>ApplicationMaster</code> for
* this application.
*/
@Public
public abstract Resource getResource();
/**
* Set the resource required by the <code>ApplicationMaster</code> for this
* application.
*
* @param resource the resource required by the <code>ApplicationMaster</code>
* for this application.
*/
@Public
public abstract void setResource(Resource resource);
/**
* Get the application type
*
* @return the application type
*/
@Public
@Stable
public abstract String getApplicationType();
/**
* Set the application type
*
* @param applicationType the application type
*/
@Public
@Stable
public abstract void setApplicationType(String applicationType);
/**
* Get the flag which indicates whether to keep containers across application
* attempts or not.
*
* @return the flag which indicates whether to keep containers across
* application attempts or not.
*/
@Public
@Stable
public abstract boolean getKeepContainersAcrossApplicationAttempts();
/**
* Set the flag which indicates whether to keep containers across application
* attempts.
* <p>
* If the flag is true, running containers will not be killed when application
* attempt fails and these containers will be retrieved by the new application
* attempt on registration via
* {@link ApplicationMasterProtocol#registerApplicationMaster(RegisterApplicationMasterRequest)}.
* </p>
*
* @param keepContainers
* the flag which indicates whether to keep containers across
* application attempts.
*/
@Public
@Stable
public abstract void setKeepContainersAcrossApplicationAttempts(
boolean keepContainers);
/**
* Get tags for the application
*
* @return the application tags
*/
@Public
@Stable
public abstract Set<String> getApplicationTags();
/**
* Set tags for the application. A maximum of
* {@link YarnConfiguration#APPLICATION_MAX_TAGS} are allowed
* per application. Each tag can be at most
* {@link YarnConfiguration#APPLICATION_MAX_TAG_LENGTH}
* characters, and can contain only ASCII characters.
*
* @param tags tags to set
*/
@Public
@Stable
public abstract void setApplicationTags(Set<String> tags);
/**
* Get node-label-expression for this app. If this is set, all containers of
* this application without setting node-label-expression in ResurceRequest
* will get allocated resources on only those nodes that satisfy this
* node-label-expression.
*
* If different node-label-expression of this app and ResourceRequest are set
* at the same time, the one set in ResourceRequest will be used when
* allocating container
*
* @return node-label-expression for this app
*/
@Public
@Evolving
public abstract String getNodeLabelExpression();
/**
* Set node-label-expression for this app
* @param nodeLabelExpression node-label-expression of this app
*/
@Public
@Evolving
public abstract void setNodeLabelExpression(String nodeLabelExpression);
/**
* Get ResourceRequest of AM container, if this is not null, scheduler will
* use this to acquire resource for AM container.
*
* If this is null, scheduler will assemble a ResourceRequest by using
* <em>getResource</em> and <em>getPriority</em> of
* <em>ApplicationSubmissionContext</em>.
*
* Number of containers and Priority will be ignore.
*
* @return ResourceRequest of AM container
*/
@Public
@Evolving
public abstract ResourceRequest getAMContainerResourceRequest();
/**
* Set ResourceRequest of AM container
* @param request of AM container
*/
@Public
@Evolving
public abstract void setAMContainerResourceRequest(ResourceRequest request);
/**
* Get the attemptFailuresValidityInterval in milliseconds for the application
*
* @return the attemptFailuresValidityInterval
*/
@Public
@Stable
public abstract long getAttemptFailuresValidityInterval();
/**
* Set the attemptFailuresValidityInterval in milliseconds for the application
* @param attemptFailuresValidityInterval
*/
@Public
@Stable
public abstract void setAttemptFailuresValidityInterval(
long attemptFailuresValidityInterval);
/**
* Get <code>LogAggregationContext</code> of the application
*
* @return <code>LogAggregationContext</code> of the application
*/
@Public
@Stable
public abstract LogAggregationContext getLogAggregationContext();
/**
* Set <code>LogAggregationContext</code> for the application
*
* @param logAggregationContext
* for the application
*/
@Public
@Stable
public abstract void setLogAggregationContext(
LogAggregationContext logAggregationContext);
/**
* Get the reservation id, that corresponds to a valid resource allocation in
* the scheduler (between start and end time of the corresponding reservation)
*
* @return the reservation id representing the unique id of the corresponding
* reserved resource allocation in the scheduler
*/
@Public
@Unstable
public abstract ReservationId getReservationID();
/**
* Set the reservation id, that correspond to a valid resource allocation in
* the scheduler (between start and end time of the corresponding reservation)
*
* @param reservationID representing the unique id of the
* corresponding reserved resource allocation in the scheduler
*/
@Public
@Unstable
public abstract void setReservationID(ReservationId reservationID);
}
| 18,984 | 34.222635 | 120 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/FinalApplicationStatus.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
/**
* Enumeration of various final states of an <code>Application</code>.
*/
@Public
@Stable
public enum FinalApplicationStatus {
/** Undefined state when either the application has not yet finished */
UNDEFINED,
/** Application which finished successfully. */
SUCCEEDED,
/** Application which failed. */
FAILED,
/** Application which was terminated by a user or admin. */
KILLED
}
| 1,391 | 31.372093 | 75 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LocalResourceType.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
/**
* {@code LocalResourceType} specifies the <em>type</em>
* of a resource localized by the {@code NodeManager}.
* <p>
* The <em>type</em> can be one of:
* <ul>
* <li>
* {@link #FILE} - Regular file i.e. uninterpreted bytes.
* </li>
* <li>
* {@link #ARCHIVE} - Archive, which is automatically unarchived by the
* <code>NodeManager</code>.
* </li>
* <li>
* {@link #PATTERN} - A hybrid between {@link #ARCHIVE} and {@link #FILE}.
* </li>
* </ul>
*
* @see LocalResource
* @see ContainerLaunchContext
* @see ApplicationSubmissionContext
* @see ContainerManagementProtocol#startContainers(org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest)
*/
@Public
@Stable
public enum LocalResourceType {
/**
* Archive, which is automatically unarchived by the <code>NodeManager</code>.
*/
ARCHIVE,
/**
* Regular file i.e. uninterpreted bytes.
*/
FILE,
/**
* A hybrid between archive and file. Only part of the file is unarchived,
* and the original file is left in place, but in the same directory as the
* unarchived part. The part that is unarchived is determined by pattern
* in #{@link LocalResource}. Currently only jars support pattern, all
* others will be treated like a #{@link LocalResourceType#ARCHIVE}.
*/
PATTERN
}
| 2,381 | 32.549296 | 118 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationId.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import java.text.NumberFormat;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* <p><code>ApplicationId</code> represents the <em>globally unique</em>
* identifier for an application.</p>
*
* <p>The globally unique nature of the identifier is achieved by using the
* <em>cluster timestamp</em> i.e. start-time of the
* <code>ResourceManager</code> along with a monotonically increasing counter
* for the application.</p>
*/
@Public
@Stable
public abstract class ApplicationId implements Comparable<ApplicationId> {
@Private
@Unstable
public static final String appIdStrPrefix = "application_";
@Private
@Unstable
public static ApplicationId newInstance(long clusterTimestamp, int id) {
ApplicationId appId = Records.newRecord(ApplicationId.class);
appId.setClusterTimestamp(clusterTimestamp);
appId.setId(id);
appId.build();
return appId;
}
/**
* Get the short integer identifier of the <code>ApplicationId</code>
* which is unique for all applications started by a particular instance
* of the <code>ResourceManager</code>.
* @return short integer identifier of the <code>ApplicationId</code>
*/
@Public
@Stable
public abstract int getId();
@Private
@Unstable
protected abstract void setId(int id);
/**
* Get the <em>start time</em> of the <code>ResourceManager</code> which is
* used to generate globally unique <code>ApplicationId</code>.
* @return <em>start time</em> of the <code>ResourceManager</code>
*/
@Public
@Stable
public abstract long getClusterTimestamp();
@Private
@Unstable
protected abstract void setClusterTimestamp(long clusterTimestamp);
protected abstract void build();
static final ThreadLocal<NumberFormat> appIdFormat =
new ThreadLocal<NumberFormat>() {
@Override
public NumberFormat initialValue() {
NumberFormat fmt = NumberFormat.getInstance();
fmt.setGroupingUsed(false);
fmt.setMinimumIntegerDigits(4);
return fmt;
}
};
@Override
public int compareTo(ApplicationId other) {
if (this.getClusterTimestamp() - other.getClusterTimestamp() == 0) {
return this.getId() - other.getId();
} else {
return this.getClusterTimestamp() > other.getClusterTimestamp() ? 1 :
this.getClusterTimestamp() < other.getClusterTimestamp() ? -1 : 0;
}
}
@Override
public String toString() {
return appIdStrPrefix + this.getClusterTimestamp() + "_"
+ appIdFormat.get().format(getId());
}
@Override
public int hashCode() {
// Generated by eclipse.
final int prime = 371237;
int result = 6521;
long clusterTimestamp = getClusterTimestamp();
result = prime * result
+ (int) (clusterTimestamp ^ (clusterTimestamp >>> 32));
result = prime * result + getId();
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ApplicationId other = (ApplicationId) obj;
if (this.getClusterTimestamp() != other.getClusterTimestamp())
return false;
if (this.getId() != other.getId())
return false;
return true;
}
}
| 4,387 | 30.342857 | 78 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import java.io.Serializable;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* {@link ReservationRequest} represents the request made by an application to
* the {@code ResourceManager} to reserve {@link Resource}s.
* <p>
* It includes:
* <ul>
* <li>{@link Resource} required for each request.</li>
* <li>
* Number of containers, of above specifications, which are required by the
* application.
* </li>
* <li>Concurrency that indicates the gang size of the request.</li>
* </ul>
*/
@Public
@Unstable
public abstract class ReservationRequest implements
Comparable<ReservationRequest> {
@Public
@Unstable
public static ReservationRequest newInstance(Resource capability,
int numContainers) {
return newInstance(capability, numContainers, 1, -1);
}
@Public
@Unstable
public static ReservationRequest newInstance(Resource capability,
int numContainers, int concurrency, long duration) {
ReservationRequest request = Records.newRecord(ReservationRequest.class);
request.setCapability(capability);
request.setNumContainers(numContainers);
request.setConcurrency(concurrency);
request.setDuration(duration);
return request;
}
@Public
@Unstable
public static class ReservationRequestComparator implements
java.util.Comparator<ReservationRequest>, Serializable {
private static final long serialVersionUID = 1L;
@Override
public int compare(ReservationRequest r1, ReservationRequest r2) {
// Compare numContainers, concurrency and capability
int ret = r1.getNumContainers() - r2.getNumContainers();
if (ret == 0) {
ret = r1.getConcurrency() - r2.getConcurrency();
}
if (ret == 0) {
ret = r1.getCapability().compareTo(r2.getCapability());
}
return ret;
}
}
/**
* Get the {@link Resource} capability of the request.
*
* @return {@link Resource} capability of the request
*/
@Public
@Unstable
public abstract Resource getCapability();
/**
* Set the {@link Resource} capability of the request
*
* @param capability {@link Resource} capability of the request
*/
@Public
@Unstable
public abstract void setCapability(Resource capability);
/**
* Get the number of containers required with the given specifications.
*
* @return number of containers required with the given specifications
*/
@Public
@Unstable
public abstract int getNumContainers();
/**
* Set the number of containers required with the given specifications
*
* @param numContainers number of containers required with the given
* specifications
*/
@Public
@Unstable
public abstract void setNumContainers(int numContainers);
/**
* Get the number of containers that need to be scheduled concurrently. The
* default value of 1 would fall back to the current non concurrency
* constraints on the scheduling behavior.
*
* @return the number of containers to be concurrently scheduled
*/
@Public
@Unstable
public abstract int getConcurrency();
/**
* Set the number of containers that need to be scheduled concurrently. The
* default value of 1 would fall back to the current non concurrency
* constraints on the scheduling behavior.
*
* @param numContainers the number of containers to be concurrently scheduled
*/
@Public
@Unstable
public abstract void setConcurrency(int numContainers);
/**
* Get the duration in milliseconds for which the resource is required. A
* default value of -1, indicates an unspecified lease duration, and fallback
* to current behavior.
*
* @return the duration in milliseconds for which the resource is required
*/
@Public
@Unstable
public abstract long getDuration();
/**
* Set the duration in milliseconds for which the resource is required.
*
* @param duration the duration in milliseconds for which the resource is
* required
*/
@Public
@Unstable
public abstract void setDuration(long duration);
@Override
public int hashCode() {
final int prime = 2153;
int result = 2459;
Resource capability = getCapability();
result =
prime * result + ((capability == null) ? 0 : capability.hashCode());
result = prime * result + getNumContainers();
result = prime * result + getConcurrency();
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ReservationRequest other = (ReservationRequest) obj;
Resource capability = getCapability();
if (capability == null) {
if (other.getCapability() != null)
return false;
} else if (!capability.equals(other.getCapability()))
return false;
if (getNumContainers() != other.getNumContainers())
return false;
if (getConcurrency() != other.getConcurrency())
return false;
return true;
}
@Override
public int compareTo(ReservationRequest other) {
int numContainersComparison =
this.getNumContainers() - other.getNumContainers();
if (numContainersComparison == 0) {
int concurrencyComparison =
this.getConcurrency() - other.getConcurrency();
if (concurrencyComparison == 0) {
return this.getCapability().compareTo(other.getCapability());
} else {
return concurrencyComparison;
}
} else {
return numContainersComparison;
}
}
}
| 6,560 | 29.09633 | 79 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequestInterpreter.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
/**
* Enumeration of various types of dependencies among multiple
* {@link ReservationRequests} within one {@link ReservationDefinition} (from
* least constraining to most constraining).
*/
@Public
@Evolving
public enum ReservationRequestInterpreter {
/**
* Requires that exactly ONE among the {@link ReservationRequest} submitted as
* of a {@link ReservationDefinition} is satisfied to satisfy the overall
* {@link ReservationDefinition}.
* <p>
* WHEN TO USE THIS: This is useful when the user have multiple equivalent
* ways to run an application, and wants to expose to the ReservationAgent
* such flexibility. For example an application could use one
* {@literal <32GB,16core>} container for 10min, or 16 {@literal <2GB,1core>}
* containers for 15min, the ReservationAgent will decide which one of the
* two it is best for the system to place.
*/
R_ANY,
/**
* Requires that ALL of the {@link ReservationRequest} submitted as part of a
* {@link ReservationDefinition} are satisfied for the overall
* {@link ReservationDefinition} to be satisfied. No constraints are imposed
* on the temporal ordering of the allocation used to satisfy the
* ResourceRequests.
* <p>
* WHEN TO USE THIS: This is useful to capture a scenario in which the user
* cares for multiple ReservationDefinition to be all accepted, or none. For
* example, a user might want a reservation R1: with 10 x
* {@literal <8GB,4core>} for 10min, and a reservation R2:
* with 2 {@literal <1GB,1core>} for 1h, and only if both are satisfied
* the workflow run in this reservation succeeds. The key differentiator
* from ALL and ORDER, ORDER_NO_GAP, is that ALL imposes no restrictions
* on the relative allocations used to place R1 and R2 above.
*/
R_ALL,
/**
* Requires that ALL of the {@link ReservationRequest} submitted as part of a
* {@link ReservationDefinition} are satisfied for the overall
* {@link ReservationDefinition} to be satisfied. Moreover, it imposes a
* strict temporal ordering on the allocation used to satisfy the
* {@link ReservationRequest}s. The allocations satisfying the
* {@link ReservationRequest} in position k must strictly precede the
* allocations for the {@link ReservationRequest} at position k+1. No
* constraints are imposed on temporal gaps between subsequent allocations
* (the last instant of the previous allocation can be an arbitrary long
* period of time before the first instant of the subsequent allocation).
* <p>
* WHEN TO USE THIS: Like ALL this requires all ReservationDefinitions to be
* placed, but it also imposes a time ordering on the allocations used. This
* is important if the ReservationDefinition(s) are used to describe a
* workflow with inherent inter-stage dependencies. For example, a first job
* runs in a ReservaitonDefinition R1 (10 x {@literal <1GB,1core>}
* for 20min), and its output is consumed by a second job described by
* a ReservationDefinition R2 (5 x {@literal <1GB,1core>}) for 50min).
* R2 allocation cannot overlap R1, as R2 models a job depending on
* the output of the job modeled by R1.
*/
R_ORDER,
/**
* Requires that ALL of the {@link ReservationRequest} submitted as part of a
* {@link ReservationDefinition} are satisfied for the overall
* {@link ReservationDefinition} to be satisfied. Moreover, it imposes a
* strict temporal ordering on the allocation used to satisfy the
* {@link ReservationRequest}s. It imposes a strict temporal ordering on the
* allocation used to satisfy the {@link ReservationRequest}s. The allocations
* satisfying the {@link ReservationRequest} in position k must strictly
* precede the allocations for the {@link ReservationRequest} at position k+1.
* Moreover it imposes a "zero-size gap" between subsequent allocations, i.e.,
* the last instant in time of the allocations associated with the
* {@link ReservationRequest} at position k must be exactly preceding the
* first instant in time of the {@link ReservationRequest} at position k+1.
* Time ranges are interpreted as [a,b) inclusive left, exclusive right.
*
* WHEN TO USE THIS: This is a stricter version of R_ORDER, which allows no
* gaps between the allocations that satisfy R1 and R2. The use of this is
* twofold: 1) prevent long gaps between subsequent stages that produce very
* large intermediate output (e.g., the output of R1 is too large to be kept
* around for long before the job running in R2 consumes it, and disposes of
* it), 2) if the job being modeled has a time-varying resource need, one can
* combine multiple ResourceDefinition each approximating a portion of the job
* execution (think of using multiple rectangular bounding boxes to described
* an arbitrarily shaped area). By asking for no-gaps we guarantee
* "continuity" of resources given to this job. This still allow for some
* flexibility, as the entire "train" of allocations can be moved rigidly back
* or forth within the start-deadline time range (if there is slack).
*
*/
R_ORDER_NO_GAP
}
| 6,153 | 50.714286 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationId.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import java.io.IOException;
import java.text.NumberFormat;
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>
* {@link ReservationId} represents the <em>globally unique</em> identifier for
* a reservation.
* </p>
*
* <p>
* The globally unique nature of the identifier is achieved by using the
* <em>cluster timestamp</em> i.e. start-time of the {@code ResourceManager}
* along with a monotonically increasing counter for the reservation.
* </p>
*/
@Public
@Unstable
public abstract class ReservationId implements Comparable<ReservationId> {
@Private
@Unstable
public static final String reserveIdStrPrefix = "reservation_";
protected long clusterTimestamp;
protected long id;
@Private
@Unstable
public static ReservationId newInstance(long clusterTimestamp, long id) {
ReservationId reservationId = Records.newRecord(ReservationId.class);
reservationId.setClusterTimestamp(clusterTimestamp);
reservationId.setId(id);
reservationId.build();
return reservationId;
}
/**
* Get the long identifier of the {@link ReservationId} which is unique for
* all Reservations started by a particular instance of the
* {@code ResourceManager}.
*
* @return long identifier of the {@link ReservationId}
*/
@Public
@Unstable
public abstract long getId();
@Private
@Unstable
protected abstract void setId(long id);
/**
* Get the <em>start time</em> of the {@code ResourceManager} which is used to
* generate globally unique {@link ReservationId}.
*
* @return <em>start time</em> of the {@code ResourceManager}
*/
@Public
@Unstable
public abstract long getClusterTimestamp();
@Private
@Unstable
protected abstract void setClusterTimestamp(long clusterTimestamp);
protected abstract void build();
static final ThreadLocal<NumberFormat> reservIdFormat =
new ThreadLocal<NumberFormat>() {
@Override
public NumberFormat initialValue() {
NumberFormat fmt = NumberFormat.getInstance();
fmt.setGroupingUsed(false);
fmt.setMinimumIntegerDigits(4);
return fmt;
}
};
@Override
public int compareTo(ReservationId other) {
if (this.getClusterTimestamp() - other.getClusterTimestamp() == 0) {
return getId() > getId() ? 1 : getId() < getId() ? -1 : 0;
} else {
return this.getClusterTimestamp() > other.getClusterTimestamp() ? 1
: this.getClusterTimestamp() < other.getClusterTimestamp() ? -1 : 0;
}
}
@Override
public String toString() {
return reserveIdStrPrefix + this.getClusterTimestamp() + "_"
+ reservIdFormat.get().format(getId());
}
/**
* Parse the string argument as a {@link ReservationId}
*
* @param reservationId the string representation of the {@link ReservationId}
* @return the {@link ReservationId} corresponding to the input string if
* valid, null if input is null
* @throws IOException if unable to parse the input string
*/
@Public
@Unstable
public static ReservationId parseReservationId(String reservationId)
throws IOException {
if (reservationId == null) {
return null;
}
if (!reservationId.startsWith(reserveIdStrPrefix)) {
throw new IOException("The specified reservation id is invalid: "
+ reservationId);
}
String[] resFields = reservationId.split("_");
if (resFields.length != 3) {
throw new IOException("The specified reservation id is not parseable: "
+ reservationId);
}
return newInstance(Long.parseLong(resFields[1]),
Long.parseLong(resFields[2]));
}
@Override
public int hashCode() {
// generated by eclipse
final int prime = 31;
int result = 1;
result =
prime * result
+ (int) (getClusterTimestamp() ^ (getClusterTimestamp() >>> 32));
result = prime * result + (int) (getId() ^ (getId() >>> 32));
return result;
}
@Override
public boolean equals(Object obj) {
// generated by eclipse
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ReservationId other = (ReservationId) obj;
if (getClusterTimestamp() != other.getClusterTimestamp())
return false;
if (getId() != other.getId())
return false;
return true;
}
}
| 5,440 | 29.740113 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/NodeLabel.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
@Public
@Unstable
public abstract class NodeLabel implements Comparable<NodeLabel> {
/**
* By default, node label is exclusive or not
*/
@Private
@Unstable
public static final boolean DEFAULT_NODE_LABEL_EXCLUSIVITY = true;
@Private
@Unstable
public static NodeLabel newInstance(String name) {
return newInstance(name, DEFAULT_NODE_LABEL_EXCLUSIVITY);
}
@Private
@Unstable
public static NodeLabel newInstance(String name, boolean isExclusive) {
NodeLabel request = Records.newRecord(NodeLabel.class);
request.setName(name);
request.setExclusivity(isExclusive);
return request;
}
@Public
@Stable
public abstract String getName();
@Private
@Unstable
public abstract void setName(String name);
@Public
@Stable
public abstract boolean isExclusive();
@Private
@Unstable
public abstract void setExclusivity(boolean isExclusive);
@Override
public int compareTo(NodeLabel other) {
return getName().compareTo(other.getName());
}
@Override
public boolean equals(Object obj) {
if (obj instanceof NodeLabel) {
NodeLabel nl = (NodeLabel) obj;
return nl.getName().equals(getName())
&& nl.isExclusive() == isExclusive();
}
return false;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("<");
sb.append(getName());
sb.append(":exclusivity=");
sb.append(isExclusive());
sb.append(">");
return sb.toString();
}
@Override
public int hashCode() {
return (getName().hashCode() << 16) + (isExclusive() ? 1 : 0);
}
}
| 2,778 | 27.070707 | 75 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/PreemptionMessage.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* A {@link PreemptionMessage} is part of the RM-AM protocol, and it is used by
* the RM to specify resources that the RM wants to reclaim from this
* {@code ApplicationMaster} (AM). The AM receives a {@link
* StrictPreemptionContract} message encoding which containers the platform may
* forcibly kill, granting it an opportunity to checkpoint state or adjust its
* execution plan. The message may also include a {@link PreemptionContract}
* granting the AM more latitude in selecting which resources to return to the
* cluster.
* <p>
* The AM should decode both parts of the message. The {@link
* StrictPreemptionContract} specifies particular allocations that the RM
* requires back. The AM can checkpoint containers' state, adjust its execution
* plan to move the computation, or take no action and hope that conditions that
* caused the RM to ask for the container will change.
* <p>
* In contrast, the {@link PreemptionContract} also includes a description of
* resources with a set of containers. If the AM releases containers matching
* that profile, then the containers enumerated in {@link
* PreemptionContract#getContainers()} may not be killed.
* <p>
* Each preemption message reflects the RM's current understanding of the
* cluster state, so a request to return <em>N</em> containers may not
* reflect containers the AM is releasing, recently exited containers the RM has
* yet to learn about, or new containers allocated before the message was
* generated. Conversely, an RM may request a different profile of containers in
* subsequent requests.
* <p>
* The policy enforced by the RM is part of the scheduler. Generally, only
* containers that have been requested consistently should be killed, but the
* details are not specified.
*/
@Public
@Evolving
public abstract class PreemptionMessage {
@Private
@Unstable
public static PreemptionMessage newInstance(StrictPreemptionContract set,
PreemptionContract contract) {
PreemptionMessage message = Records.newRecord(PreemptionMessage.class);
message.setStrictContract(set);
message.setContract(contract);
return message;
}
/**
* @return Specific resources that may be killed by the
* <code>ResourceManager</code>
*/
@Public
@Evolving
public abstract StrictPreemptionContract getStrictContract();
@Private
@Unstable
public abstract void setStrictContract(StrictPreemptionContract set);
/**
* @return Contract describing resources to return to the cluster.
*/
@Public
@Evolving
public abstract PreemptionContract getContract();
@Private
@Unstable
public abstract void setContract(PreemptionContract contract);
}
| 3,856 | 39.177083 | 80 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerResourceIncreaseRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.yarn.util.Records;
/**
* Used by Application Master, send a container resource increase request to
* Resource Manager
*/
@Public
public abstract class ContainerResourceIncreaseRequest {
@Public
public static ContainerResourceIncreaseRequest newInstance(
ContainerId existingContainerId, Resource targetCapability) {
ContainerResourceIncreaseRequest context = Records
.newRecord(ContainerResourceIncreaseRequest.class);
context.setContainerId(existingContainerId);
context.setCapability(targetCapability);
return context;
}
@Public
public abstract ContainerId getContainerId();
@Public
public abstract void setContainerId(ContainerId containerId);
@Public
public abstract Resource getCapability();
@Public
public abstract void setCapability(Resource capability);
@Override
public int hashCode() {
return getCapability().hashCode() + getContainerId().hashCode();
}
@Override
public boolean equals(Object other) {
if (other instanceof ContainerResourceIncreaseRequest) {
ContainerResourceIncreaseRequest ctx =
(ContainerResourceIncreaseRequest) other;
if (getContainerId() == null && ctx.getContainerId() != null) {
return false;
} else if (!getContainerId().equals(ctx.getContainerId())) {
return false;
}
if (getCapability() == null && ctx.getCapability() != null) {
return false;
} else if (!getCapability().equals(ctx.getCapability())) {
return false;
}
return true;
} else {
return false;
}
}
}
| 2,550 | 30.493827 | 76 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/QueueInfo.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import java.util.List;
import java.util.Set;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.ApplicationClientProtocol;
import org.apache.hadoop.yarn.util.Records;
/**
* QueueInfo is a report of the runtime information of the queue.
* <p>
* It includes information such as:
* <ul>
* <li>Queue name.</li>
* <li>Capacity of the queue.</li>
* <li>Maximum capacity of the queue.</li>
* <li>Current capacity of the queue.</li>
* <li>Child queues.</li>
* <li>Running applications.</li>
* <li>{@link QueueState} of the queue.</li>
* </ul>
*
* @see QueueState
* @see ApplicationClientProtocol#getQueueInfo(org.apache.hadoop.yarn.api.protocolrecords.GetQueueInfoRequest)
*/
@Public
@Stable
public abstract class QueueInfo {
@Private
@Unstable
public static QueueInfo newInstance(String queueName, float capacity,
float maximumCapacity, float currentCapacity,
List<QueueInfo> childQueues, List<ApplicationReport> applications,
QueueState queueState, Set<String> accessibleNodeLabels,
String defaultNodeLabelExpression, QueueStatistics queueStatistics) {
QueueInfo queueInfo = Records.newRecord(QueueInfo.class);
queueInfo.setQueueName(queueName);
queueInfo.setCapacity(capacity);
queueInfo.setMaximumCapacity(maximumCapacity);
queueInfo.setCurrentCapacity(currentCapacity);
queueInfo.setChildQueues(childQueues);
queueInfo.setApplications(applications);
queueInfo.setQueueState(queueState);
queueInfo.setAccessibleNodeLabels(accessibleNodeLabels);
queueInfo.setDefaultNodeLabelExpression(defaultNodeLabelExpression);
queueInfo.setQueueStatistics(queueStatistics);
return queueInfo;
}
/**
* Get the <em>name</em> of the queue.
* @return <em>name</em> of the queue
*/
@Public
@Stable
public abstract String getQueueName();
@Private
@Unstable
public abstract void setQueueName(String queueName);
/**
* Get the <em>configured capacity</em> of the queue.
* @return <em>configured capacity</em> of the queue
*/
@Public
@Stable
public abstract float getCapacity();
@Private
@Unstable
public abstract void setCapacity(float capacity);
/**
* Get the <em>maximum capacity</em> of the queue.
* @return <em>maximum capacity</em> of the queue
*/
@Public
@Stable
public abstract float getMaximumCapacity();
@Private
@Unstable
public abstract void setMaximumCapacity(float maximumCapacity);
/**
* Get the <em>current capacity</em> of the queue.
* @return <em>current capacity</em> of the queue
*/
@Public
@Stable
public abstract float getCurrentCapacity();
@Private
@Unstable
public abstract void setCurrentCapacity(float currentCapacity);
/**
* Get the <em>child queues</em> of the queue.
* @return <em>child queues</em> of the queue
*/
@Public
@Stable
public abstract List<QueueInfo> getChildQueues();
@Private
@Unstable
public abstract void setChildQueues(List<QueueInfo> childQueues);
/**
* Get the <em>running applications</em> of the queue.
* @return <em>running applications</em> of the queue
*/
@Public
@Stable
public abstract List<ApplicationReport> getApplications();
@Private
@Unstable
public abstract void setApplications(List<ApplicationReport> applications);
/**
* Get the <code>QueueState</code> of the queue.
* @return <code>QueueState</code> of the queue
*/
@Public
@Stable
public abstract QueueState getQueueState();
@Private
@Unstable
public abstract void setQueueState(QueueState queueState);
/**
* Get the <code>accessible node labels</code> of the queue.
* @return <code>accessible node labels</code> of the queue
*/
@Public
@Stable
public abstract Set<String> getAccessibleNodeLabels();
/**
* Set the <code>accessible node labels</code> of the queue.
*/
@Private
@Unstable
public abstract void setAccessibleNodeLabels(Set<String> labels);
/**
* Get the <code>default node label expression</code> of the queue, this takes
* affect only when the <code>ApplicationSubmissionContext</code> and
* <code>ResourceRequest</code> don't specify their
* <code>NodeLabelExpression</code>.
*
* @return <code>default node label expression</code> of the queue
*/
@Public
@Stable
public abstract String getDefaultNodeLabelExpression();
@Public
@Stable
public abstract void setDefaultNodeLabelExpression(
String defaultLabelExpression);
/**
* Get the <code>queue stats</code> for the queue
*
* @return <code>queue stats</code> of the queue
*/
@Public
@Unstable
public abstract QueueStatistics getQueueStatistics();
/**
* Set the queue statistics for the queue
*
* @param queueStatistics
* the queue statistics
*/
@Public
@Unstable
public abstract void setQueueStatistics(QueueStatistics queueStatistics);
}
| 6,053 | 27.966507 | 110 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/PreemptionContract.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import java.util.List;
import java.util.Set;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
import org.apache.hadoop.yarn.util.Records;
/**
* Description of resources requested back by the <code>ResourceManager</code>.
* The <code>ApplicationMaster</code> (AM) can satisfy this request according
* to its own priorities to prevent containers from being forcibly killed by
* the platform.
* @see PreemptionMessage
*/
@Public
@Evolving
public abstract class PreemptionContract {
@Private
@Unstable
public static PreemptionContract newInstance(
List<PreemptionResourceRequest> req, Set<PreemptionContainer> containers) {
PreemptionContract contract = Records.newRecord(PreemptionContract.class);
contract.setResourceRequest(req);
contract.setContainers(containers);
return contract;
}
/**
* If the AM releases resources matching these requests, then the {@link
* PreemptionContainer}s enumerated in {@link #getContainers()} should not be
* evicted from the cluster. Due to delays in propagating cluster state and
* sending these messages, there are conditions where satisfied contracts may
* not prevent the platform from killing containers.
* @return List of {@link PreemptionResourceRequest} to update the
* <code>ApplicationMaster</code> about resources requested back by the
* <code>ResourceManager</code>.
* @see AllocateRequest#setAskList(List)
*/
@Public
@Evolving
public abstract List<PreemptionResourceRequest> getResourceRequest();
@Private
@Unstable
public abstract void setResourceRequest(List<PreemptionResourceRequest> req);
/**
* Assign the set of {@link PreemptionContainer} specifying which containers
* owned by the <code>ApplicationMaster</code> that may be reclaimed by the
* <code>ResourceManager</code>. If the AM prefers a different set of
* containers, then it may checkpoint or kill containers matching the
* description in {@link #getResourceRequest}.
* @return Set of containers at risk if the contract is not met.
*/
@Public
@Evolving
public abstract Set<PreemptionContainer> getContainers();
@Private
@Unstable
public abstract void setContainers(Set<PreemptionContainer> containers);
}
| 3,379 | 37.409091 | 81 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/LogAggregationContext.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* {@code LogAggregationContext} represents all of the
* information needed by the {@code NodeManager} to handle
* the logs for an application.
* <p>
* It includes details such as:
* <ul>
* <li>
* includePattern. It uses Java Regex to filter the log files
* which match the defined include pattern and those log files
* will be uploaded when the application finishes.
* </li>
* <li>
* excludePattern. It uses Java Regex to filter the log files
* which match the defined exclude pattern and those log files
* will not be uploaded when application finishes. If the log file
* name matches both the include and the exclude pattern, this file
* will be excluded eventually.
* </li>
* <li>
* rolledLogsIncludePattern. It uses Java Regex to filter the log files
* which match the defined include pattern and those log files
* will be aggregated in a rolling fashion.
* </li>
* <li>
* rolledLogsExcludePattern. It uses Java Regex to filter the log files
* which match the defined exclude pattern and those log files
* will not be aggregated in a rolling fashion. If the log file
* name matches both the include and the exclude pattern, this file
* will be excluded eventually.
* </li>
* </ul>
*
* @see ApplicationSubmissionContext
*/
@Evolving
@Public
public abstract class LogAggregationContext {
@Public
@Unstable
public static LogAggregationContext newInstance(String includePattern,
String excludePattern) {
LogAggregationContext context = Records.newRecord(LogAggregationContext.class);
context.setIncludePattern(includePattern);
context.setExcludePattern(excludePattern);
return context;
}
@Public
@Unstable
public static LogAggregationContext newInstance(String includePattern,
String excludePattern, String rolledLogsIncludePattern,
String rolledLogsExcludePattern) {
LogAggregationContext context =
Records.newRecord(LogAggregationContext.class);
context.setIncludePattern(includePattern);
context.setExcludePattern(excludePattern);
context.setRolledLogsIncludePattern(rolledLogsIncludePattern);
context.setRolledLogsExcludePattern(rolledLogsExcludePattern);
return context;
}
/**
* Get include pattern. This includePattern only takes affect
* on logs that exist at the time of application finish.
*
* @return include pattern
*/
@Public
@Unstable
public abstract String getIncludePattern();
/**
* Set include pattern. This includePattern only takes affect
* on logs that exist at the time of application finish.
*
* @param includePattern
*/
@Public
@Unstable
public abstract void setIncludePattern(String includePattern);
/**
* Get exclude pattern. This excludePattern only takes affect
* on logs that exist at the time of application finish.
*
* @return exclude pattern
*/
@Public
@Unstable
public abstract String getExcludePattern();
/**
* Set exclude pattern. This excludePattern only takes affect
* on logs that exist at the time of application finish.
*
* @param excludePattern
*/
@Public
@Unstable
public abstract void setExcludePattern(String excludePattern);
/**
* Get include pattern in a rolling fashion.
*
* @return include pattern
*/
@Public
@Unstable
public abstract String getRolledLogsIncludePattern();
/**
* Set include pattern in a rolling fashion.
*
* @param rolledLogsIncludePattern
*/
@Public
@Unstable
public abstract void setRolledLogsIncludePattern(
String rolledLogsIncludePattern);
/**
* Get exclude pattern for aggregation in a rolling fashion.
*
* @return exclude pattern
*/
@Public
@Unstable
public abstract String getRolledLogsExcludePattern();
/**
* Set exclude pattern for in a rolling fashion.
*
* @param rolledLogsExcludePattern
*/
@Public
@Unstable
public abstract void setRolledLogsExcludePattern(
String rolledLogsExcludePattern);
}
| 5,171 | 29.785714 | 83 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ReservationRequests.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* {@link ReservationRequests} captures the set of resource and constraints the
* user cares about regarding a reservation.
*
* @see ReservationRequest
*
*/
@Public
@Unstable
public abstract class ReservationRequests {
@Public
@Unstable
public static ReservationRequests newInstance(
List<ReservationRequest> reservationResources,
ReservationRequestInterpreter type) {
ReservationRequests reservationRequests =
Records.newRecord(ReservationRequests.class);
reservationRequests.setReservationResources(reservationResources);
reservationRequests.setInterpreter(type);
return reservationRequests;
}
/**
* Get the list of {@link ReservationRequest} representing the resources
* required by the application
*
* @return the list of {@link ReservationRequest}
*/
@Public
@Unstable
public abstract List<ReservationRequest> getReservationResources();
/**
* Set the list of {@link ReservationRequest} representing the resources
* required by the application
*
* @param reservationResources the list of {@link ReservationRequest}
*/
@Public
@Unstable
public abstract void setReservationResources(
List<ReservationRequest> reservationResources);
/**
* Get the {@link ReservationRequestInterpreter}, representing how the list of
* resources should be allocated, this captures temporal ordering and other
* constraints.
*
* @return the list of {@link ReservationRequestInterpreter}
*/
@Public
@Unstable
public abstract ReservationRequestInterpreter getInterpreter();
/**
* Set the {@link ReservationRequestInterpreter}, representing how the list of
* resources should be allocated, this captures temporal ordering and other
* constraints.
*
* @param interpreter the {@link ReservationRequestInterpreter} for this
* reservation
*/
@Public
@Unstable
public abstract void setInterpreter(ReservationRequestInterpreter interpreter);
}
| 3,054 | 31.157895 | 81 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/PreemptionResourceRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceStability.Evolving;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
import org.apache.hadoop.yarn.util.Records;
/**
* Description of resources requested back by the cluster.
* @see PreemptionContract
* @see AllocateRequest#setAskList(java.util.List)
*/
@Public
@Evolving
public abstract class PreemptionResourceRequest {
@Private
@Unstable
public static PreemptionResourceRequest newInstance(ResourceRequest req) {
PreemptionResourceRequest request =
Records.newRecord(PreemptionResourceRequest.class);
request.setResourceRequest(req);
return request;
}
/**
* @return Resource described in this request, to be matched against running
* containers.
*/
@Public
@Evolving
public abstract ResourceRequest getResourceRequest();
@Private
@Unstable
public abstract void setResourceRequest(ResourceRequest req);
}
| 1,987 | 33.877193 | 78 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerId.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import com.google.common.base.Splitter;
import java.text.NumberFormat;
import java.util.Iterator;
import java.util.NoSuchElementException;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* <p><code>ContainerId</code> represents a globally unique identifier
* for a {@link Container} in the cluster.</p>
*/
@Public
@Stable
public abstract class ContainerId implements Comparable<ContainerId>{
public static final long CONTAINER_ID_BITMASK = 0xffffffffffL;
private static final Splitter _SPLITTER = Splitter.on('_').trimResults();
private static final String CONTAINER_PREFIX = "container";
private static final String EPOCH_PREFIX = "e";
@Private
@Unstable
public static ContainerId newContainerId(ApplicationAttemptId appAttemptId,
long containerId) {
ContainerId id = Records.newRecord(ContainerId.class);
id.setContainerId(containerId);
id.setApplicationAttemptId(appAttemptId);
id.build();
return id;
}
@Private
@Deprecated
@Unstable
public static ContainerId newInstance(ApplicationAttemptId appAttemptId,
int containerId) {
ContainerId id = Records.newRecord(ContainerId.class);
id.setContainerId(containerId);
id.setApplicationAttemptId(appAttemptId);
id.build();
return id;
}
/**
* Get the <code>ApplicationAttemptId</code> of the application to which the
* <code>Container</code> was assigned.
* <p>
* Note: If containers are kept alive across application attempts via
* {@link ApplicationSubmissionContext#setKeepContainersAcrossApplicationAttempts(boolean)}
* the <code>ContainerId</code> does not necessarily contain the current
* running application attempt's <code>ApplicationAttemptId</code> This
* container can be allocated by previously exited application attempt and
* managed by the current running attempt thus have the previous application
* attempt's <code>ApplicationAttemptId</code>.
* </p>
*
* @return <code>ApplicationAttemptId</code> of the application to which the
* <code>Container</code> was assigned
*/
@Public
@Stable
public abstract ApplicationAttemptId getApplicationAttemptId();
@Private
@Unstable
protected abstract void setApplicationAttemptId(ApplicationAttemptId atId);
/**
* Get the lower 32 bits of identifier of the <code>ContainerId</code>,
* which doesn't include epoch. Note that this method will be marked as
* deprecated, so please use <code>getContainerId</code> instead.
* @return lower 32 bits of identifier of the <code>ContainerId</code>
*/
@Public
@Deprecated
@Stable
public abstract int getId();
/**
* Get the identifier of the <code>ContainerId</code>. Upper 24 bits are
* reserved as epoch of cluster, and lower 40 bits are reserved as
* sequential number of containers.
* @return identifier of the <code>ContainerId</code>
*/
@Public
@Unstable
public abstract long getContainerId();
@Private
@Unstable
protected abstract void setContainerId(long id);
// TODO: fail the app submission if attempts are more than 10 or something
private static final ThreadLocal<NumberFormat> appAttemptIdAndEpochFormat =
new ThreadLocal<NumberFormat>() {
@Override
public NumberFormat initialValue() {
NumberFormat fmt = NumberFormat.getInstance();
fmt.setGroupingUsed(false);
fmt.setMinimumIntegerDigits(2);
return fmt;
}
};
// TODO: Why thread local?
// ^ NumberFormat instances are not threadsafe
private static final ThreadLocal<NumberFormat> containerIdFormat =
new ThreadLocal<NumberFormat>() {
@Override
public NumberFormat initialValue() {
NumberFormat fmt = NumberFormat.getInstance();
fmt.setGroupingUsed(false);
fmt.setMinimumIntegerDigits(6);
return fmt;
}
};
@Override
public int hashCode() {
// Generated by IntelliJ IDEA 13.1.
int result = (int) (getContainerId() ^ (getContainerId() >>> 32));
result = 31 * result + getApplicationAttemptId().hashCode();
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ContainerId other = (ContainerId) obj;
if (!this.getApplicationAttemptId().equals(other.getApplicationAttemptId()))
return false;
if (this.getContainerId() != other.getContainerId())
return false;
return true;
}
@Override
public int compareTo(ContainerId other) {
if (this.getApplicationAttemptId().compareTo(
other.getApplicationAttemptId()) == 0) {
return Long.valueOf(getContainerId())
.compareTo(Long.valueOf(other.getContainerId()));
} else {
return this.getApplicationAttemptId().compareTo(
other.getApplicationAttemptId());
}
}
/**
* @return A string representation of containerId. The format is
* container_e*epoch*_*clusterTimestamp*_*appId*_*attemptId*_*containerId*
* when epoch is larger than 0
* (e.g. container_e17_1410901177871_0001_01_000005).
* *epoch* is increased when RM restarts or fails over.
* When epoch is 0, epoch is omitted
* (e.g. container_1410901177871_0001_01_000005).
*/
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(CONTAINER_PREFIX + "_");
long epoch = getContainerId() >> 40;
if (epoch > 0) {
sb.append(EPOCH_PREFIX)
.append(appAttemptIdAndEpochFormat.get().format(epoch)).append("_");;
}
ApplicationId appId = getApplicationAttemptId().getApplicationId();
sb.append(appId.getClusterTimestamp()).append("_");
sb.append(ApplicationId.appIdFormat.get().format(appId.getId()))
.append("_");
sb.append(
appAttemptIdAndEpochFormat.get().format(
getApplicationAttemptId().getAttemptId())).append("_");
sb.append(containerIdFormat.get()
.format(CONTAINER_ID_BITMASK & getContainerId()));
return sb.toString();
}
@Public
@Unstable
public static ContainerId fromString(String containerIdStr) {
Iterator<String> it = _SPLITTER.split(containerIdStr).iterator();
if (!it.next().equals(CONTAINER_PREFIX)) {
throw new IllegalArgumentException("Invalid ContainerId prefix: "
+ containerIdStr);
}
try {
String epochOrClusterTimestampStr = it.next();
long epoch = 0;
ApplicationAttemptId appAttemptID = null;
if (epochOrClusterTimestampStr.startsWith(EPOCH_PREFIX)) {
String epochStr = epochOrClusterTimestampStr;
epoch = Integer.parseInt(epochStr.substring(EPOCH_PREFIX.length()));
appAttemptID = toApplicationAttemptId(it);
} else {
String clusterTimestampStr = epochOrClusterTimestampStr;
long clusterTimestamp = Long.parseLong(clusterTimestampStr);
appAttemptID = toApplicationAttemptId(clusterTimestamp, it);
}
long id = Long.parseLong(it.next());
long cid = (epoch << 40) | id;
ContainerId containerId = ContainerId.newContainerId(appAttemptID, cid);
return containerId;
} catch (NumberFormatException n) {
throw new IllegalArgumentException("Invalid ContainerId: "
+ containerIdStr, n);
} catch (NoSuchElementException e) {
throw new IllegalArgumentException("Invalid ContainerId: "
+ containerIdStr, e);
}
}
private static ApplicationAttemptId toApplicationAttemptId(
Iterator<String> it) throws NumberFormatException {
return toApplicationAttemptId(Long.parseLong(it.next()), it);
}
private static ApplicationAttemptId toApplicationAttemptId(
long clusterTimestamp, Iterator<String> it) throws NumberFormatException {
ApplicationId appId = ApplicationId.newInstance(clusterTimestamp,
Integer.parseInt(it.next()));
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(appId, Integer.parseInt(it.next()));
return appAttemptId;
}
protected abstract void build();
}
| 9,256 | 34.879845 | 93 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ResourceBlacklistRequest.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import java.util.List;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.yarn.api.ApplicationMasterProtocol;
import org.apache.hadoop.yarn.util.Records;
/**
* {@link ResourceBlacklistRequest} encapsulates the list of resource-names
* which should be added or removed from the <em>blacklist</em> of resources
* for the application.
*
* @see ResourceRequest
* @see ApplicationMasterProtocol#allocate(org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest)
*/
@Public
@Stable
public abstract class ResourceBlacklistRequest {
@Public
@Stable
public static ResourceBlacklistRequest newInstance(
List<String> additions, List<String> removals) {
ResourceBlacklistRequest blacklistRequest =
Records.newRecord(ResourceBlacklistRequest.class);
blacklistRequest.setBlacklistAdditions(additions);
blacklistRequest.setBlacklistRemovals(removals);
return blacklistRequest;
}
/**
* Get the list of resource-names which should be added to the
* application blacklist.
*
* @return list of resource-names which should be added to the
* application blacklist
*/
@Public
@Stable
public abstract List<String> getBlacklistAdditions();
/**
* Set list of resource-names which should be added to the application blacklist.
*
* @param resourceNames list of resource-names which should be added to the
* application blacklist
*/
@Public
@Stable
public abstract void setBlacklistAdditions(List<String> resourceNames);
/**
* Get the list of resource-names which should be removed from the
* application blacklist.
*
* @return list of resource-names which should be removed from the
* application blacklist
*/
@Public
@Stable
public abstract List<String> getBlacklistRemovals();
/**
* Set list of resource-names which should be removed from the
* application blacklist.
*
* @param resourceNames list of resource-names which should be removed from the
* application blacklist
*/
@Public
@Stable
public abstract void setBlacklistRemovals(List<String> resourceNames);
}
| 3,128 | 32.287234 | 102 |
java
|
hadoop
|
hadoop-master/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ApplicationResourceUsageReport.java
|
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.hadoop.yarn.api.records;
import org.apache.hadoop.classification.InterfaceAudience.Private;
import org.apache.hadoop.classification.InterfaceAudience.Public;
import org.apache.hadoop.classification.InterfaceStability.Stable;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.yarn.util.Records;
/**
* Contains various scheduling metrics to be reported by UI and CLI.
*/
@Public
@Stable
public abstract class ApplicationResourceUsageReport {
@Private
@Unstable
public static ApplicationResourceUsageReport newInstance(
int numUsedContainers, int numReservedContainers, Resource usedResources,
Resource reservedResources, Resource neededResources, long memorySeconds,
long vcoreSeconds) {
ApplicationResourceUsageReport report =
Records.newRecord(ApplicationResourceUsageReport.class);
report.setNumUsedContainers(numUsedContainers);
report.setNumReservedContainers(numReservedContainers);
report.setUsedResources(usedResources);
report.setReservedResources(reservedResources);
report.setNeededResources(neededResources);
report.setMemorySeconds(memorySeconds);
report.setVcoreSeconds(vcoreSeconds);
return report;
}
/**
* Get the number of used containers. -1 for invalid/inaccessible reports.
* @return the number of used containers
*/
@Public
@Stable
public abstract int getNumUsedContainers();
/**
* Set the number of used containers
* @param num_containers the number of used containers
*/
@Private
@Unstable
public abstract void setNumUsedContainers(int num_containers);
/**
* Get the number of reserved containers. -1 for invalid/inaccessible reports.
* @return the number of reserved containers
*/
@Private
@Unstable
public abstract int getNumReservedContainers();
/**
* Set the number of reserved containers
* @param num_reserved_containers the number of reserved containers
*/
@Private
@Unstable
public abstract void setNumReservedContainers(int num_reserved_containers);
/**
* Get the used <code>Resource</code>. -1 for invalid/inaccessible reports.
* @return the used <code>Resource</code>
*/
@Public
@Stable
public abstract Resource getUsedResources();
@Private
@Unstable
public abstract void setUsedResources(Resource resources);
/**
* Get the reserved <code>Resource</code>. -1 for invalid/inaccessible reports.
* @return the reserved <code>Resource</code>
*/
@Public
@Stable
public abstract Resource getReservedResources();
@Private
@Unstable
public abstract void setReservedResources(Resource reserved_resources);
/**
* Get the needed <code>Resource</code>. -1 for invalid/inaccessible reports.
* @return the needed <code>Resource</code>
*/
@Public
@Stable
public abstract Resource getNeededResources();
@Private
@Unstable
public abstract void setNeededResources(Resource needed_resources);
/**
* Set the aggregated amount of memory (in megabytes) the application has
* allocated times the number of seconds the application has been running.
* @param memory_seconds the aggregated amount of memory seconds
*/
@Private
@Unstable
public abstract void setMemorySeconds(long memory_seconds);
/**
* Get the aggregated amount of memory (in megabytes) the application has
* allocated times the number of seconds the application has been running.
* @return the aggregated amount of memory seconds
*/
@Public
@Unstable
public abstract long getMemorySeconds();
/**
* Set the aggregated number of vcores that the application has allocated
* times the number of seconds the application has been running.
* @param vcore_seconds the aggregated number of vcore seconds
*/
@Private
@Unstable
public abstract void setVcoreSeconds(long vcore_seconds);
/**
* Get the aggregated number of vcores that the application has allocated
* times the number of seconds the application has been running.
* @return the aggregated number of vcore seconds
*/
@Public
@Unstable
public abstract long getVcoreSeconds();
}
| 4,983 | 30.948718 | 82 |
java
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.