Class FileUploader
- Direct Known Subclasses:
FileUploader.NonLocalized
,FileUploader.ReuseFiles
,FileUploader.UploadFiles
Some of the code is a bit of a dance so we can get information early to display in status messages.
This class handles x cases:
- Non-localized, config in $DRILL_HOME/conf.
- Non-localized, config in a site directory.
- Localized, config in $DRILL_HOME.
- Localized, config in a site directory.
The non-localized case adds complexity, but is very handy when doing development as it avoids the wait for the archives to up- and down-load. The non-localized mode is not advertised to users as it defeats one of the main benefits of YARN.
In the localized case, YARN is incomplete; there is no API to inform the AM of the set of localized files, so we pass the information along in environment variables. Also, tar is a bit annoying because it includes the root directory name when unpacking, so that the drill.tar.gz archive unpacks to, say, apache-drill.x.y.z. So, we must pass along the directory name as well.
All of this is further complicated by the way YARN needs detailed information
to localize resources, and that YARN uses a "key" to identify localized
resources, which becomes the directory name in the task's working folder.
Thus, Drill becomes, say
$PWD/drill/apache-drill.x.y.z/bin, conf, ...
YARN provides PWD. The Drillbit launch script needs to know the next two
directory names.
For efficiency, we omit uploading the Drill archive if one already exists in dfs and is the same size as the one on the client. We always upload the config archive (if needed) because config changes are likely to be one reason that someone (re)starts the Drill cluster.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
static class
-
Field Summary
Modifier and TypeFieldDescriptionprotected com.typesafe.config.Config
protected DfsFacade
protected DrillOnYarnConfig
protected boolean
protected File
protected File
protected File
protected boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
defineResources
(DfsFacade.Localizer localizer, String keyProp) protected void
dump
(PrintStream out) boolean
boolean
Report whether the user wants to localize (upload) Drill files, or just use files already on the worker nodes.protected DfsFacade.Localizer
protected DfsFacade.Localizer
makeSiteLocalizer
(File siteArchive) abstract void
run()
protected void
setup()
Common setup of the Drill and site directories.protected void
upload
(DfsFacade.Localizer localizer)
-
Field Details
-
doyConfig
-
config
protected com.typesafe.config.Config config -
dfs
-
dryRun
protected boolean dryRun -
verbose
protected boolean verbose -
localDrillHome
-
localSiteDir
-
localDrillArchivePath
-
resources
-
drillArchivePath
-
siteArchivePath
-
remoteDrillHome
-
remoteSiteDir
-
-
Constructor Details
-
FileUploader
public FileUploader(boolean dryRun, boolean verbose)
-
-
Method Details
-
run
- Throws:
ClientException
-
setup
Common setup of the Drill and site directories.- Throws:
ClientException
-
hasSiteDir
public boolean hasSiteDir() -
isLocalized
public boolean isLocalized()Report whether the user wants to localize (upload) Drill files, or just use files already on the worker nodes.- Returns:
-
connectToDfs
- Throws:
ClientException
-
makeDrillLocalizer
- Throws:
ClientException
-
makeSiteLocalizer
-
upload
- Throws:
ClientException
-
defineResources
protected void defineResources(DfsFacade.Localizer localizer, String keyProp) throws ClientException - Throws:
ClientException
-
dump
-