public abstract class SchedulerConnection
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private ScriptingAdaptor |
adaptor |
protected XenonEngine |
engine |
private java.lang.String |
id |
private static org.slf4j.Logger |
LOGGER |
private long |
pollDelay |
private XenonProperties |
properties |
private static int |
schedulerID |
private FileSystem |
subFileSystem |
private Scheduler |
subScheduler |
Modifier | Constructor and Description |
---|---|
protected |
SchedulerConnection(ScriptingAdaptor adaptor,
java.lang.String scheme,
java.lang.String location,
Credential credential,
XenonProperties properties,
XenonEngine engine,
long pollDelay) |
Modifier and Type | Method and Description |
---|---|
abstract JobStatus |
cancelJob(Job job) |
protected void |
checkQueueNames(java.lang.String[] givenQueueNames)
Checks if the queue names given are valid, and throw an exception otherwise.
|
protected void |
checkWorkingDirectory(java.lang.String workingDirectory)
Check if the given working directory exists.
|
void |
close() |
abstract java.lang.String |
getDefaultQueueName() |
protected Path |
getFsEntryPath() |
java.lang.String |
getID() |
abstract Job[] |
getJobs(java.lang.String... queueNames) |
abstract JobStatus |
getJobStatus(Job job) |
abstract JobStatus[] |
getJobStatuses(Job... jobs) |
protected static int |
getNextSchedulerID() |
XenonProperties |
getProperties() |
abstract java.lang.String[] |
getQueueNames() |
abstract QueueStatus |
getQueueStatus(java.lang.String queueName) |
abstract QueueStatus[] |
getQueueStatuses(java.lang.String... queueNames) |
abstract Scheduler |
getScheduler() |
abstract Streams |
getStreams(Job job) |
protected static java.lang.String |
identifiersAsCSList(Job[] jobs) |
java.lang.String |
runCheckedCommand(java.lang.String stdin,
java.lang.String executable,
java.lang.String... arguments)
Run a command until completion.
|
RemoteCommandRunner |
runCommand(java.lang.String stdin,
java.lang.String executable,
java.lang.String... arguments)
Run a command on the remote scheduler machine.
|
Job |
startInteractiveCommand(java.lang.String executable,
java.lang.String... arguments)
Start an interactive command on the remote machine (usually via ssh).
|
abstract Job |
submitJob(JobDescription description) |
protected static boolean |
supportsScheme(java.lang.String scheme,
java.lang.String[] supportedSchemes) |
protected static void |
verifyJobDescription(JobDescription description,
java.lang.String adaptorName)
Do some checks on a job description.
|
protected static void |
verifyJobInfo(java.util.Map<java.lang.String,java.lang.String> jobInfo,
Job job,
java.lang.String adaptorName,
java.lang.String jobIDField,
java.lang.String... additionalFields)
Check if the info map for a job exists, contains the expected job ID, and contains the given additional fields
|
protected static void |
verifyJobOptions(java.util.Map<java.lang.String,java.lang.String> options,
java.lang.String[] validOptions,
java.lang.String adaptorName) |
JobStatus |
waitUntilDone(Job job,
long timeout)
Wait until a Job is done, or until the give timeout expires (whichever comes first).
|
JobStatus |
waitUntilRunning(Job job,
long timeout)
Wait until a Job is running (or already done), or until the give timeout expires (whichever comes first).
|
private static final org.slf4j.Logger LOGGER
private static int schedulerID
private final ScriptingAdaptor adaptor
private final java.lang.String id
protected final XenonEngine engine
private final Scheduler subScheduler
private final FileSystem subFileSystem
private final XenonProperties properties
private final long pollDelay
protected SchedulerConnection(ScriptingAdaptor adaptor, java.lang.String scheme, java.lang.String location, Credential credential, XenonProperties properties, XenonEngine engine, long pollDelay) throws XenonException
XenonException
protected static int getNextSchedulerID()
protected static boolean supportsScheme(java.lang.String scheme, java.lang.String[] supportedSchemes)
protected static void verifyJobDescription(JobDescription description, java.lang.String adaptorName) throws XenonException
description
- the job description to checkadaptorName
- the name of the adaptor. Used when an exception is thrownIncompleteJobDescriptionException
- if the description is missing a mandatory value.InvalidJobDescriptionException
- if the description contains illegal values.XenonException
protected static void verifyJobOptions(java.util.Map<java.lang.String,java.lang.String> options, java.lang.String[] validOptions, java.lang.String adaptorName) throws InvalidJobDescriptionException
InvalidJobDescriptionException
protected static void verifyJobInfo(java.util.Map<java.lang.String,java.lang.String> jobInfo, Job job, java.lang.String adaptorName, java.lang.String jobIDField, java.lang.String... additionalFields) throws XenonException
jobInfo
- the map the job info should be .job
- the job to check the presence for.adaptorName
- name of the current adaptor for error reporting.jobIDField
- the field which contains the job id.additionalFields
- any additional fields to check the presence of.XenonException
- if any fields are missing or incorrectprotected static java.lang.String identifiersAsCSList(Job[] jobs)
protected Path getFsEntryPath()
public XenonProperties getProperties()
public java.lang.String getID()
public RemoteCommandRunner runCommand(java.lang.String stdin, java.lang.String executable, java.lang.String... arguments) throws XenonException
stdin
- the text to write to the input of the executable.executable
- the executable to runarguments
- the arguments to the executableRemoteCommandRunner
that can be used to monitor the running commandXenonException
- if an error occurspublic java.lang.String runCheckedCommand(java.lang.String stdin, java.lang.String executable, java.lang.String... arguments) throws XenonException
stdin
- the text to write to the input of the executable.executable
- the executable to runarguments
- the arguments to the executableXenonException
- if an error occurredpublic Job startInteractiveCommand(java.lang.String executable, java.lang.String... arguments) throws XenonException
executable
- the executable to startarguments
- the arguments to pass to the executableJob
that represents the interactive commandXenonException
- if an error occurredprotected void checkQueueNames(java.lang.String[] givenQueueNames) throws NoSuchQueueException
givenQueueNames
- the queue names to check for validityNoSuchQueueException
- if one or more of the queue names is not known in the schedulerpublic JobStatus waitUntilDone(Job job, long timeout) throws XenonException
job
- the Job to wait fortimeout
- the maximum number of milliseconds to wait, 0 to wait forever, or negative to return immediately.XenonException
- if an error occurspublic JobStatus waitUntilRunning(Job job, long timeout) throws XenonException
job
- the Job to wait fortimeout
- the maximum number of milliseconds to wait, 0 to wait forever, or negative to return immediately.XenonException
- if an error occursprotected void checkWorkingDirectory(java.lang.String workingDirectory) throws XenonException
workingDirectory
- the working directory (either absolute or relative) as given by the user.XenonException
- if workingDirectory does not exist, or an error occurred.public void close() throws XenonException
XenonException
public abstract Scheduler getScheduler()
public abstract java.lang.String[] getQueueNames()
public abstract java.lang.String getDefaultQueueName()
public abstract QueueStatus getQueueStatus(java.lang.String queueName) throws XenonException
XenonException
public abstract QueueStatus[] getQueueStatuses(java.lang.String... queueNames) throws XenonException
XenonException
public abstract Job[] getJobs(java.lang.String... queueNames) throws XenonException
XenonException
public abstract Job submitJob(JobDescription description) throws XenonException
XenonException
public abstract JobStatus cancelJob(Job job) throws XenonException
XenonException
public abstract JobStatus getJobStatus(Job job) throws XenonException
XenonException
public abstract JobStatus[] getJobStatuses(Job... jobs) throws XenonException
XenonException
public abstract Streams getStreams(Job job) throws XenonException
XenonException