@InterfaceAudience.Public public class TezClient extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TezClient.TezClientBuilder
A builder for setting up an instance of
TezClient |
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) |
protected |
TezClient(String name,
TezConfiguration tezConf,
boolean isSession,
Map<String,org.apache.hadoop.yarn.api.records.LocalResource> localResources,
org.apache.hadoop.security.Credentials credentials,
ServicePluginsDescriptor servicePluginsDescriptor) |
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.
|
static org.apache.hadoop.yarn.api.records.ApplicationId |
appIdfromString(String appIdStr) |
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.
|
String |
getAmHost() |
protected ScheduledExecutorService |
getAMKeepAliveService() |
int |
getAmPort() |
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
|
TezClient |
getClient(org.apache.hadoop.yarn.api.records.ApplicationId appId)
Alternative to start() that explicitly sets sessionAppId and doesn't start a new AM.
|
TezClient |
getClient(String appIdStr) |
String |
getClientName()
Get the name of the client
|
protected long |
getPrewarmWaitTimeMs() |
static TezClient.TezClientBuilder |
newBuilder(String name,
TezConfiguration tezConf)
Create a new TezClientBuilder.
|
void |
preWarm(PreWarmVertex preWarmVertex)
API to help pre-allocate containers in session mode.
|
void |
preWarm(PreWarmVertex preWarmVertex,
long timeout,
TimeUnit unit)
API to help pre-allocate containers in session mode.
|
org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPB |
sendAMHeartbeat(org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPB proxy) |
void |
setAppMasterCredentials(org.apache.hadoop.security.Credentials credentials)
Set security credentials to be used inside the app master, if needed.
|
void |
setHistoryLogLevel(HistoryLogLevel historyLogLevel)
Sets the history log level for this session.
|
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.
|
boolean |
waitTillReady(long timeout,
TimeUnit unit)
Wait till the DAG is ready to be submitted.
|
public static final String DAG
@InterfaceAudience.Private protected TezClient(String name, TezConfiguration tezConf, boolean isSession, @Nullable Map<String,org.apache.hadoop.yarn.api.records.LocalResource> localResources, @Nullable org.apache.hadoop.security.Credentials credentials)
@InterfaceAudience.Private protected TezClient(String name, TezConfiguration tezConf, boolean isSession, @Nullable Map<String,org.apache.hadoop.yarn.api.records.LocalResource> localResources, @Nullable org.apache.hadoop.security.Credentials credentials, ServicePluginsDescriptor servicePluginsDescriptor)
public static TezClient.TezClientBuilder newBuilder(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 frameworkTezClient.TezClientBuilder
which can be used to construct the final TezClient.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
- the files to be made available in the AMpublic 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
- credentialspublic void setHistoryLogLevel(HistoryLogLevel historyLogLevel)
historyLogLevel
- The log level to be used.public void start() throws TezException, IOException
TezException
IOException
public TezClient getClient(String appIdStr) throws IOException, TezException
IOException
TezException
public TezClient getClient(org.apache.hadoop.yarn.api.records.ApplicationId appId) throws TezException, IOException
appId
- TezException
IOException
public org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPB sendAMHeartbeat(org.apache.tez.dag.api.client.rpc.DAGClientAMProtocolBlockingPB proxy)
public DAGClient submitDAG(DAG dag) throws TezException, IOException
dag
- DAG to be submitted to SessionTezException
IOException
DAGSubmissionTimedOut
- if submission timed outprotected long getPrewarmWaitTimeMs()
public 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.Unstable public void preWarm(PreWarmVertex preWarmVertex, long timeout, TimeUnit unit) throws TezException, IOException
preWarmVertex
- timeout
- unit
- TezException
IOException
@InterfaceStability.Evolving public void waitTillReady() throws IOException, TezException, InterruptedException
@InterfaceStability.Evolving public boolean waitTillReady(long timeout, TimeUnit unit) throws IOException, TezException, InterruptedException
timeout
- unit
- IOException
TezException
InterruptedException
protected ScheduledExecutorService getAMKeepAliveService()
@InterfaceAudience.Public @InterfaceStability.Unstable public static org.apache.hadoop.yarn.api.records.ApplicationId appIdfromString(String appIdStr)
public String getAmHost()
public int getAmPort()
Copyright © 2024 Apache Software Foundation. All rights reserved.