Class Avogadro::MoleQueue::BatchJob#

class BatchJob : public QObject#

The BatchJob class manages a collection of jobs that are configured using the same InputGenerator and MoleQueue options. For use with InputGeneratorDialog::configureBatchJob(BatchJob&).

Unnamed Group

inline void setInputGeneratorOptions(const QJsonObject &opts)#

Options for the input generator.

inline QJsonObject inputGeneratorOptions() const#

Options for the input generator.

Unnamed Group

inline void setMoleQueueOptions(const QJsonObject &opts)#

Options for MoleQueue.

inline QJsonObject moleQueueOptions() const#

Options for MoleQueue.

inline JobObject moleQueueJobTemplate() const#

Options for MoleQueue.

Unnamed Group

inline const InputGenerator &inputGenerator() const#

The internal InputGenerator.

inline InputGenerator &inputGenerator()#

The internal InputGenerator.

Public Types

enum JobState#

Job status. Same as those defined in molequeueglobal.h. The ‘Rejected’ state is added to identify jobs that rejected by molequeue prior to having a MoleQueue id (ServerId) set.

Values:

enumerator Rejected#
enumerator Unknown#
enumerator None#
enumerator Accepted#
enumerator QueuedLocal#
enumerator Submitted#
enumerator QueuedRemote#
enumerator RunningLocal#
enumerator RunningRemote#
enumerator Finished#
enumerator Canceled#
enumerator Error#
typedef int BatchId#

Type used to identify a job within this batch. Unique to this object.

typedef int RequestId#

Type used to identify requests sent to the MoleQueue server.

typedef unsigned int ServerId#

Type used by MoleQueue to identify jobs. Unique across the connected MoleQueue server.

Public Functions

explicit BatchJob(QObject *parent = nullptr)#

Construct a new BatchJob object. If provided, ese scriptFilePath to setup the input generator.

explicit BatchJob(const QString &scriptFilePath, QObject *parent = nullptr)#
~BatchJob() override#
inline QString description() const#

A string that will be used in the MoleQueue interface to identify this batch job. Taken from the InputGenerator configured title.

inline JobState jobState(BatchId batchId) const#
Returns:

The state of the job with the batch id batchId.

inline ServerId serverId(BatchId batchId) const#
Returns:

The server id of the job with the batch id batchId.

inline JobObject jobObject(BatchId batchId) const#
Returns:

The most recent JobObject for the job with the batch id batchId. These are updated for each change in job state.

inline bool hasUnfinishedJobs() const#
Returns:

True if there are still running jobs.

inline int unfinishedJobCount() const#
Returns:

The number of jobs that are running.

inline int finishedJobCount() const#
Returns:

The number of completed jobs.

inline int jobCount() const#
Returns:

The total number of jobs in the batch.

Public Slots

virtual BatchId submitNextJob(const Core::Molecule &mol)#

Submit a job using the current configuration for mol.

Returns:

The BatchId of the job, or InvalidBatchId if there was an error.

bool lookupJob(BatchId batchId)#

Request updated job details from the MoleQueue server for the job with the batch id batchId.

jobUpdated is emitted when the request is complete.

Returns:

True if the request is sent.

Signals

void jobUpdated(Avogadro::MoleQueue::BatchJob::BatchId batchId, bool success)#

Emitted when the reply from lookupJob is received. success will be false if MoleQueue sends an error response (likely because the job was removed from the job manager).

void jobCompleted(Avogadro::MoleQueue::BatchJob::BatchId batchId, Avogadro::MoleQueue::BatchJob::JobState status)#

Emitted when the job associated with batchId completes. status is the final state of the jobs and can be used to determine whether or not the job finished successfully.

Public Static Functions

static inline bool isTerminal(JobState state)#
Returns:

True if state corresponds to a job that is finished running.

Public Static Attributes

static const BatchId InvalidBatchId#
static const RequestId InvalidRequestId#
static const ServerId InvalidServerId#