public interface Jobs
Modifier and Type | Method and Description |
---|---|
JobStatus |
cancelJob(Job job)
Cancel a job.
|
void |
close(Scheduler scheduler)
Close a Scheduler.
|
java.lang.String |
getDefaultQueueName(Scheduler scheduler)
Get the name of the default queue for the
scheduler . |
Job[] |
getJobs(Scheduler scheduler,
java.lang.String... queueNames)
Get all jobs currently in (one ore more) queues of
scheduler . |
JobStatus |
getJobStatus(Job job)
Get the status of a Job.
|
JobStatus[] |
getJobStatuses(Job... jobs)
Get the status of all specified
jobs . |
QueueStatus |
getQueueStatus(Scheduler scheduler,
java.lang.String queueName)
Get the status of the
queue of scheduler . |
QueueStatus[] |
getQueueStatuses(Scheduler scheduler,
java.lang.String... queueNames)
Get the status of all
queues of scheduler . |
Streams |
getStreams(Job job)
Returns the standard streams of a job.
|
boolean |
isOpen(Scheduler scheduler)
Test if a Scheduler is open.
|
Scheduler |
newScheduler(java.lang.String scheme,
java.lang.String location,
Credential credential,
java.util.Map<java.lang.String,java.lang.String> properties)
Create a new Scheduler that represents a (possibly remote) job
scheduler at the
location , using the scheme
and credentials to get access. |
Job |
submitJob(Scheduler scheduler,
JobDescription description)
Submit a job to a Scheduler.
|
JobStatus |
waitUntilDone(Job job,
long timeout)
Wait until a job is done or until a timeout expires.
|
JobStatus |
waitUntilRunning(Job job,
long timeout)
Wait for as long a job is waiting in a queue, or until a timeout expires.
|
Scheduler newScheduler(java.lang.String scheme, java.lang.String location, Credential credential, java.util.Map<java.lang.String,java.lang.String> properties) throws XenonException
location
, using the scheme
and credentials
to get access. Make sure to always close
Scheduler
instances by calling close(Scheduler)
when
you no longer need them, otherwise their associated resources remain
allocated.scheme
- the scheme used to access the Scheduler.location
- the location of the Scheduler.credential
- the Credentials to use to get access to the Scheduler.properties
- optional properties to configure the Scheduler when it is created.UnknownPropertyException
- If a unknown property was provided.InvalidPropertyException
- If a known property was provided with an invalid value.InvalidLocationException
- If the location was invalid.InvalidCredentialException
- If the credential is invalid to access the location.XenonException
- If the creation of the Scheduler failed.void close(Scheduler scheduler) throws XenonException
scheduler
- the Scheduler to close.NoSuchSchedulerException
- If the scheduler is not known.XenonException
- If the Scheduler failed to close.boolean isOpen(Scheduler scheduler) throws XenonException
scheduler
- the Scheduler to test.XenonException
- If the test failed.XenonException
- If an I/O error occurred.java.lang.String getDefaultQueueName(Scheduler scheduler) throws XenonException
scheduler
.scheduler
- the Scheduler.null
if no default queue is available.NoSuchSchedulerException
- If the scheduler is not known.XenonException
- If the Scheduler failed to get its status.XenonException
- If an I/O error occurred.Job[] getJobs(Scheduler scheduler, java.lang.String... queueNames) throws XenonException
scheduler
.
If no queue names are specified, the jobs for all queues are returned.
Note that jobs submitted by other users or other schedulers may also be returned.scheduler
- the Scheduler.queueNames
- the names of the queues.NoSuchSchedulerException
- If the scheduler is not known.NoSuchQueueException
- If the queue does not exist in the scheduler.XenonException
- If the Scheduler failed to get jobs.QueueStatus getQueueStatus(Scheduler scheduler, java.lang.String queueName) throws XenonException
queue
of scheduler
.scheduler
- the Scheduler.queueName
- the name of the queue.NoSuchSchedulerException
- If the scheduler is not known.NoSuchQueueException
- If the queue does not exist in the scheduler.XenonException
- If the Scheduler failed to get its status.QueueStatus[] getQueueStatuses(Scheduler scheduler, java.lang.String... queueNames) throws XenonException
queues
of scheduler
.
Note that this method will only throw an exception when this exception will influence all status requests. For example, if
the scheduler is invalid or not reachable.
Exceptions that only refer to a single queue are returned in the QueueStatus returned for that queue.scheduler
- the Scheduler.queueNames
- the names of the queues.NoSuchSchedulerException
- If the scheduler is not known.XenonException
- If the Scheduler failed to get the statusses.Job submitJob(Scheduler scheduler, JobDescription description) throws XenonException
scheduler
- the Scheduler.description
- the description of the job to submit.IncompleteJobDescriptionException
- If the description did not contain the required information.InvalidJobDescriptionException
- If the description contains illegal or conflicting values.UnsupportedJobDescriptionException
- If the description is not legal for this scheduler.XenonException
- If the Scheduler failed to get submit the job.JobStatus getJobStatus(Job job) throws XenonException
job
- the job.NoSuchJobException
- If the job is not known.XenonException
- If the status of the job could not be retrieved.JobStatus[] getJobStatuses(Job... jobs)
jobs
.
The array of JobStatus
contains one entry for each of the jobs
. The order of the elements in the
returned JobStatus
array corresponds to the order in which the jobs
are passed as parameters. If
a job
is null
, the corresponding entry in the JobStatus
array will also be
null
. If the retrieval of the JobStatus
fails for a job, the exception will be stored in the
corresponding JobsStatus
entry.
jobs
- the jobs for which to retrieve the status.Streams getStreams(Job job) throws XenonException
job
- the interactive job for which to retrieve the streams.XenonException
- if the job is not interactive.JobStatus cancelJob(Job job) throws XenonException
A status is returned that indicates the state of the job after the cancel. If the job was already done it cannot be cancelled.
A JobStatus
is returned that can be used to determine the state of the job after cancelJob returns. Note that it
may take some time before the job has actually terminated. The waitUntilDone
method can
be used to wait until the job is terminated.
job
- the job to kill.NoSuchJobException
- If the job is not known.XenonException
- If the status of the job could not be retrieved.JobStatus waitUntilDone(Job job, long timeout) throws XenonException
This method will wait until a job is done, killed, or produces an error, or until a timeout expires. If the timeout expires, the job will continue to run normally.
The timeout is in milliseconds and must be >= 0, where 0 means an infinite timeout.
A JobStatus is returned that can be used to determine why the call returned.
job
- the job.timeout
- the maximum time to wait for the job in milliseconds.NoSuchJobException
- If the job is not known.XenonException
- If the status of the job could not be retrieved.JobStatus waitUntilRunning(Job job, long timeout) throws XenonException
This method will return as soon as the job is no longer waiting in the queue. This is generally the case when it starts running, but it may also be killed or produce an error. If the timeout expires, the job will continue to be queued normally.
The timeout is in milliseconds and must be >= 0, where 0 means an infinite timeout.
A JobStatus is returned that can be used to determine why the call returned.
job
- the job.timeout
- the maximum time to wait in milliseconds.NoSuchJobException
- If the job is not known.XenonException
- If the status of the job could not be retrieved.