public abstract class AbstractResourceLocalizer extends java.lang.Object implements SmartResourceLocalizer
ResourceLocalizer.| Constructor and Description |
|---|
AbstractResourceLocalizer(org.apache.hadoop.conf.Configuration configuration)
Instantiates a new abstract resource localizer.
|
AbstractResourceLocalizer(org.apache.hadoop.conf.Configuration configuration,
org.apache.hadoop.fs.Path stagingDirectory)
Instantiates a new abstract resource localizer.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
clean()
Cleans all leftovers what has been created during
the distribute process.
|
void |
copy()
If resource localizer has knowledge to copy files
into file system, calling this method effectively
should do all tasks for that specific functionality.
|
protected boolean |
deleteStagingEntries()
Delete staging entries.
|
void |
distribute()
If underlying implementation needs to do operations
on file system or any other preparation work,
calling of this method should make implementation
ready to return resources from
ResourceLocalizer.getResources()
command. |
protected abstract void |
doFileCopy(org.apache.hadoop.fs.FileSystem fs)
Do file copy.
|
protected abstract java.util.Map<java.lang.String,org.apache.hadoop.yarn.api.records.LocalResource> |
doFileTransfer(org.apache.hadoop.fs.FileSystem fs)
Do file transfer.
|
org.apache.hadoop.conf.Configuration |
getConfiguration()
Gets the hadoop configuration.
|
java.util.concurrent.locks.ReentrantLock |
getLock()
Gets the lock.
|
java.util.Map<java.lang.String,org.apache.hadoop.yarn.api.records.LocalResource> |
getResources()
Gets a map of
LocalResource instances. |
protected boolean |
isCopied()
Checks if is copied.
|
protected boolean |
isDistributed()
Checks if is distributed.
|
void |
resolve()
Manually resolve resources before distribution process
is initiated.
|
protected org.apache.hadoop.fs.Path |
resolveStagingDirectory()
Resolve runtime staging directory.
|
protected void |
setCopied(boolean copied)
Sets the copied.
|
protected void |
setDistributed(boolean distributed)
Sets the distributed.
|
void |
setStagingDirectory(org.apache.hadoop.fs.Path stagingDirectory)
Sets the staging directory.
|
void |
setStagingId(java.lang.String stagingId)
Sets the staging id.
|
public AbstractResourceLocalizer(org.apache.hadoop.conf.Configuration configuration)
configuration - the configurationpublic AbstractResourceLocalizer(org.apache.hadoop.conf.Configuration configuration,
org.apache.hadoop.fs.Path stagingDirectory)
configuration - the configurationstagingDirectory - the staging directorypublic java.util.Map<java.lang.String,org.apache.hadoop.yarn.api.records.LocalResource> getResources()
ResourceLocalizerLocalResource instances. Underlying
instances of LocalResources needs to be fully
initialised including resource size and timestamp.
Calling this method should do all needed preparation work
needed to return LocalResources.
getResources in interface ResourceLocalizerLocalResource instancespublic void copy()
SmartResourceLocalizercopy in interface SmartResourceLocalizerpublic void distribute()
SmartResourceLocalizerResourceLocalizer.getResources()
command.
Effectively result of calling this method should be same as calling both SmartResourceLocalizer.copy() and SmartResourceLocalizer.resolve() methods manually.
distribute in interface SmartResourceLocalizerpublic void resolve()
SmartResourceLocalizerresolve in interface SmartResourceLocalizerpublic boolean clean()
SmartResourceLocalizerclean in interface SmartResourceLocalizerpublic void setStagingDirectory(org.apache.hadoop.fs.Path stagingDirectory)
SmartResourceLocalizersetStagingDirectory in interface SmartResourceLocalizerstagingDirectory - the new staging directorypublic void setStagingId(java.lang.String stagingId)
SmartResourceLocalizerPath
set in SmartResourceLocalizer.setStagingDirectory(Path) to post fix unique
runtime staging path. If not set simultaneous instances of
same application may override files.setStagingId in interface SmartResourceLocalizerstagingId - the new staging idpublic org.apache.hadoop.conf.Configuration getConfiguration()
public java.util.concurrent.locks.ReentrantLock getLock()
protected abstract void doFileCopy(org.apache.hadoop.fs.FileSystem fs)
throws java.lang.Exception
fs - the fsjava.lang.Exception - the exceptionprotected abstract java.util.Map<java.lang.String,org.apache.hadoop.yarn.api.records.LocalResource> doFileTransfer(org.apache.hadoop.fs.FileSystem fs)
throws java.lang.Exception
fs - the fsjava.lang.Exception - the exceptionprotected boolean isDistributed()
protected void setDistributed(boolean distributed)
distributed - the new distributedprotected boolean isCopied()
protected void setCopied(boolean copied)
copied - the new copiedprotected org.apache.hadoop.fs.Path resolveStagingDirectory()
protected boolean deleteStagingEntries()