Abstract interface for job submission. More...
#include <globalsearch/queueinterface.h>
Public Types | |
enum | QueueStatus { Unknown = -1, Success, Error, Queued, Running, CommunicationError, Started, Pending } |
Public Slots | |
virtual void | readSettings (const QString &filename="") |
virtual void | writeSettings (const QString &filename="") |
virtual bool | writeInputFiles (Structure *s) const |
virtual bool | writeFiles (Structure *s, const QHash< QString, QString > &files) const =0 |
virtual bool | startJob (Structure *s)=0 |
virtual bool | stopJob (Structure *s)=0 |
virtual QueueInterface::QueueStatus | getStatus (Structure *s) const =0 |
virtual bool | prepareForStructureUpdate (Structure *s) const =0 |
virtual bool | checkIfFileExists (Structure *s, const QString &filename, bool *exists)=0 |
virtual bool | fetchFile (Structure *s, const QString &filename, QString *contents) const =0 |
virtual bool | grepFile (Structure *s, const QString &matchText, const QString &filename, QStringList *matches=0, int *exitcode=0, const bool caseSensitive=true) const =0 |
QString | getIDString () const |
QStringList | getTemplateFileNames () const |
bool | hasDialog () |
virtual QDialog * | dialog () |
Public Member Functions | |
QueueInterface (OptBase *parent, const QString &settingFile="") | |
virtual | ~QueueInterface () |
virtual bool | isReadyToSearch (QString *err) |
Protected Attributes | |
OptBase * | m_opt |
Cached pointer to the parent OptBase class. | |
QString | m_idString |
String identifying the type of queue interface. | |
QStringList | m_templates |
bool | m_hasDialog |
Whether this QueueInterface has a configuration dialog. | |
QDialog * | m_dialog |
Pointer to configuration dialog (may be NULL). |
Abstract interface for job submission.
Do not derive directly from this class. Instead, use LocalQueue or (more likely) RemoteQueue.
TODO detailed description.
Definition at line 41 of file queueinterface.h.
Possible status for running jobs
Unknown |
Something very bizarre has happened. |
Success |
Job has completed successfully. |
Error |
Job finished, but the optimization was unsuccessful. |
Queued |
Job is queued. |
Running |
Job is current running. |
CommunicationError |
Communication with a remote server has failed. |
Started |
Job has appeared in queue, but the Structure still returns Structure::Submitted instead of Structure::InProcess. This will be corrected in the next iteration of QueueManager::checkRunning(). |
Pending |
Job has been submitted, but has not appeared in queue. |
Definition at line 65 of file queueinterface.h.
GlobalSearch::QueueInterface::QueueInterface | ( | OptBase * | parent, | |
const QString & | settingFile = "" | |||
) | [inline, explicit] |
Constructor
parent | OptBase parent | |
settingFile | Filename from which to initialize settings. |
Definition at line 52 of file queueinterface.h.
virtual GlobalSearch::QueueInterface::~QueueInterface | ( | ) | [inline, virtual] |
Destructor
Definition at line 59 of file queueinterface.h.
virtual bool GlobalSearch::QueueInterface::checkIfFileExists | ( | Structure * | s, | |
const QString & | filename, | |||
bool * | exists | |||
) | [pure virtual, slot] |
Check if the file filename exists in the working directory of Structure s and store the result in exists.
Implemented in GlobalSearch::LocalQueueInterface.
Referenced by GlobalSearch::Optimizer::checkIfOutputFileExists().
virtual bool GlobalSearch::QueueInterface::fetchFile | ( | Structure * | s, | |
const QString & | filename, | |||
QString * | contents | |||
) | const [pure virtual, slot] |
Retrieve the contents of the file filename for Structure s as a QString contents.
Implemented in GlobalSearch::LocalQueueInterface.
QString GlobalSearch::QueueInterface::getIDString | ( | ) | const [inline, slot] |
Definition at line 249 of file queueinterface.h.
References m_idString.
Referenced by GlobalSearch::Optimizer::readTemplatesFromSettings(), and GlobalSearch::Optimizer::writeTemplatesToSettings().
virtual QueueInterface::QueueStatus GlobalSearch::QueueInterface::getStatus | ( | Structure * | s | ) | const [pure virtual, slot] |
QStringList GlobalSearch::QueueInterface::getTemplateFileNames | ( | ) | const [inline, slot] |
Definition at line 255 of file queueinterface.h.
References m_templates.
Referenced by GlobalSearch::AbstractEditTab::getTemplateNames(), and GlobalSearch::Optimizer::updateQueueInterface().
virtual bool GlobalSearch::QueueInterface::grepFile | ( | Structure * | s, | |
const QString & | matchText, | |||
const QString & | filename, | |||
QStringList * | matches = 0 , |
|||
int * | exitcode = 0 , |
|||
const bool | caseSensitive = true | |||
) | const [pure virtual, slot] |
Grep through the file filename in Structure s's working directory, looking for matchText. The list of matches is returned in the QStringList matches and the exit status is returned as exitcode.
Possible exitcodes:
s | Structure of interest | |
matchText | Text to match | |
filename | Name of file to grep | |
matches | List of matches (return) | |
exitcode | Exit code of grep (see details) (return) | |
caseSensitive | If true, match case. Otherwise, perform case-insensitive search (e.g. grep -i) Default is true. |
Implemented in GlobalSearch::LocalQueueInterface.
Referenced by GlobalSearch::Optimizer::checkForSuccessfulOutput().
virtual bool GlobalSearch::QueueInterface::isReadyToSearch | ( | QString * | err | ) | [inline, virtual] |
Check that all mandatory internal variables are set. Check this before starting a search.
err | String to be overwritten with an error message |
Definition at line 97 of file queueinterface.h.
virtual bool GlobalSearch::QueueInterface::prepareForStructureUpdate | ( | Structure * | s | ) | const [pure virtual, slot] |
Perform any work needed before calling Optimizer::update. This function mainly exists for RemoteQueue classes to copy files back from the server, but may be used for other purposes. It is guaranteed to be called by Optimizer before updating.
s | The structure that is to be updated. |
Implemented in GlobalSearch::LocalQueueInterface.
Referenced by GlobalSearch::Optimizer::update().
virtual void GlobalSearch::QueueInterface::readSettings | ( | const QString & | filename = "" |
) | [inline, virtual, slot] |
Read optimizer data from file (.scheme or .state). If called without an argument, this function does nothing, i.e. it will not read optimizer data from the system config file.
filename | Scheme or state file to load data from. |
Definition at line 109 of file queueinterface.h.
virtual bool GlobalSearch::QueueInterface::startJob | ( | Structure * | s | ) | [pure virtual, slot] |
Start a job for Structure s.
Referenced by GlobalSearch::QueueManager::startJob().
virtual bool GlobalSearch::QueueInterface::stopJob | ( | Structure * | s | ) | [pure virtual, slot] |
Stop any currently running jobs for Structure s.
Referenced by GlobalSearch::QueueManager::stopJob().
virtual bool GlobalSearch::QueueInterface::writeFiles | ( | Structure * | s, | |
const QHash< QString, QString > & | files | |||
) | const [pure virtual, slot] |
Write the provided files in the hash files to the local working directory for Structure s and (if appropriate) copy them to a remote server.
s | Structure of interest | |
files | Key: filename, Value: text. |
Implemented in GlobalSearch::LocalQueueInterface.
Referenced by writeInputFiles().
bool GlobalSearch::QueueInterface::writeInputFiles | ( | Structure * | s | ) | const [virtual, slot] |
Write the input files for Structure s to the appropriate location.
This function will also construct and write any queue-specific files (e.g. job.pbs for PBS queues) and copy them to the remote host if using a remote queue.
Definition at line 28 of file queueinterface.cpp.
References GlobalSearch::Optimizer::getInterpretedTemplates(), m_opt, GlobalSearch::OptBase::optimizer(), and writeFiles().
virtual void GlobalSearch::QueueInterface::writeSettings | ( | const QString & | filename = "" |
) | [inline, virtual, slot] |
Write optimizer data to file (.scheme or .state). If called without an argument, this function does nothing, i.e. it will not write optimizer data to the system config file.
filename | Scheme or state file to write data to. |
Definition at line 119 of file queueinterface.h.
Referenced by GlobalSearch::Optimizer::writeSettings().
QStringList GlobalSearch::QueueInterface::m_templates [protected] |
QStringList containing list of all template filenames
Definition at line 283 of file queueinterface.h.
Referenced by getTemplateFileNames().