Class AtScheduler
- java.lang.Object
-
- nl.esciencecenter.xenon.schedulers.Scheduler
-
- nl.esciencecenter.xenon.adaptors.schedulers.ScriptingScheduler
-
- nl.esciencecenter.xenon.adaptors.schedulers.at.AtScheduler
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class AtScheduler extends ScriptingScheduler
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
DEFAULT_QUEUE
private JobSeenMap
jobSeenMap
private static org.slf4j.Logger
LOGGER
private long
nextUniqueID
private static java.lang.String[]
QNAMES
-
Fields inherited from class nl.esciencecenter.xenon.adaptors.schedulers.ScriptingScheduler
pollDelay, subFileSystem, subScheduler
-
Fields inherited from class nl.esciencecenter.xenon.schedulers.Scheduler
properties
-
-
Constructor Summary
Constructors Constructor Description AtScheduler(java.lang.String uniqueID, java.lang.String location, Credential credential, XenonPropertyDescription[] validProperties, java.util.Map<java.lang.String,java.lang.String> prop)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JobStatus
cancelJob(java.lang.String jobIdentifier)
Cancel a job.private void
checkQueue(java.lang.String queueName)
Checks if the provided queue name is valid, and throws an exception otherwise.protected void
checkQueueNames(java.lang.String[] givenQueueNames)
Checks if the queue names given are valid, and throw an exception otherwise.java.lang.String
getDefaultQueueName()
Get the name of the default queue.int
getDefaultRuntime()
Get the default runtime of a job in minutes.private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>
getJobInfo(java.lang.String[] queueNames)
java.lang.String[]
getJobs(java.lang.String... queueNames)
Get all job identifier of jobs currently in (one ore more) queues.JobStatus
getJobStatus(java.lang.String jobIdentifier)
Get the status of a Job.java.lang.String[]
getQueueNames()
Get the queue names supported by this Scheduler.QueueStatus
getQueueStatus(java.lang.String queueName)
Get the status of thequeue
.QueueStatus[]
getQueueStatuses(java.lang.String... queueNames)
Get the status of allqueues
.private java.lang.String
getUniqueID()
java.lang.String
submitBatchJob(JobDescription description)
Submit a batch job.Streams
submitInteractiveJob(JobDescription description)
Submit an interactive job (optional operation).-
Methods inherited from class nl.esciencecenter.xenon.adaptors.schedulers.ScriptingScheduler
checkWorkingDirectory, close, getFileSystem, getQueueStatuses, getWorkingDirectory, isOpen, runCheckedCommand, runCommand, sleep, startInteractiveCommand, translateError, waitUntilDone, waitUntilRunning
-
Methods inherited from class nl.esciencecenter.xenon.schedulers.Scheduler
assertNonNullOrEmpty, assertPositive, create, create, create, create, equals, getAdaptorDescription, getAdaptorDescriptions, getAdaptorName, getAdaptorNames, getCredential, getJobStatuses, getLocation, getProperties, hashCode
-
-
-
-
Field Detail
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
QNAMES
private static final java.lang.String[] QNAMES
-
DEFAULT_QUEUE
private static final java.lang.String DEFAULT_QUEUE
- See Also:
- Constant Field Values
-
jobSeenMap
private final JobSeenMap jobSeenMap
-
nextUniqueID
private long nextUniqueID
-
-
Constructor Detail
-
AtScheduler
public AtScheduler(java.lang.String uniqueID, java.lang.String location, Credential credential, XenonPropertyDescription[] validProperties, java.util.Map<java.lang.String,java.lang.String> prop) throws XenonException
- Throws:
XenonException
-
-
Method Detail
-
checkQueue
private void checkQueue(java.lang.String queueName) throws XenonException
Checks if the provided queue name is valid, and throws an exception otherwise. Checks against a predefined list of queue names that at uses: a-z, A-Z, and =.- Parameters:
queueName
- the queue name to check for validity- Throws:
NoSuchQueueException
- if the queue name is not validXenonException
-
checkQueueNames
protected void checkQueueNames(java.lang.String[] givenQueueNames) throws XenonException
Checks if the queue names given are valid, and throw an exception otherwise. Checks against the list of queues when the scheduler was created.- Overrides:
checkQueueNames
in classScriptingScheduler
- Parameters:
givenQueueNames
- the queue names to check for validity- Throws:
NoSuchQueueException
- if one or more of the queue names is not known in the schedulerNoSuchQueueException
- if one or more of the queue names is not known in the schedulerXenonException
-
getQueueNames
public java.lang.String[] getQueueNames() throws XenonException
Description copied from class:Scheduler
Get the queue names supported by this Scheduler.- Specified by:
getQueueNames
in classScheduler
- Returns:
- the queue names supported by this Scheduler.
- Throws:
NotConnectedException
- If scheduler is closed.XenonException
- If an I/O error occurred.
-
getDefaultQueueName
public java.lang.String getDefaultQueueName() throws XenonException
Description copied from class:Scheduler
Get the name of the default queue.- Specified by:
getDefaultQueueName
in classScheduler
- Returns:
- the name of the default queue for this scheduler, or
null
if no default queue is available. - Throws:
NotConnectedException
- If scheduler is closed.XenonException
- If an I/O error occurred.
-
getJobInfo
private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>> getJobInfo(java.lang.String[] queueNames) throws XenonException
- Throws:
XenonException
-
getJobs
public java.lang.String[] getJobs(java.lang.String... queueNames) throws XenonException
Description copied from class:Scheduler
Get all job identifier of jobs currently in (one ore more) queues. If no queue names are specified, the job identifiers for all queues are returned. Note that job identifiers of jobs submitted by other users or other schedulers may also be returned.- Specified by:
getJobs
in classScheduler
- Parameters:
queueNames
- the names of the queues.- Returns:
- an array containing the resulting job identifiers .
- Throws:
NotConnectedException
- If scheduler is closed.NoSuchQueueException
- If the queue does not exist in the scheduler.XenonException
- If the Scheduler failed to get jobs.
-
getQueueStatus
public QueueStatus getQueueStatus(java.lang.String queueName) throws XenonException
Description copied from class:Scheduler
Get the status of thequeue
.- Specified by:
getQueueStatus
in classScheduler
- Parameters:
queueName
- the name of the queue.- Returns:
- the resulting QueueStatus.
- Throws:
NoSuchQueueException
- If the queue does not exist in the scheduler.XenonException
- If the Scheduler failed to get its status.
-
getQueueStatuses
public QueueStatus[] getQueueStatuses(java.lang.String... queueNames) throws XenonException
Description copied from class:Scheduler
Get the status of allqueues
. Note that this method will only throw an exception when this exception will influence all status requests. For example, if the scheduler is no longer connected. Exceptions that only refer to a single queue are returned in the QueueStatus returned for that queue.- Specified by:
getQueueStatuses
in classScheduler
- Parameters:
queueNames
- the names of the queues.- Returns:
- an array containing the resulting QueueStatus.
- Throws:
XenonException
- If the Scheduler failed to get the statuses.
-
getUniqueID
private java.lang.String getUniqueID()
-
submitBatchJob
public java.lang.String submitBatchJob(JobDescription description) throws XenonException
Description copied from class:Scheduler
Submit a batch job.- Specified by:
submitBatchJob
in classScheduler
- Parameters:
description
- the description of the batch job to submit.- Returns:
- the job identifier representing the running job.
- Throws:
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.
-
submitInteractiveJob
public Streams submitInteractiveJob(JobDescription description) throws XenonException
Description copied from class:Scheduler
Submit an interactive job (optional operation).- Specified by:
submitInteractiveJob
in classScheduler
- Parameters:
description
- the description of the interactive job to submit.- Returns:
- a
Streams
object containing the job identifier and the standard streams of a job. - Throws:
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.
-
getJobStatus
public JobStatus getJobStatus(java.lang.String jobIdentifier) throws XenonException
Description copied from class:Scheduler
Get the status of a Job.- Specified by:
getJobStatus
in classScheduler
- Parameters:
jobIdentifier
- the job identifier of the job to get the status for.- Returns:
- the status of the Job.
- Throws:
NoSuchJobException
- If the job is not known.XenonException
- If the status of the job could not be retrieved.
-
cancelJob
public JobStatus cancelJob(java.lang.String jobIdentifier) throws XenonException
Description copied from class:Scheduler
Cancel a job.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. ThewaitUntilDone
method can be used to wait until the job is terminated.- Specified by:
cancelJob
in classScheduler
- Parameters:
jobIdentifier
- the identifier of job to kill.- Returns:
- the status of the Job.
- Throws:
NoSuchJobException
- If the job is not known.XenonException
- If the status of the job could not be retrieved.
-
getDefaultRuntime
public int getDefaultRuntime()
Description copied from class:Scheduler
Get the default runtime of a job in minutes. If no default runtime is available,-1
will be returned. If the default runtime is infinite,0
will be returned.- Overrides:
getDefaultRuntime
in classScriptingScheduler
- Returns:
- the default runtime of a job in minutes,
-1
if no default is available,0
if the default is infinite.
-
-