Class LocalResource
java.lang.Object
org.apache.hadoop.yarn.api.records.LocalResource
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 LocalResourceType and
LocalResourceVisibility.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract StringGet the pattern that should be used to extract entries from the archive (only used when type isPATTERN).abstract URLGet the location of the resource to be localized.abstract booleanNM uses it to decide whether if it is necessary to upload the resource to the shared cacheabstract longgetSize()Get the size of the resource to be localized.abstract longGet the original timestamp of the resource to be localized, used for verification.abstract LocalResourceTypegetType()Get theLocalResourceTypeof the resource to be localized.abstract LocalResourceVisibilityGet theLocalResourceVisibilityof the resource to be localized.static LocalResourcenewInstance(URL url, LocalResourceType type, LocalResourceVisibility visibility, long size, long timestamp) static LocalResourcenewInstance(URL url, LocalResourceType type, LocalResourceVisibility visibility, long size, long timestamp, boolean shouldBeUploadedToSharedCache) static LocalResourcenewInstance(URL url, LocalResourceType type, LocalResourceVisibility visibility, long size, long timestamp, String pattern) static LocalResourcenewInstance(URL url, LocalResourceType type, LocalResourceVisibility visibility, long size, long timestamp, String pattern, boolean shouldBeUploadedToSharedCache) abstract voidsetPattern(String pattern) Set the pattern that should be used to extract entries from the archive (only used when type isPATTERN).abstract voidsetResource(URL resource) Set location of the resource to be localized.abstract voidsetShouldBeUploadedToSharedCache(boolean shouldBeUploadedToSharedCache) Inform NM whether upload to SCM is needed.abstract voidsetSize(long size) Set the size of the resource to be localized.abstract voidsetTimestamp(long timestamp) Set the timestamp of the resource to be localized, used for verification.abstract voidsetType(LocalResourceType type) Set theLocalResourceTypeof the resource to be localized.abstract voidsetVisibility(LocalResourceVisibility visibility) Set theLocalResourceVisibilityof the resource to be localized.
-
Constructor Details
-
LocalResource
public LocalResource()
-
-
Method Details
-
newInstance
@Public @Stable public static LocalResource newInstance(URL url, LocalResourceType type, LocalResourceVisibility visibility, long size, long timestamp, String pattern) -
newInstance
@Public @Unstable public static LocalResource newInstance(URL url, LocalResourceType type, LocalResourceVisibility visibility, long size, long timestamp, String pattern, boolean shouldBeUploadedToSharedCache) -
newInstance
@Public @Stable public static LocalResource newInstance(URL url, LocalResourceType type, LocalResourceVisibility visibility, long size, long timestamp) -
newInstance
@Public @Unstable public static LocalResource newInstance(URL url, LocalResourceType type, LocalResourceVisibility visibility, long size, long timestamp, boolean shouldBeUploadedToSharedCache) -
getResource
Get the location of the resource to be localized.- Returns:
- location of the resource to be localized
-
setResource
Set location of the resource to be localized.- Parameters:
resource- location of the resource to be localized
-
getSize
@Public @Stable public abstract long getSize()Get the size of the resource to be localized.- Returns:
- size of the resource to be localized
-
setSize
@Public @Stable public abstract void setSize(long size) Set the size of the resource to be localized.- Parameters:
size- size of the resource to be localized
-
getTimestamp
@Public @Stable public abstract long getTimestamp()Get the original timestamp of the resource to be localized, used for verification.- Returns:
- timestamp of the resource to be localized
-
setTimestamp
@Public @Stable public abstract void setTimestamp(long timestamp) Set the timestamp of the resource to be localized, used for verification.- Parameters:
timestamp- timestamp of the resource to be localized
-
getType
Get theLocalResourceTypeof the resource to be localized.- Returns:
LocalResourceTypeof the resource to be localized
-
setType
Set theLocalResourceTypeof the resource to be localized.- Parameters:
type-LocalResourceTypeof the resource to be localized
-
getVisibility
Get theLocalResourceVisibilityof the resource to be localized.- Returns:
LocalResourceVisibilityof the resource to be localized
-
setVisibility
Set theLocalResourceVisibilityof the resource to be localized.- Parameters:
visibility-LocalResourceVisibilityof the resource to be localized
-
getPattern
Get the pattern that should be used to extract entries from the archive (only used when type isPATTERN).- Returns:
- pattern that should be used to extract entries from the archive.
-
setPattern
Set the pattern that should be used to extract entries from the archive (only used when type isPATTERN).- Parameters:
pattern- pattern that should be used to extract entries from the archive.
-