public abstract class FileUploader extends Object
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:
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.
Modifier and Type | Class and Description |
---|---|
static class |
FileUploader.NonLocalized |
static class |
FileUploader.ReuseFiles |
static class |
FileUploader.UploadFiles |
Modifier and Type | Field and Description |
---|---|
protected com.typesafe.config.Config |
config |
protected DfsFacade |
dfs |
protected DrillOnYarnConfig |
doyConfig |
String |
drillArchivePath |
protected boolean |
dryRun |
protected File |
localDrillArchivePath |
protected File |
localDrillHome |
protected File |
localSiteDir |
String |
remoteDrillHome |
String |
remoteSiteDir |
Map<String,org.apache.hadoop.yarn.api.records.LocalResource> |
resources |
String |
siteArchivePath |
protected boolean |
verbose |
Constructor and Description |
---|
FileUploader(boolean dryRun,
boolean verbose) |
Modifier and Type | Method and Description |
---|---|
protected void |
connectToDfs() |
protected void |
defineResources(DfsFacade.Localizer localizer,
String keyProp) |
protected void |
dump(PrintStream out) |
boolean |
hasSiteDir() |
boolean |
isLocalized()
Report whether the user wants to localize (upload) Drill files, or just use
files already on the worker nodes.
|
protected DfsFacade.Localizer |
makeDrillLocalizer() |
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) |
protected DrillOnYarnConfig doyConfig
protected com.typesafe.config.Config config
protected DfsFacade dfs
protected boolean dryRun
protected boolean verbose
protected File localDrillHome
protected File localSiteDir
protected File localDrillArchivePath
public String drillArchivePath
public String siteArchivePath
public String remoteDrillHome
public String remoteSiteDir
public abstract void run() throws ClientException
ClientException
protected void setup() throws ClientException
ClientException
public boolean hasSiteDir()
public boolean isLocalized()
protected void connectToDfs() throws ClientException
ClientException
protected DfsFacade.Localizer makeDrillLocalizer() throws ClientException
ClientException
protected DfsFacade.Localizer makeSiteLocalizer(File siteArchive)
protected void upload(DfsFacade.Localizer localizer) throws ClientException
ClientException
protected void defineResources(DfsFacade.Localizer localizer, String keyProp) throws ClientException
ClientException
protected void dump(PrintStream out)
Copyright © 1970 The Apache Software Foundation. All rights reserved.