Loading...
Searching...
No Matches
BatchJob Class Reference

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

`#include <batchjob.h>`

Inheritance diagram for BatchJob:

## Public Types

enum | JobState { Rejected = -2 , Unknown = -1 , None = 0 , Accepted , QueuedLocal , Submitted , QueuedRemote , RunningLocal , RunningRemote , Finished , Canceled , Error }
using | BatchId = int
using | RequestId = int
using | ServerId = unsigned int

## Public Slots

virtual BatchId | submitNextJob (const Core::Molecule &mol)
bool | lookupJob (BatchId batchId)

## Signals

void | jobUpdated (Avogadro::MoleQueue::BatchJob::BatchId batchId, bool success)
void | jobCompleted (Avogadro::MoleQueue::BatchJob::BatchId batchId, Avogadro::MoleQueue::BatchJob::JobState status)

## Public Member Functions

| BatchJob (QObject *parent=nullptr)
| BatchJob (const QString &scriptFilePath, QObject *parent=nullptr)
QString | description () const
JobState | jobState (BatchId batchId) const
ServerId | serverId (BatchId batchId) const
JobObject | jobObject (BatchId batchId) const
bool | hasUnfinishedJobs () const
int | unfinishedJobCount () const
int | finishedJobCount () const
int | jobCount () const
void | setInputGeneratorOptions (const QJsonObject &opts)
QJsonObject | inputGeneratorOptions () const
void | setMoleQueueOptions (const QJsonObject &opts)
QJsonObject | moleQueueOptions () const
JobObject | moleQueueJobTemplate () const
const InputGenerator & | inputGenerator () const
InputGenerator & | inputGenerator ()

## Static Public Member Functions

static bool | isTerminal (JobState state)

## Static Public Attributes

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

## Member Typedef Documentation

## BatchId

using BatchId = int

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

## RequestId

using RequestId = int

Type used to identify requests sent to the MoleQueue server.

## ServerId

using ServerId = unsigned int

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

## Member Enumeration Documentation

## JobState

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.

## Constructor & Destructor Documentation

## BatchJob()

BatchJob | ( | QObject * | parent = nullptr | ) |

explicit

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

## Member Function Documentation

## setInputGeneratorOptions()

void setInputGeneratorOptions | ( | const QJsonObject & | opts | ) |

Options for the input generator.

## inputGeneratorOptions()

QJsonObject inputGeneratorOptions | ( |  | ) | const

Options for the input generator.

## setMoleQueueOptions()

void setMoleQueueOptions | ( | const QJsonObject & | opts | ) |

Options for MoleQueue.

## moleQueueOptions()

QJsonObject moleQueueOptions | ( |  | ) | const

Options for MoleQueue.

## moleQueueJobTemplate()

JobObject moleQueueJobTemplate | ( |  | ) | const

Options for MoleQueue.

## inputGenerator() [1/2]

const InputGenerator & inputGenerator | ( |  | ) | const

The internal InputGenerator.

## inputGenerator() [2/2]

InputGenerator & inputGenerator | ( |  | ) |

The internal InputGenerator.

## description()

QString description | ( |  | ) | const

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

## jobState()

BatchJob::JobState jobState | ( | BatchJob::BatchId | id | ) | const

Returns
  The state of the job with the batch id batchId.

## serverId()

BatchJob::ServerId serverId | ( | BatchJob::BatchId | id | ) | const

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

## jobObject()

JobObject jobObject | ( | BatchJob::BatchId | id | ) | const

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

## isTerminal()

bool isTerminal | ( | BatchJob::JobState | state | ) |

static

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

## hasUnfinishedJobs()

bool hasUnfinishedJobs | ( |  | ) | const

Returns
  True if there are still running jobs.

## unfinishedJobCount()

int unfinishedJobCount | ( |  | ) | const

Returns
  The number of jobs that are running.

## finishedJobCount()

int finishedJobCount | ( |  | ) | const

Returns
  The number of completed jobs.

## jobCount()

int jobCount | ( |  | ) | const

Returns
  The total number of jobs in the batch.

## submitNextJob

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

virtual slot

Submit a job using the current configuration for mol.

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

## lookupJob

bool lookupJob | ( | BatchId | batchId | ) |

slot

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.

## jobUpdated

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

signal

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).

## jobCompleted

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

signal

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.

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

- batchjob.h