public interface IJobScheduler
extends java.io.Closeable
connect()
method to connect to the cluster.
You can then submit and monitor jobs.ClusterJobScheduler
Modifier and Type | Method and Description |
---|---|
void |
cancelJob(java.util.UUID jobId,
boolean listenForCancellationEvent)
Cancels the job with the specified id.
|
void |
cancelTask(java.util.UUID taskId)
Cancels the task with the specified id.
|
void |
close()
Closes this JobScheduler and releases any system resources associated with it.
|
void |
connect()
Connects client to specified job scheduler.
|
Job |
createJob()
Returns a new job that can later be used to submit to the job scheduler.
|
void |
disconnect()
Disconnects client from specified job scheduler.
|
void |
dispose()
Deprecated.
Please use
close() (or a try-with-resources statement) |
java.util.UUID |
getId()
Gets the id of this job scheduler.
|
boolean |
getIsConnected()
Gets a value indicating whether the job scheduler is connected.
|
int |
getMaximumHostCount()
Returns the maximum number of hosts that is available to the job scheduler.
|
void |
submitJob(Job job,
JobSubmitListener listener)
Submits job to the job scheduler so that the job scheduler can add the job to it's queue.
|
boolean |
waitUntilDone(java.util.UUID jobId,
int millisecondsTimeout,
java.lang.Runnable heartbeatCallback,
int millisecondsHeartbeat)
Blocks until all tasks in this job complete or the operation times out.
|
java.util.UUID getId()
boolean getIsConnected()
true
if this scheduler is connected; otherwise, false
.void connect() throws JobSchedulerException
JobSchedulerException
- An error occurred while connect to job scheduler.void disconnect()
@Deprecated void dispose()
close()
(or a try-with-resources statement)void close()
close
in interface java.lang.AutoCloseable
close
in interface java.io.Closeable
Job createJob() throws JobSchedulerException
JobSchedulerException
- Thrown if client is not connected to the job scheduler yet.int getMaximumHostCount() throws JobSchedulerException
JobSchedulerException
- If operation fails.void submitJob(Job job, JobSubmitListener listener) throws JobSchedulerException
job
- The job to be submitted.JobSchedulerException
- If a task or task environment cannot be serialized.void cancelJob(java.util.UUID jobId, boolean listenForCancellationEvent) throws JobSchedulerException
jobId
- The id of the job to cancel.listenForCancellationEvent
- if set to true
, client will listen for the cancellation event. Otherwise, cancellation events can be ignored.JobSchedulerException
- Thrown if client is not connected to the job scheduler yet.void cancelTask(java.util.UUID taskId) throws JobSchedulerException
taskId
- The id of the task to cancel.JobSchedulerException
- Thrown if client is not connected to the job scheduler yet.boolean waitUntilDone(java.util.UUID jobId, int millisecondsTimeout, java.lang.Runnable heartbeatCallback, int millisecondsHeartbeat) throws JobSchedulerException
millisecondsHeartbeat
argument.jobId
- The job id for the job to be submitted.millisecondsTimeout
- The timeout (in milliseconds).heartbeatCallback
- The heartbeat callback.millisecondsHeartbeat
- The heartbeat period (in milliseconds).true
if job completed, false
if timed-out.JobSchedulerException
- Thrown if client disconnects from the job scheduler.