AvogadroLibs  1.96.0
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
JobObject Class Reference

Simple client-side representation for a MoleQueue job. More...

#include <molequeue/client/jobobject.h>

Public Member Functions

void setValue (const QString &key, const QVariant &value)
 
QVariant value (const QString &key, const QVariant &defaultValue=QVariant()) const
 
void fromJson (const QJsonObject &jsonObject)
 
QJsonObject json () const
 
void setQueue (const QString &queueName)
 
QString queue () const
 
void setProgram (const QString &programName)
 
QString program () const
 
void setDescription (const QString &descriptionText)
 
QString description () const
 
void setInputFile (const QString &fileName, const QString &contents)
 Set the input file for the job. More...
 
void setInputFile (const QString &path)
 
void setInputFile (const QJsonObject &file)
 
QJsonObject inputFile () const
 
void appendAdditionalInputFile (const QString &fileName, const QString &contents)
 
void appendAdditionalInputFile (const QString &path)
 
void setAdditionalInputFiles (const QJsonArray &files)
 
void clearAdditionalInputFiles ()
 
QJsonArray additionalInputFiles () const
 

Protected Member Functions

QJsonObject fileSpec (const QString &fileName, const QString &contents)
 
QJsonObject fileSpec (const QString &path)
 

Protected Attributes

QJsonObject m_value
 

Detailed Description

Author
Marcus D. Hanwell

The Job class provides a simple interface to the client side representation of a job to be submitted to MoleQueue. Any fields that are not set/present will be omitted entirely, or set to default values by MoleQueue. The internal representation of a job (and the transport used) is JSON.

The Job class and data structure is very lightweight, and designed to be easily copied, modified and passed around.

Member Function Documentation

◆ setValue()

void setValue ( const QString &  key,
const QVariant &  value 
)

Set the value of the specified key.

◆ value()

QVariant value ( const QString &  key,
const QVariant &  defaultValue = QVariant() 
) const

Get the value of the specified key. If the key is not set, return defaultValue.

◆ fromJson()

void fromJson ( const QJsonObject &  jsonObject)

Set the job up using the supplied JSON object. This replaces all previous settings that may have been applied.

◆ json()

QJsonObject json ( ) const

Get the JSON object with the current job settings in it.

◆ setQueue()

void setQueue ( const QString &  queueName)

Set the queue that the job should be submitted to. This must be a valid queue name discovered using the client API.

◆ queue()

QString queue ( ) const

Get the name of the queue that the job will be submitted to. An empty string means that no queue has been set.

◆ setProgram()

void setProgram ( const QString &  programName)

Set the program that the job should be submitted to. This must be a valid program in a valid queue as discovered using the client API.

◆ program()

QString program ( ) const

Get the name of the program that the job will be submitted to. An empty string means that no program has been set.

◆ setDescription()

void setDescription ( const QString &  descriptionText)

Set the description of the job, this is free text.

◆ description()

QString description ( ) const

Get the description of the job.

◆ setInputFile() [1/3]

void setInputFile ( const QString &  fileName,
const QString &  contents 
)
Parameters
fileNameThe file name as it will appear in the working directory.
contentsThe contents of the file specified.

◆ setInputFile() [2/3]

void setInputFile ( const QString &  path)

Set the input file for the job, the file will be copied and the file name used in the working directory of the job submission.

Parameters
pathThe full path to the input file.

◆ setInputFile() [3/3]

void setInputFile ( const QJsonObject &  file)

Set the input file using a JSON object. This must conform to the file specification.

Parameters
fileA JSON object employing file specification to specify input.

◆ inputFile()

QJsonObject inputFile ( ) const

Get the input file for the job. This is a JSON object using the file spec.

◆ appendAdditionalInputFile() [1/2]

void appendAdditionalInputFile ( const QString &  fileName,
const QString &  contents 
)

Append an additional input file for the job.

Parameters
fileNameThe file name as it will appear in the working directory.
contentsThe contents of the file specified.

◆ appendAdditionalInputFile() [2/2]

void appendAdditionalInputFile ( const QString &  path)

Append an additional input file for the job, the file will be copied and the file name used in the working directory of the job submission.

Parameters
pathThe full path to the input file.

◆ setAdditionalInputFiles()

void setAdditionalInputFiles ( const QJsonArray &  files)

Set the additional input file using a JSON object. This must conform to the file specification.

Parameters
filesA JSON array employing file specification to specify input.

◆ clearAdditionalInputFiles()

void clearAdditionalInputFiles ( )

Clear additional input files.

◆ additionalInputFiles()

QJsonArray additionalInputFiles ( ) const

Get the additional input files for the job. This is a JSON object using the file spec.

◆ fileSpec() [1/2]

QJsonObject fileSpec ( const QString &  fileName,
const QString &  contents 
)
protected

Generate a filespec JSON object form the supplied file name and contents.

◆ fileSpec() [2/2]

QJsonObject fileSpec ( const QString &  path)
protected

Generate a filespec JSON object form the supplied file path (must exist).


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