All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.apache.hadoop.yarn.api.records.LocalResource Maven / Gradle / Ivy

There is a newer version: 3.4.0
Show newest version
/**
 * 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;
import org.apache.hadoop.yarn.util.Records;

/**
 * 

LocalResource represents a local resource required to * run a container.

* *

The NodeManager is responsible for localizing the resource * prior to launching the container.

* *

Applications can specify {@link LocalResourceType} and * {@link LocalResourceVisibility}.

* * @see LocalResourceType * @see LocalResourceVisibility * @see ContainerLaunchContext * @see ApplicationSubmissionContext * @see ContainerManagementProtocol#startContainers(org.apache.hadoop.yarn.api.protocolrecords.StartContainersRequest) */ @Public @Stable public abstract class LocalResource { @Public @Stable public static LocalResource newInstance(URL url, LocalResourceType type, LocalResourceVisibility visibility, long size, long timestamp, String pattern) { LocalResource resource = Records.newRecord(LocalResource.class); resource.setResource(url); resource.setType(type); resource.setVisibility(visibility); resource.setSize(size); resource.setTimestamp(timestamp); resource.setPattern(pattern); return resource; } @Public @Stable public static LocalResource newInstance(URL url, LocalResourceType type, LocalResourceVisibility visibility, long size, long timestamp) { return newInstance(url, type, visibility, size, timestamp, null); } /** * Get the location of the resource to be localized. * @return location of the resource to be localized */ @Public @Stable public abstract URL getResource(); /** * Set location of the resource to be localized. * @param resource location of the resource to be localized */ @Public @Stable public abstract void setResource(URL resource); /** * Get the size of the resource to be localized. * @return size of the resource to be localized */ @Public @Stable public abstract long getSize(); /** * Set the size of the resource to be localized. * @param size size of the resource to be localized */ @Public @Stable public abstract void setSize(long size); /** * Get the original timestamp of the resource to be localized, used * for verification. * @return timestamp of the resource to be localized */ @Public @Stable public abstract long getTimestamp(); /** * Set the timestamp of the resource to be localized, used * for verification. * @param timestamp timestamp of the resource to be localized */ @Public @Stable public abstract void setTimestamp(long timestamp); /** * Get the LocalResourceType of the resource to be localized. * @return LocalResourceType of the resource to be localized */ @Public @Stable public abstract LocalResourceType getType(); /** * Set the LocalResourceType of the resource to be localized. * @param type LocalResourceType of the resource to be localized */ @Public @Stable public abstract void setType(LocalResourceType type); /** * Get the LocalResourceVisibility of the resource to be * localized. * @return LocalResourceVisibility of the resource to be * localized */ @Public @Stable public abstract LocalResourceVisibility getVisibility(); /** * Set the LocalResourceVisibility of the resource to be * localized. * @param visibility LocalResourceVisibility of the resource to be * localized */ @Public @Stable public abstract void setVisibility(LocalResourceVisibility visibility); /** * Get the pattern that should be used to extract entries from the * archive (only used when type is PATTERN). * @return pattern that should be used to extract entries from the * archive. */ @Public @Stable public abstract String getPattern(); /** * Set the pattern that should be used to extract entries from the * archive (only used when type is PATTERN). * @param pattern pattern that should be used to extract entries * from the archive. */ @Public @Stable public abstract void setPattern(String pattern); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy