#include <molequeue/job.h>
Public Member Functions | |
Job (JobData *jobdata=NULL) | |
Job (JobManager *jobManager, IdType mQId) | |
Job (const JobReferenceBase &other) | |
QJsonObject | toJsonObject () const |
void | setFromJson (const QJsonObject &state) |
void | setQueue (const QString &newQueue) |
QString | queue () const |
void | setProgram (const QString &newProgram) |
QString | program () const |
void | setJobState (JobState state) |
JobState | jobState () const |
void | setDescription (const QString &newDesc) |
QString | description () const |
void | setInputFile (const FileSpecification &spec) |
FileSpecification | inputFile () const |
void | setAdditionalInputFiles (const QList< FileSpecification > &files) |
QList< FileSpecification > | additionalInputFiles () const |
void | addInputFile (const FileSpecification &spec) |
void | setOutputDirectory (const QString &path) |
QString | outputDirectory () const |
void | setLocalWorkingDirectory (const QString &path) |
QString | localWorkingDirectory () const |
void | setCleanRemoteFiles (bool clean) |
bool | cleanRemoteFiles () const |
void | setRetrieveOutput (bool b) |
bool | retrieveOutput () const |
void | setCleanLocalWorkingDirectory (bool b) |
bool | cleanLocalWorkingDirectory () const |
void | setHideFromGui (bool b) |
bool | hideFromGui () const |
void | setPopupOnStateChange (bool b) |
bool | popupOnStateChange () const |
void | setNumberOfCores (int num) |
int | numberOfCores () const |
void | setMaxWallTime (int minutes) |
int | maxWallTime () const |
void | setMoleQueueId (IdType id) |
IdType | moleQueueId () const |
void | setQueueId (IdType id) |
IdType | queueId () const |
void | setKeywords (const QHash< QString, QString > &keyrep) |
QHash< QString, QString > | keywords () const |
void | setKeywordReplacement (const QString &keyword, const QString &replacement) |
bool | hasKeywordReplacement (const QString &keyword) const |
QString | lookupKeywordReplacement (const QString &keyword) const |
void | replaceKeywords (QString &launchScript) const |
![]() | |
JobReferenceBase (JobData *jobdata=NULL) | |
JobReferenceBase (JobManager *jobManager, IdType moleQueueId) | |
JobReferenceBase (const JobReferenceBase &other) | |
bool | operator== (const JobReferenceBase &other) const |
bool | isValid () const |
Additional Inherited Members | |
![]() | |
JobData * | jobData () const |
bool | warnIfInvalid () const |
![]() | |
JobData * | m_jobData |
JobManager * | m_jobManager |
IdType | m_moleQueueId |
Server-side interface to JobData properties.
The Job class provides a lightweight interface to a specific instance of JobData. Since JobData contains dynamic information that changes during its lifetime, the Job interface forwards requests to a JobData instance, which ensures that all references to job information are synced throughout the application.
The Job class also ensures that JobData is modified in a consistent way. For example, calling the Job::setQueueId method will cause JobManager to emit the JobManager::jobQueueIdChanged signal, so that listeners (e.g. GUI elements) can be made aware of the change.
The JobReferenceBase class holds and validates a pointer to a JobData instance and will detect when the associated JobData object is removed from the JobManager (such as when the user deletes a job from the job table). To check the validity of the JobData pointer, use Job::isValid(), defined in JobReferenceBase.
To serialize a collection of valid Job objects as references (e.g., to maintain state in a Queue implementation between sessions), store the identifier returned from Job::moleQueueId() in the data store, and then deserialize the Job using JobManager::lookupJobByMoleQueueId.
Full serialization of all Job details can be performed by saving and restoring the JobData state via the Job::hash() and Job::setFromHash() methods. However, this should not need to be performed outside of the JobManager's serialization methods.
Job | ( | JobManager * | jobManager, |
IdType | mQId | ||
) |
Construct a new Job object for the job with the MoleQueueId in the indicated JobManager
Job | ( | const JobReferenceBase & | other | ) |
QJsonObject toJsonObject | ( | ) | const |
void setFromJson | ( | const QJsonObject & | state | ) |
Update the JobData's internal state from a QJsonObject.
void setQueue | ( | const QString & | newQueue | ) |
newQueue | name of the queue. |
QString queue | ( | ) | const |
void setProgram | ( | const QString & | newProgram | ) |
newProgram | Name of the program. |
QString program | ( | ) | const |
void setJobState | ( | JobState | state | ) |
Set the current JobState for the job. Calling this function with a different JobState will cause the JobManager::jobStateChanged signal to be emitted.
state | Status of job |
JobState jobState | ( | ) | const |
void setDescription | ( | const QString & | newDesc | ) |
newDesc | Description of job |
QString description | ( | ) | const |
void setInputFile | ( | const FileSpecification & | spec | ) |
filespec | FileSpecification describing the main input file (called by the executable) |
FileSpecification inputFile | ( | ) | const |
void setAdditionalInputFiles | ( | const QList< FileSpecification > & | files | ) |
files | FileSpecification objects describing additional input files to be placed in the working directory of the job prior to execution. |
QList<FileSpecification> additionalInputFiles | ( | ) | const |
void addInputFile | ( | const FileSpecification & | spec | ) |
param spec FileSpecification describing an input file to append to the additional input file list.
void setOutputDirectory | ( | const QString & | path | ) |
Set the output directory for the job. If empty, the Server will set it to the temporary working directory once the job is accepted. Otherwise, the output files will be copied to the specified location when the job completes.
QString outputDirectory | ( | ) | const |
void setLocalWorkingDirectory | ( | const QString & | path | ) |
path | Temporary working directory where files are stored during job execution |
QString localWorkingDirectory | ( | ) | const |
void setCleanRemoteFiles | ( | bool | clean | ) |
clean | If true, delete any working files on the remote server. Default: false. |
bool cleanRemoteFiles | ( | ) | const |
void setRetrieveOutput | ( | bool | b | ) |
b | If true, copies files back from remote server. Default: true |
bool retrieveOutput | ( | ) | const |
void setCleanLocalWorkingDirectory | ( | bool | b | ) |
b | If true, the local working files are removed after job is complete. Should be used with setOutputDirectory. Default: false |
bool cleanLocalWorkingDirectory | ( | ) | const |
void setHideFromGui | ( | bool | b | ) |
b | If true, the job will not appear in the MoleQueue user interface by default. Useful for automated batch jobs. |
bool hideFromGui | ( | ) | const |
void setPopupOnStateChange | ( | bool | b | ) |
b | If true, changes in the job state will trigger a popup notification from the MoleQueue system tray icon. Default: false |
bool popupOnStateChange | ( | ) | const |
void setNumberOfCores | ( | int | num | ) |
num | The total number of processor cores to use (if applicable). Default: 1 |
int numberOfCores | ( | ) | const |
void setMaxWallTime | ( | int | minutes | ) |
minutes | The maximum walltime for this job in minutes. Setting this to a value <= 0 will use the queue-specific default max walltime. Only available for remote queues. Default is -1. |
int maxWallTime | ( | ) | const |
void setMoleQueueId | ( | IdType | id | ) |
id | The new MoleQueue id for this job. |
IdType moleQueueId | ( | ) | const |
void setQueueId | ( | IdType | id | ) |
void setKeywords | ( | const QHash< QString, QString > & | keyrep | ) |
keyrep | The keyword replacement hash for this job. |
QHash<QString, QString> keywords | ( | ) | const |
void setKeywordReplacement | ( | const QString & | keyword, |
const QString & | replacement | ||
) |
Add a keyword / replacement pair for this job.
bool hasKeywordReplacement | ( | const QString & | keyword | ) | const |
QString lookupKeywordReplacement | ( | const QString & | keyword | ) | const |
void replaceKeywords | ( | QString & | launchScript | ) | const |
Apply the replacements in the keywords() hash to the script.