MoleQueue  0.8.0
 All Classes Functions Variables Enumerations Enumerator Pages
Signals | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
JobManager Class Reference

#include <molequeue/jobmanager.h>

Inheritance diagram for JobManager:

Public Slots

Job Modification

Methods to change properties of jobs.

void setJobState (MoleQueue::IdType jobManagerId, MoleQueue::JobState newState)
 
void setJobQueueId (MoleQueue::IdType jobManagerIdId, MoleQueue::IdType queueId)
 

Signals

void jobAboutToBeAdded (MoleQueue::Job job)
 
void jobAdded (const MoleQueue::Job &job)
 
void jobStateChanged (const MoleQueue::Job &job, MoleQueue::JobState oldState, MoleQueue::JobState newState)
 
void jobUpdated (const MoleQueue::Job &job)
 
void jobAboutToBeRemoved (const MoleQueue::Job &job)
 
void jobRemoved (MoleQueue::IdType moleQueueId)
 

Public Member Functions

 JobManager (QObject *parentObject=0)
 
void loadJobState (const QString &path)
 
void syncJobState () const
 

Protected Member Functions

JobDatalookupJobDataByMoleQueueId (IdType moleQueueId) const
 
bool hasJobData (const JobData *data) const
 
void insertJobData (JobData *jobdata)
 

Protected Attributes

QList< JobData * > m_jobs
 
JobItemModelm_itemModel
 
QMap< IdType, JobData * > m_moleQueueMap
 

Job Management

Functions to add, remove, or locate jobs.

Job newJob ()
 
Job newJob (const QJsonObject &jobState)
 
void removeJob (JobData *jobdata)
 
void removeJob (IdType moleQueueId)
 
void removeJob (const Job &job)
 
void removeJobs (const QList< Job > &jobsToRemove)
 
void removeJobs (const QList< IdType > &moleQueueIds)
 
Job lookupJobByMoleQueueId (IdType moleQueueId) const
 
QList< JobjobsWithJobState (MoleQueue::JobState state)
 
int count () const
 
Job jobAt (int i) const
 
int indexOf (const Job &job) const
 
JobItemModelitemModel () const
 
void moleQueueIdChanged (const MoleQueue::Job &job)
 

Detailed Description

Owns and manages JobData objects.

Author
David C. Lonie

The JobManager class owns all JobData objects. At least two JobManager objects exist during normal operation; the Client class holds a JobManager to track all jobs belonging to that client, and the Server class of the MoleQueue server holds a JobManager to track all jobs that it is managing.

Member Function Documentation

void loadJobState ( const QString &  path)

Locate jobs from the subdirectories in path. This function will look in all immediate subdirectories of path and load mqjobinfo.json files with JobData::load().

void syncJobState ( ) const

Sync all job state with disk.

Job newJob ( )
Returns
Insert a new JobData object into the JobManager's jobMap. The JobData is set to default values and a Job reference to it is returned.
Job newJob ( const QJsonObject &  jobState)
Parameters
jobStateA QJsonObject describing the state of the new Job.
Returns
A new Job object, initialized to the state in jobState.
See Also
Job::toJsonObject() Job::setFromJson()
void removeJob ( JobData jobdata)

Remove the specified jobdata from this manager and delete it. All Job objects with job's MoleQueue id will be invalidated.

void removeJob ( IdType  moleQueueId)

Remove the job with the specified moleQueueId from this manager and delete it.

void removeJob ( const Job job)

Remove the specified job from this manager and delete it. All Job objects with job's MoleQueue id will be invalidated.

void removeJobs ( const QList< Job > &  jobsToRemove)

Remove the specified jobs from this manager and delete them.

void removeJobs ( const QList< IdType > &  moleQueueIds)

Remove the jobs with the specified moleQueueIds from this manager and delete them.

Job lookupJobByMoleQueueId ( IdType  moleQueueId) const
Parameters
moleQueueIdThe MoleQueue Id of the requested Job.
Returns
The Job with the requested MoleQueue Id.
Note
If no such Job exists, Job::isValid() will return false;
QList<Job> jobsWithJobState ( MoleQueue::JobState  state)

Return a list of Job objects that have JobState state.

Parameters
stateJobState of interests
Returns
List of Job objects with JobState state
int count ( ) const
Returns
Number of Job objects held by this manager.
Job jobAt ( int  i) const

Index based job look up. Use with count() to iterate over all Jobs in the manager. Jobs are not sorted in any particular order.

Returns
The job with index i
int indexOf ( const Job job) const

Lookup iteratible index of Job &job. Compatible with count() and jobAt().

Returns
index of job, or -1 if job is invalid.
JobItemModel* itemModel ( ) const
Returns
the JobItemModel for this JobManager.
void moleQueueIdChanged ( const MoleQueue::Job job)
slot

Inform the QueueManager that the MoleQueue id of job has changed so that it may update its internal lookup tables.

Parameters
jobThe Job object.
void setJobState ( MoleQueue::IdType  jobManagerId,
MoleQueue::JobState  newState 
)
slot

Set the JobState for the job with the specified MoleQueue id

void setJobQueueId ( MoleQueue::IdType  jobManagerIdId,
MoleQueue::IdType  queueId 
)
slot

Set the QueueId for the job with the specified MoleQueue id

void jobAboutToBeAdded ( MoleQueue::Job  job)
signal

Emitted when a job is about to be inserted. Client and MainWindow should directly connect slots to this signal which will set the molequeue id and local working directory.

void jobAdded ( const MoleQueue::Job job)
signal

Emitted when a Job has been added to this JobManager.

Parameters
jobThe new Job object.
void jobStateChanged ( const MoleQueue::Job job,
MoleQueue::JobState  oldState,
MoleQueue::JobState  newState 
)
signal

Emitted when a Job changes JobState.

Parameters
jobJob object
oldStatePrevious state of job
newStateNew state of job
void jobUpdated ( const MoleQueue::Job job)
signal

Emitted when a Job's state changes.

Parameters
job
queueId
void jobAboutToBeRemoved ( const MoleQueue::Job job)
signal

Emitted when the job is about to be removed and deleted.

void jobRemoved ( MoleQueue::IdType  moleQueueId)
signal

Emitted when the job with the specified moleQueueId has been removed and deleted.

JobData* lookupJobDataByMoleQueueId ( IdType  moleQueueId) const
protected
Returns
The JobData with moleQueueId
bool hasJobData ( const JobData data) const
protected
Returns
Whether the address data is stored in m_jobs.
void insertJobData ( JobData jobdata)
protected
Parameters
jobdataJob to insert into the internal lookup structures.

Member Data Documentation

QList<JobData*> m_jobs
protected

"Master" list of JobData

JobItemModel* m_itemModel
protected

Item model for interacting with jobs.

QMap<IdType, JobData*> m_moleQueueMap
protected

Lookup table for MoleQueue ids.


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