public class JobClient
extends java.lang.Object
| Constructor and Description |
|---|
JobClient(java.lang.String url,
java.util.List<okhttp3.Interceptor> interceptors,
GenieNetworkConfiguration genieNetworkConfiguration)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
Job |
getJob(java.lang.String jobId)
Method to get a job from Genie.
|
java.util.List<Application> |
getJobApplications(java.lang.String jobId)
Method to get the Applications for the job.
|
Cluster |
getJobCluster(java.lang.String jobId)
Method to get the cluster on which the job executes.
|
Command |
getJobCommand(java.lang.String jobId)
Method to get the command on which the job executes.
|
JobExecution |
getJobExecution(java.lang.String jobId)
Method to get the Job Execution information for the job.
|
JobRequest |
getJobRequest(java.lang.String jobId)
Method to get the Job Request for the job.
|
java.util.List<JobSearchResult> |
getJobs()
Method to get a list of all the jobs.
|
java.util.List<JobSearchResult> |
getJobs(java.lang.String id,
java.lang.String name,
java.lang.String user,
java.util.Set<java.lang.String> statuses,
java.util.Set<java.lang.String> tags,
java.lang.String clusterName,
java.lang.String clusterId,
java.lang.String commandName,
java.lang.String commandId,
java.lang.Long minStarted,
java.lang.Long maxStarted,
java.lang.Long minFinished,
java.lang.Long maxFinished)
Deprecated.
|
java.util.List<JobSearchResult> |
getJobs(java.lang.String id,
java.lang.String name,
java.lang.String user,
java.util.Set<java.lang.String> statuses,
java.util.Set<java.lang.String> tags,
java.lang.String clusterName,
java.lang.String clusterId,
java.lang.String commandName,
java.lang.String commandId,
java.lang.Long minStarted,
java.lang.Long maxStarted,
java.lang.Long minFinished,
java.lang.Long maxFinished,
java.lang.String grouping,
java.lang.String groupingInstance)
Method to get a list of all the jobs from Genie for the query parameters specified.
|
JobStatus |
getJobStatus(java.lang.String jobId)
Method to fetch the status of a job.
|
java.io.InputStream |
getJobStderr(java.lang.String jobId)
Method to fetch the stderr of a job from Genie.
|
java.io.InputStream |
getJobStdout(java.lang.String jobId)
Method to fetch the stdout of a job from Genie.
|
void |
killJob(java.lang.String jobId)
Method to send a kill job request to Genie.
|
java.lang.String |
submitJob(JobRequest jobRequest)
Submit a job to genie using the jobRequest provided.
|
java.lang.String |
submitJobWithAttachments(JobRequest jobRequest,
java.util.Map<java.lang.String,java.io.InputStream> attachments)
Submit a job to genie using the jobRequest and attachments provided.
|
JobStatus |
waitForCompletion(java.lang.String jobId,
long blockTimeout)
Wait for job to complete, until the given timeout.
|
JobStatus |
waitForCompletion(java.lang.String jobId,
long blockTimeout,
long pollTime)
Wait for job to complete, until the given timeout.
|
public JobClient(@NotEmpty
java.lang.String url,
@Nullable
java.util.List<okhttp3.Interceptor> interceptors,
@Nullable
GenieNetworkConfiguration genieNetworkConfiguration)
throws GenieClientException
url - The endpoint URL of the Genie API. Not null or emptyinterceptors - Any interceptors to configure the client with, can include security onesgenieNetworkConfiguration - The network configuration parameters. Could be nullGenieClientException - On errorpublic java.lang.String submitJob(JobRequest jobRequest) throws java.io.IOException, GenieClientException
jobRequest - A job request containing all the details for running a job.GenieClientException - If the response recieved is not 2xx.java.io.IOException - For Network and other IO issues.public java.lang.String submitJobWithAttachments(JobRequest jobRequest, java.util.Map<java.lang.String,java.io.InputStream> attachments) throws java.io.IOException, GenieClientException
jobRequest - A job request containing all the details for running a job.attachments - A map of filenames/input-streams needed to be sent to the server as attachments.GenieClientException - If the response recieved is not 2xx.java.io.IOException - For Network and other IO issues.public java.util.List<JobSearchResult> getJobs() throws java.io.IOException, GenieClientException
GenieClientException - If the response recieved is not 2xx.java.io.IOException - For Network and other IO issues.@Deprecated public java.util.List<JobSearchResult> getJobs(java.lang.String id, java.lang.String name, java.lang.String user, java.util.Set<java.lang.String> statuses, java.util.Set<java.lang.String> tags, java.lang.String clusterName, java.lang.String clusterId, java.lang.String commandName, java.lang.String commandId, java.lang.Long minStarted, java.lang.Long maxStarted, java.lang.Long minFinished, java.lang.Long maxFinished) throws java.io.IOException, GenieClientException
Deprecated: For new search fields
id - id for jobname - name of job (can be a SQL-style pattern such as HIVE%)user - user who submitted jobstatuses - statuses of jobs to findtags - tags for the jobclusterName - the name of the clusterclusterId - the id of the clustercommandName - the name of the command run by the jobcommandId - the id of the command run by the jobminStarted - The time which the job had to start after in order to be return (inclusive)maxStarted - The time which the job had to start before in order to be returned (exclusive)minFinished - The time which the job had to finish after in order to be return (inclusive)maxFinished - The time which the job had to finish before in order to be returned (exclusive)GenieClientException - If the response received is not 2xx.java.io.IOException - For Network and other IO issues.getJobs(
String,
String,
String,
Set,
Set,
String,
String,
String,
String,
Long,
Long,
Long,
Long,
String,
String
)public java.util.List<JobSearchResult> getJobs(@Nullable java.lang.String id, @Nullable java.lang.String name, @Nullable java.lang.String user, @Nullable java.util.Set<java.lang.String> statuses, @Nullable java.util.Set<java.lang.String> tags, @Nullable java.lang.String clusterName, @Nullable java.lang.String clusterId, @Nullable java.lang.String commandName, @Nullable java.lang.String commandId, @Nullable java.lang.Long minStarted, @Nullable java.lang.Long maxStarted, @Nullable java.lang.Long minFinished, @Nullable java.lang.Long maxFinished, @Nullable java.lang.String grouping, @Nullable java.lang.String groupingInstance) throws java.io.IOException, GenieClientException
id - id for jobname - name of job (can be a SQL-style pattern such as HIVE%)user - user who submitted jobstatuses - statuses of jobs to findtags - tags for the jobclusterName - the name of the clusterclusterId - the id of the clustercommandName - the name of the command run by the jobcommandId - the id of the command run by the jobminStarted - The time which the job had to start after in order to be return (inclusive)maxStarted - The time which the job had to start before in order to be returned (exclusive)minFinished - The time which the job had to finish after in order to be return (inclusive)maxFinished - The time which the job had to finish before in order to be returned (exclusive)grouping - The grouping the job should be a member ofgroupingInstance - The grouping instance the job should be a member ofGenieClientException - If the response received is not 2xx.java.io.IOException - For Network and other IO issues.public Job getJob(java.lang.String jobId) throws java.io.IOException, GenieClientException
jobId - The id of the job to get.GenieClientException - If the response received is not 2xx.java.io.IOException - For Network and other IO issues.public Cluster getJobCluster(java.lang.String jobId) throws java.io.IOException, GenieClientException
jobId - The id of the job.GenieClientException - If the response recieved is not 2xx.java.io.IOException - For Network and other IO issues.public Command getJobCommand(java.lang.String jobId) throws java.io.IOException, GenieClientException
jobId - The id of the job.GenieClientException - If the response recieved is not 2xx.java.io.IOException - For Network and other IO issues.public JobRequest getJobRequest(java.lang.String jobId) throws java.io.IOException, GenieClientException
jobId - The id of the job.GenieClientException - If the response recieved is not 2xx.java.io.IOException - For Network and other IO issues.public JobExecution getJobExecution(java.lang.String jobId) throws java.io.IOException, GenieClientException
jobId - The id of the job.GenieClientException - If the response recieved is not 2xx.java.io.IOException - For Network and other IO issues.public java.util.List<Application> getJobApplications(java.lang.String jobId) throws java.io.IOException, GenieClientException
jobId - The id of the job.GenieClientException - If the response recieved is not 2xx.java.io.IOException - For Network and other IO issues.public java.io.InputStream getJobStdout(java.lang.String jobId)
throws java.io.IOException,
GenieClientException
jobId - The id of the job whose output is desired.GenieClientException - If the response recieved is not 2xx.java.io.IOException - For Network and other IO issues.public java.io.InputStream getJobStderr(java.lang.String jobId)
throws java.io.IOException,
GenieClientException
jobId - The id of the job whose stderr is desired.GenieClientException - If the response recieved is not 2xx.java.io.IOException - For Network and other IO issues.public JobStatus getJobStatus(java.lang.String jobId) throws java.io.IOException, GenieClientException
jobId - The id of the job.GenieClientException - If the response recieved is not 2xx.java.io.IOException - For Network and other IO issues.public void killJob(java.lang.String jobId)
throws java.io.IOException,
GenieClientException
jobId - The id of the job.GenieClientException - If the response received is not 2xx.java.io.IOException - For Network and other IO issues.public JobStatus waitForCompletion(java.lang.String jobId, long blockTimeout, long pollTime) throws GenieClientException, java.lang.InterruptedException, java.io.IOException, GenieTimeoutException
jobId - the Genie job ID to wait for completionblockTimeout - the time to block for (in ms), after which a
GenieClientException will be thrownpollTime - the time to sleep between polling for job statusjava.lang.InterruptedException - on thread errors.GenieClientException - If the response received is not 2xx.java.io.IOException - For Network and other IO issues.GenieTimeoutException - If the job times out.public JobStatus waitForCompletion(java.lang.String jobId, long blockTimeout) throws GenieClientException, java.lang.InterruptedException, java.io.IOException, GenieTimeoutException
jobId - the Genie job ID to wait for completion.blockTimeout - the time to block for (in ms), after which a
GenieClientException will be thrown.java.lang.InterruptedException - on thread errors.GenieClientException - If the response received is not 2xx.java.io.IOException - For Network and other IO issues.GenieTimeoutException - If the job times out.