@InterfaceAudience.Public public class TezClient extends Object
Modifier | Constructor and Description |
---|---|
protected |
TezClient(String name,
TezConfiguration tezConf,
boolean isSession,
Map<String,org.apache.hadoop.yarn.api.records.LocalResource> localResources,
org.apache.hadoop.security.Credentials credentials) |
Modifier and Type | Method and Description |
---|---|
void |
addAppMasterLocalFiles(Map<String,org.apache.hadoop.yarn.api.records.LocalResource> localFiles)
Add local files for the DAG App Master.
|
void |
clearAppMasterLocalFiles()
If the next DAG App Master needs different local files, then use this
method to clear the local files and then add the new local files
using
addAppMasterLocalFiles(Map) . |
static TezClient |
create(String name,
TezConfiguration tezConf)
Create a new TezClient.
|
static TezClient |
create(String name,
TezConfiguration tezConf,
boolean isSession)
Create a new TezClient with AM session mode set explicitly.
|
static TezClient |
create(String name,
TezConfiguration tezConf,
boolean isSession,
Map<String,org.apache.hadoop.yarn.api.records.LocalResource> localFiles,
org.apache.hadoop.security.Credentials credentials)
Create a new TezClient with AM session mode set explicitly.
|
static TezClient |
create(String name,
TezConfiguration tezConf,
Map<String,org.apache.hadoop.yarn.api.records.LocalResource> localFiles,
org.apache.hadoop.security.Credentials credentials)
Create a new TezClient.
|
TezAppMasterStatus |
getAppMasterStatus()
Get the status of the App Master executing the DAG
In non-session mode it returns the status of the last submitted DAG App Master
In session mode, it returns the status of the App Master hosting the session
|
String |
getClientName()
Get the name of the client
|
protected org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPB |
getSessionAMProxy(org.apache.hadoop.yarn.api.records.ApplicationId appId) |
void |
preWarm(PreWarmVertex preWarmVertex)
API to help pre-allocate containers in session mode.
|
void |
setAppMasterCredentials(org.apache.hadoop.security.Credentials credentials)
Set security credentials to be used inside the app master, if needed.
|
void |
start()
Start the client.
|
void |
stop()
Stop the client.
|
DAGClient |
submitDAG(DAG dag)
Submit a DAG.
|
void |
waitTillReady()
Wait till the DAG is ready to be submitted.
|
public static final String DAG
public static TezClient create(String name, TezConfiguration tezConf)
name
- Name of the client. Used for logging etc. This will also be used
as app master name is session modetezConf
- Configuration for the frameworkpublic static TezClient create(String name, TezConfiguration tezConf, @Nullable Map<String,org.apache.hadoop.yarn.api.records.LocalResource> localFiles, @Nullable org.apache.hadoop.security.Credentials credentials)
name
- Name of the client. Used for logging etc. This will also be used
as app master name is session modetezConf
- Configuration for the frameworklocalFiles
- local files for the App Mastercredentials
- Set security credentials to be used inside the app master, if
needed. Tez App Master needs credentials to access the staging
directory and for most HDFS cases these are automatically obtained
by Tez client. If the staging directory is on a file system for
which credentials cannot be obtained or for any credentials needed
by user code running inside the App Master, credentials must be
supplied by the user. These will be used by the App Master for the
next DAG. public static TezClient create(String name, TezConfiguration tezConf, boolean isSession)
name
- Name of the client. Used for logging etc. This will also be used
as app master name is session modetezConf
- Configuration for the frameworkisSession
- The AM will run in session mode or notpublic static TezClient create(String name, TezConfiguration tezConf, boolean isSession, @Nullable Map<String,org.apache.hadoop.yarn.api.records.LocalResource> localFiles, @Nullable org.apache.hadoop.security.Credentials credentials)
name
- Name of the client. Used for logging etc. This will also be used
as app master name is session modetezConf
- Configuration for the frameworkisSession
- The AM will run in session mode or notlocalFiles
- local files for the App Mastercredentials
- credentials for the App Masterpublic void addAppMasterLocalFiles(Map<String,org.apache.hadoop.yarn.api.records.LocalResource> localFiles)
In non-session mode these will be added to the files of the App Master
to be launched for the next DAG. Files added via this method will
accumulate and be used for every new App Master until
clearAppMasterLocalFiles()
is invoked.
In session mode, the recommended usage is to add all files before calling start() so that all needed files are available to the app master before it starts. When called after start(), these local files will be re-localized to the running session DAG App Master and will be added to its classpath for execution of this DAG.
Caveats for invoking this method after start() in session mode: files accumulate across DAG submissions and are never removed from the classpath. Only LocalResourceType.FILE is supported. All files will be treated as private.
localFiles
- public void clearAppMasterLocalFiles()
addAppMasterLocalFiles(Map)
. This method is a no-op in session mode,
after start() is called.public void setAppMasterCredentials(org.apache.hadoop.security.Credentials credentials)
credentials
- public void start() throws TezException, IOException
TezException
IOException
public DAGClient submitDAG(DAG dag) throws TezException, IOException
dag
- DAG to be submitted to SessionTezException
IOException
DAGSubmissionTimedOut
- if submission timed outpublic void stop() throws TezException, IOException
TezException
IOException
public String getClientName()
public TezAppMasterStatus getAppMasterStatus() throws TezException, IOException
TezException
IOException
@InterfaceStability.Unstable public void preWarm(PreWarmVertex preWarmVertex) throws TezException, IOException
preWarmVertex
- TezException
IOException
@InterfaceStability.Evolving public void waitTillReady() throws IOException, TezException, InterruptedException
protected org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPB getSessionAMProxy(org.apache.hadoop.yarn.api.records.ApplicationId appId) throws TezException, IOException
TezException
IOException
Copyright © 2015 Apache Software Foundation. All rights reserved.