MoleQueue 0.9.0
Loading...
Searching...
No Matches
Job Class Reference

#include <molequeue/job.h>

Inheritance diagram for Job:
JobReferenceBase

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< FileSpecificationadditionalInputFiles () 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
Public Member Functions inherited from JobReferenceBase
 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

Protected Member Functions inherited from JobReferenceBase
JobDatajobData () const
bool warnIfInvalid () const
Protected Attributes inherited from JobReferenceBase
JobDatam_jobData
JobManagerm_jobManager
IdType m_moleQueueId

Detailed Description

Server-side interface to JobData properties.

Author
David C. Lonie

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.

Constructor & Destructor Documentation

◆ Job() [1/3]

Job ( JobData * jobdata = NULL)

Construct a new Job object with the specified JobData.

◆ Job() [2/3]

Job ( JobManager * jobManager,
IdType mQId )

Construct a new Job object for the job with the MoleQueueId in the indicated JobManager

◆ Job() [3/3]

Job ( const JobReferenceBase & other)

Construct a new Job object with the same JobData as other.

Member Function Documentation

◆ toJsonObject()

QJsonObject toJsonObject ( ) const
Returns
The JobData's internal state as a QJsonObject

◆ setFromJson()

void setFromJson ( const QJsonObject & state)

Update the JobData's internal state from a QJsonObject.

◆ setQueue()

void setQueue ( const QString & newQueue)
Parameters
newQueuename of the queue.

◆ queue()

QString queue ( ) const
Returns
Name of queue to use.

◆ setProgram()

void setProgram ( const QString & newProgram)
Parameters
newProgramName of the program.

◆ program()

QString program ( ) const
Returns
Name of program to run.

◆ setJobState()

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.

Parameters
stateStatus of job

◆ jobState()

JobState jobState ( ) const
Returns
Status of job

◆ setDescription()

void setDescription ( const QString & newDesc)
Parameters
newDescDescription of job

◆ description()

QString description ( ) const
Returns
newDesc Description of job

◆ setInputFile()

void setInputFile ( const FileSpecification & spec)
Parameters
filespecFileSpecification describing the main input file (called by the executable)

◆ inputFile()

FileSpecification inputFile ( ) const
Returns
FileSpecification describing the main input file (called by the executable)

◆ setAdditionalInputFiles()

void setAdditionalInputFiles ( const QList< FileSpecification > & files)
Parameters
filesFileSpecification objects describing additional input files to be placed in the working directory of the job prior to execution.

◆ additionalInputFiles()

QList< FileSpecification > additionalInputFiles ( ) const
Returns
FileSpecification objects describing additional input files to be placed in the working directory of the job prior to execution.

◆ addInputFile()

void addInputFile ( const FileSpecification & spec)

param spec FileSpecification describing an input file to append to the additional input file list.

◆ setOutputDirectory()

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.

◆ outputDirectory()

QString outputDirectory ( ) const
Returns
String containing a location to copy the output files to after the job completes. Ignored if empty.

◆ setLocalWorkingDirectory()

void setLocalWorkingDirectory ( const QString & path)
Parameters
pathTemporary working directory where files are stored during job execution
Warning
This is set internally by MoleQueue, do not modify.

◆ localWorkingDirectory()

QString localWorkingDirectory ( ) const
Returns
Temporary working directory where files are stored during job execution.

◆ setCleanRemoteFiles()

void setCleanRemoteFiles ( bool clean)
Parameters
cleanIf true, delete any working files on the remote server. Default: false.

◆ cleanRemoteFiles()

bool cleanRemoteFiles ( ) const
Returns
If true, delete any working files on the remote server. Default: false.

◆ setRetrieveOutput()

void setRetrieveOutput ( bool b)
Parameters
bIf true, copies files back from remote server. Default: true

◆ retrieveOutput()

bool retrieveOutput ( ) const
Returns
If true, copies files back from remote server. Default: true

◆ setCleanLocalWorkingDirectory()

void setCleanLocalWorkingDirectory ( bool b)
Parameters
bIf true, the local working files are removed after job is complete. Should be used with setOutputDirectory. Default: false

◆ cleanLocalWorkingDirectory()

bool cleanLocalWorkingDirectory ( ) const
Returns
If true, the local working files are removed after job is complete. Should be used with setOutputDirectory. Default: false

◆ setHideFromGui()

void setHideFromGui ( bool b)
Parameters
bIf true, the job will not appear in the MoleQueue user interface by default. Useful for automated batch jobs.

◆ hideFromGui()

bool hideFromGui ( ) const
Returns
If true, the job will not appear in the queue. Default: false

◆ setPopupOnStateChange()

void setPopupOnStateChange ( bool b)
Parameters
bIf true, changes in the job state will trigger a popup notification from the MoleQueue system tray icon. Default: false

◆ popupOnStateChange()

bool popupOnStateChange ( ) const
Returns
If true, changes in the job state will trigger a popup notification from the MoleQueue system tray icon. Default: false

◆ setNumberOfCores()

void setNumberOfCores ( int num)
Parameters
numThe total number of processor cores to use (if applicable). Default: 1

◆ numberOfCores()

int numberOfCores ( ) const
Returns
The total number of processor cores to use (if applicable). Default: 1

◆ setMaxWallTime()

void setMaxWallTime ( int minutes)
Parameters
minutesThe 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.

◆ maxWallTime()

int maxWallTime ( ) const
Returns
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.

◆ setMoleQueueId()

void setMoleQueueId ( IdType id)
Parameters
idThe new MoleQueue id for this job.
Warning
Do not call this function except in Server or Client as a response to the JobManager::jobAboutToBeAdded signal.

◆ moleQueueId()

IdType moleQueueId ( ) const
Returns
Internal MoleQueue identifier

◆ setQueueId()

void setQueueId ( IdType id)

Set the job's queue id. Calling this function will cause the.

Parameters
idQueue Job ID.

◆ queueId()

IdType queueId ( ) const
Returns
Queue Job ID

◆ setKeywords()

void setKeywords ( const QHash< QString, QString > & keyrep)
Parameters
keyrepThe keyword replacement hash for this job.

◆ keywords()

QHash< QString, QString > keywords ( ) const
Returns
The keyword replacement hash for this job.

◆ setKeywordReplacement()

void setKeywordReplacement ( const QString & keyword,
const QString & replacement )

Add a keyword / replacement pair for this job.

◆ hasKeywordReplacement()

bool hasKeywordReplacement ( const QString & keyword) const
Returns
True if the keyword has a replacement.

◆ lookupKeywordReplacement()

QString lookupKeywordReplacement ( const QString & keyword) const
Returns
The replacement string for the keyword.

◆ replaceKeywords()

void replaceKeywords ( QString & launchScript) const

Apply the replacements in the keywords() hash to the script.

Note
Do not call this directly, use Queue::replaceKeywords instead.

The documentation for this class was generated from the following file: