#include <molequeue/queue.h>
Public Slots | |
virtual bool | submitJob (MoleQueue::Job job)=0 |
virtual void | killJob (MoleQueue::Job job)=0 |
virtual void | setLaunchTemplate (const QString &script) |
virtual void | setLaunchScriptName (const QString &scriptName) |
Signals | |
void | programAdded (const QString &name, MoleQueue::Program *program) |
void | programRemoved (const QString &name, MoleQueue::Program *program) |
void | programRenamed (const QString &newName, Program *prog, const QString &oldName) |
void | nameChanged (const QString &newName, const QString &oldName) |
Public Member Functions | |
Server * | server () |
const Server * | server () const |
QueueManager * | queueManager () |
const QueueManager * | queueManager () const |
virtual void | setName (const QString &newName) |
QString | name () const |
virtual QString | typeName () const |
bool | readSettings (const QString &filePath) |
bool | writeSettings () const |
bool | exportSettings (const QString &fileName, bool includePrograms=true) const |
bool | importSettings (const QString &fileName, bool includePrograms=true) |
QString | stateFileName () const |
virtual bool | writeJsonSettings (QJsonObject &value, bool exportOnly, bool includePrograms) const |
virtual bool | readJsonSettings (const QJsonObject &value, bool importOnly, bool includePrograms) |
virtual AbstractQueueSettingsWidget * | settingsWidget () |
bool | addProgram (Program *newProgram, bool replace=false) |
bool | removeProgram (Program *programToRemove) |
bool | removeProgram (const QString &programName) |
Program * | lookupProgram (const QString &programName) const |
QStringList | programNames () const |
QList< Program * > | programs () const |
int | numPrograms () const |
virtual QString | launchTemplate () const |
QString | launchScriptName () const |
int | jobFailureCount (IdType moleQueueId) const |
virtual void | replaceKeywords (QString &launchScript, const Job &job, bool addNewline=true) |
Static Public Member Functions | |
static QString | queueTypeFromFile (const QString &mqqFile) |
Protected Slots | |
virtual void | jobAboutToBeRemoved (const MoleQueue::Job &job) |
void | programNameChanged (const QString &newName, const QString &oldName) |
void | cleanLocalDirectory (const MoleQueue::Job &job) |
Protected Member Functions | |
Queue (const QString &queueName="Undefined", QueueManager *parentManager=0) | |
bool | writeInputFiles (const Job &job) |
bool | addJobFailure (IdType moleQueueId) |
void | clearJobFailures (IdType moleQueueId) |
Protected Attributes | |
QueueManager * | m_queueManager |
Server * | m_server |
QString | m_name |
QString | m_launchTemplate |
QString | m_launchScriptName |
QMap< QString, Program * > | m_programs |
QMap< IdType, IdType > | m_jobs |
QMap< IdType, int > | m_failureTracker |
Abstract interface for queuing systems.
The Queue interface defines interactions with a distributed resource management system, such as job submission and job status updates. Each Queue object manages a set of Program instances, which contain information about the related task of actually running an executable to do work.
|
explicitprotected |
Protected constructor. Use QueueManager:::addQueue() method to create new Queue objects.
QueueManager* queueManager | ( | ) |
const QueueManager* queueManager | ( | ) | const |
|
virtual |
Set the name of the queue. This should be unique, and will be used in the GUI to refer to this queue.
QString name | ( | ) | const |
Get the name of the queue.
|
virtual |
Returns the type of the queue as a string.
Reimplemented in QueueUit, QueueLocal, QueuePbs, QueueSge, and QueueSlurm.
bool readSettings | ( | const QString & | filePath | ) |
Read settings for the queue, done early on at startup.
filePath | Path to the .mqq file with the queue settings. |
This method calls readJsonSettings to perform the actual setting of state information. Subclasses should reimplement that method.
bool writeSettings | ( | ) | const |
Write settings for the queue, done just before closing the server. The settings are written to [server's local working directory]/config/queues/[queuename].mqq
This method calls writeJsonSettings to perform the actual collection of state information. Subclasses should reimplement that method.
bool exportSettings | ( | const QString & | fileName, |
bool | includePrograms = true |
||
) | const |
Write this Queue's configuration to the .mqq file fileName. Sensitive data (such as usernames, etc) and mutatable state data (like current jobs) are not written, see writeSettings() if these are needed.
includePrograms | Export this queue's programs as well. Default: true |
This method calls writeJsonSettings to perform the actual collection of state information. Subclasses should reimplement that method.
bool importSettings | ( | const QString & | fileName, |
bool | includePrograms = true |
||
) |
Set this Queue's configuration using the the .mqq file fileName. Sensitive data (such as usernames, etc) and mutatable state data (like current jobs) are not read, see readSettings() if these are needed.
includePrograms | Import any programs contained in the importer. Default: true |
This method calls readJsonSettings to perform the actual setting of state information. Subclasses should reimplement that method.
|
static |
mqqFile | Filename of the mqq (MoleQueue Queue) file. |
QString stateFileName | ( | ) | const |
|
virtual |
writeJsonSettings Write the queue's internal state into a JSON object.
value | Target JSON object. |
exportOnly | If true, instance specific information (e.g. currently running jobs, login details, etc) is omitted. |
includePrograms | Whether or not to include the Queue's program configurations. |
Reimplemented in QueueUit, QueueLocal, QueueRemoteSsh, and QueueRemote.
|
virtual |
readJsonSettings Initialize the queue's internal state from a JSON object.
value | Source JSON object. |
importOnly | If true, instance specific information (e.g. currently running jobs, login details, etc) is ignored. |
includePrograms | Whether or not to include the Queue's program configurations. |
Reimplemented in QueueUit, QueueLocal, QueueRemoteSsh, and QueueRemote.
|
virtual |
Returns a widget that can be used to configure the settings for the queue.
Reimplemented in QueueRemoteSsh, QueueUit, QueueLocal, and QueueRemote.
bool addProgram | ( | Program * | newProgram, |
bool | replace = false |
||
) |
Add a new program to the queue. Program names must be unique in each queue, as they are used to specify which program will be used.
program | The program to be added to the queue. |
replace | Defaults to false, if true replace any program with the same name in this queue. |
bool removeProgram | ( | Program * | programToRemove | ) |
Attempt to remove a program from the queue. The program name is used as the criteria to decice which object to remove.
program | The program to be removed from the queue. |
bool removeProgram | ( | const QString & | programName | ) |
Attempt to remove a program from the queue. The program name is used as the criteria to decide which object to remove.
name | The name of the program to be removed from the queue. |
Program* lookupProgram | ( | const QString & | programName | ) | const |
Retrieve the program object associated with the supplied name.
name | The name of the program. |
QStringList programNames | ( | ) | const |
int numPrograms | ( | ) | const |
|
virtual |
It should contain the token "$$programExecution$$", which will be replaced with program-specific launch details.
QString launchScriptName | ( | ) | const |
int jobFailureCount | ( | IdType | moleQueueId | ) | const |
moleQueueId | MoleQueue id of Job of interest. |
|
virtual |
replaceKeywords Replace $$keywords$$ in launchScript with queue/job specific values.
launchScript | Launch script to complete. |
job | Job data to use. |
Reimplemented in QueueRemote.
|
signal |
|
signal |
Emitted when a program is removed from the queue.
name | Name of the program |
program | Pointer to the removed Program object. |
|
signal |
programRenamed Emitted when a program is renamed.
|
signal |
Emitted when the name of the queue is changed.
|
pure virtualslot |
Writes input files and submits a new job to the queue.
job | Job to submit. |
|
pure virtualslot |
killJob Stop the job and remove from the queue. Set the JobState to Canceled.
job | Job to kill. |
|
virtualslot |
|
virtualslot |
Update the launch script name.
scriptName | The new launch script name. |
|
protectedvirtualslot |
Called when the JobManager::jobAboutToBeRemoved signal is emitted to remove any internal references to the job. Subclasses should reimplement if they hold any state about owned jobs.
|
protectedslot |
Update internal data structures when the name of a program changes.
|
protectedslot |
Delete the local working directory of Job.
|
protected |
Write the input files for job to the local working directory.
|
protected |
addJobFailure Call this when a job encounters a problem but will be retried (e.g. a possible networking failure). The failure will be recorded and the return value will indicate whether to retry the job or not. If this function returns true, the job has failed less than 3 times and an attempt should be made to retry. If it returns false, the job has exceeded the maximum number of retries and should be aborted. The failure count will be reset and an error will be logged if the maximum retries are exceeded.
moleQueueId |
|
protected |
clearJobFailures Remove all recorded job failures for a job. This does not necessarily mean that the job is successful, but that it is no longer being retried.
moleQueueId | MoleQueue id of job |
|
protected |
Lookup table for jobs that are using this Queue. Maps JobId to MoleQueueId.
|
protected |
Keeps track of the number of times a job has failed (MoleQueueId to #failures). Once a job fails three times, it will no longer retry.