MeVisLab Scripting Reference
MLABClientJob Class Reference

#include <mlabClientJob.h>

Inherits QObject.

Public Types

enum  QoSClass { QoSBackground , QoSDefault , QoSUserInitiated }
 

Public Slots

QString applicationName () const
 
void cancel ()
 
QVariantMap executionEnvironment () const
 
QList< MLABClientExecutionRecord * > executionLog () const
 
int executionTimeoutInSeconds () const
 
QString jobDescription () const
 
qlonglong jobID () const
 
double progress () const
 
QString progressMessagePattern () const
 
QoSClass qualityOfService () const
 
void setApplicationName (const QString &name)
 
void setEnvironmentVariable (const QString &varName, const QString &value)
 
void setExecutionEnvironment (const QVariantMap &env)
 
void setExecutionTimeoutInSeconds (int seconds)
 
void setJobDescription (const QString &descr)
 
void setProgressMessagePattern (const QString &pattern)
 
void setQualityOfService (QoSClass qos)
 
void setUserData (const QVariantMap &data)
 
void setUserName (const QString &name)
 
void setWeight (double weight)
 
void setWorkingDirectory (const QString &dir)
 
QString status () const
 
qlonglong submit ()
 
QVariantMap userData () const
 
QString userName () const
 
double weight () const
 
QString workingDirectory () const
 
Specifying the job to execute

Note that runMacro, runPythonScript, and setCommandLine are mutually exclusive (or rather will overwrite each other).

void runMacro (const QString &macroName, const QStringList &args=QStringList(), QoSClass qos=QoSDefault)
 
void runMacro (const QString &macroName, QoSClass qos)
 
void runPythonScript (const QString &fileName, const QStringList &arguments=QStringList(), QoSClass qos=QoSDefault)
 
void runPythonScript (const QString &fileName, QoSClass qos)
 
void setCommandLine (const QString &executable, const QStringList &arguments)
 
void setCommandLineExecutable (const QString &exe)
 
QString commandLineExecutable () const
 
void setCommandLineArguments (const QStringList &args)
 
QStringList commandLineArguments () const
 
Methods for conditional execution.

There can only ever be at most one condition for a job.

MLABClientJobConditioncondition () const
 
MLABClientJobConditionsetWatchCondition (const QString &watchedDirectory, int coolDownTimeInSeconds)
 
MLABClientJobConditionsetDelayedCondition (int intervalInSeconds)
 
MLABClientJobConditionsetChainCondition (const QVariantList &jobIDs, const QVariantList &softJobIDs=QVariantList())
 
void unsetCondition ()
 

Signals

void jobRemoved ()
 
void propertyChanged (const QString &propertyName)
 

Detailed Description

A wrapper for command-line batch jobs managed by the MeVisLabJobScheduler.

Created or obtained from a MLABJobSchedulerClient

Note
Most properties can only be changed on a new job before submit() is called.

Member Enumeration Documentation

◆ QoSClass

The Quality of service (QoS) class categorizes work to be performed.

Enumerator
QoSBackground 

The background quality of service class. These jobs are only executed if there are no other jobs "ReadyToRun".

QoSDefault 

The default quality of service class. These jobs are executed before jobs with the QoSBackground value.

QoSUserInitiated 

The user-initiated quality of service class. These jobs are executed before jobs with other QoS values.

Member Function Documentation

◆ applicationName

QString MLABClientJob::applicationName ( ) const
inlineslot

Get the application name which scheduled this job.

◆ cancel

void MLABClientJob::cancel ( )
slot

Cancel a job.

This also removes the job from the job database permanently, even if it was already finished.

◆ commandLineArguments

QStringList MLABClientJob::commandLineArguments ( ) const
inlineslot

Get the command line arguments of this job.

◆ commandLineExecutable

QString MLABClientJob::commandLineExecutable ( ) const
inlineslot

Get the command line executable for this job.

◆ condition

MLABClientJobCondition * MLABClientJob::condition ( ) const
inlineslot

Get condition that must be fulfilled for execution (if any)

◆ executionEnvironment

QVariantMap MLABClientJob::executionEnvironment ( ) const
inlineslot

Get the set of extra environment variables for the execution of this job.

◆ executionLog

QList< MLABClientExecutionRecord * > MLABClientJob::executionLog ( ) const
inlineslot

Get the list of execution records (start time, end time, exit code, log file name) of a job.

The list may contain more than one entry if the job has been run multiple times. (see MLABClientJobCondition::setRepeating)

◆ executionTimeoutInSeconds

int MLABClientJob::executionTimeoutInSeconds ( ) const
inlineslot

Get the execution timeout.

◆ jobDescription

QString MLABClientJob::jobDescription ( ) const
inlineslot

Get job description.

◆ jobID

qlonglong MLABClientJob::jobID ( ) const
inlineslot

Get ID of job (only after schedule() has been called)

◆ jobRemoved

void MLABClientJob::jobRemoved ( )
signal

This signal is emitted if the job itself has been removed.

You should not expect any meaningful changes to this job afterwards.

◆ progress

double MLABClientJob::progress ( ) const
inlineslot

Get current progress of job.

This may require to set the progressMessagePattern() to correctly extract the progress value from the executable's output.

◆ progressMessagePattern

QString MLABClientJob::progressMessagePattern ( ) const
inlineslot

Get the progress message RegEx pattern.

◆ propertyChanged

void MLABClientJob::propertyChanged ( const QString & propertyName)
signal

This signal is emitted if any property of the job changes while watched.

The most important property changes are "status" and "progress".

◆ qualityOfService

QoSClass MLABClientJob::qualityOfService ( ) const
inlineslot

Get Quality of service (QoS) class for this job.

◆ runMacro [1/2]

void MLABClientJob::runMacro ( const QString & macroName,
const QStringList & args = QStringList(),
QoSClass qos = QoSDefault )
slot

Set up the batch job to run the MeVisLab macro module with the settings of the current MeVisLab instance.

Referenced by runMacro().

◆ runMacro [2/2]

void MLABClientJob::runMacro ( const QString & macroName,
QoSClass qos )
inlineslot

Same as above, but without an argument list.

References runMacro().

◆ runPythonScript [1/2]

void MLABClientJob::runPythonScript ( const QString & fileName,
const QStringList & arguments = QStringList(),
QoSClass qos = QoSDefault )
slot

Run a Python script with the MeVisPython python interpreter.

Note that this is pure Python and the packages and objects provided by MeVisLab are not available.

Referenced by runPythonScript().

◆ runPythonScript [2/2]

void MLABClientJob::runPythonScript ( const QString & fileName,
QoSClass qos )
inlineslot

Same as above, but without an argument list.

References runPythonScript().

◆ setApplicationName

void MLABClientJob::setApplicationName ( const QString & name)
inlineslot

Set the application name which schedules this job.

◆ setChainCondition

MLABClientJobCondition * MLABClientJob::setChainCondition ( const QVariantList & jobIDs,
const QVariantList & softJobIDs = QVariantList() )
slot

Set a chain condition: The job is executed after the jobs with the given IDs have been executed successfully.

The optional second argument lists jobs this jobs only waits for; these jobs have to run, but not successfully.

◆ setCommandLine

void MLABClientJob::setCommandLine ( const QString & executable,
const QStringList & arguments )
slot

Set the command line to execute for this job.

◆ setCommandLineArguments

void MLABClientJob::setCommandLineArguments ( const QStringList & args)
inlineslot

Set the command line arguments for this job.

◆ setCommandLineExecutable

void MLABClientJob::setCommandLineExecutable ( const QString & exe)
inlineslot

Set the command line executable to execute for this job.

◆ setDelayedCondition

MLABClientJobCondition * MLABClientJob::setDelayedCondition ( int intervalInSeconds)
slot

Set a delay condition: The job is executed after the given number of seconds.

◆ setEnvironmentVariable

void MLABClientJob::setEnvironmentVariable ( const QString & varName,
const QString & value )
slot

Set a single environment variable for the execution of this job.

◆ setExecutionEnvironment

void MLABClientJob::setExecutionEnvironment ( const QVariantMap & env)
inlineslot

Set a set of extra environment variables (as a dictionary) for the execution of this job.

◆ setExecutionTimeoutInSeconds

void MLABClientJob::setExecutionTimeoutInSeconds ( int seconds)
inlineslot

Set an execution timeout in seconds for this job.

If the job takes longer to execute, it will be considered as failed and killed.

◆ setJobDescription

void MLABClientJob::setJobDescription ( const QString & descr)
inlineslot

Set a job description.

◆ setProgressMessagePattern

void MLABClientJob::setProgressMessagePattern ( const QString & pattern)
inlineslot

Set a progress message RegEx pattern, that will be used to parse output from the execution for a progress value.

The pattern must match a whole line, and the first sub-expression in braces must match a (float) number between 0 and 100.

◆ setQualityOfService

void MLABClientJob::setQualityOfService ( QoSClass qos)
inlineslot

Set Quality of service (QoS) class for this job.

By specifying the quality of a job, you indicate its importance to your app. When scheduling jobs, the scheduler prioritizes those that have higher service classes.

◆ setUserData

void MLABClientJob::setUserData ( const QVariantMap & data)
inlineslot

Set arbitrary user data (a dictionary) to associate with this job.

◆ setUserName

void MLABClientJob::setUserName ( const QString & name)
inlineslot

Set the user for which this job is scheduled.

◆ setWatchCondition

MLABClientJobCondition * MLABClientJob::setWatchCondition ( const QString & watchedDirectory,
int coolDownTimeInSeconds )
slot

Set a watch condition: The job is executed when a change occurs in the given directory, but only the given number of seconds after the last change.

◆ setWeight

void MLABClientJob::setWeight ( double weight)
slot

Set execution "weight" of job, that is, how taxing for the system the job is in relation to others.

The default value is 1.

This value is used to decide how many jobs can run in parallel, and is compared against an abstract execution "budget".

◆ setWorkingDirectory

void MLABClientJob::setWorkingDirectory ( const QString & dir)
inlineslot

Set the working directory to use for the execution of this job.

◆ status

QString MLABClientJob::status ( ) const
inlineslot

Get current status of job.

This can be one of "Waiting", "ReadyToRun", "Starting", "Running", "Finished", or "Failed".

◆ submit

qlonglong MLABClientJob::submit ( )
slot

Submit the new job for scheduling.

Returns the newly assigned job ID.

◆ unsetCondition

void MLABClientJob::unsetCondition ( )
slot

Unset the previously set condition.

◆ userData

QVariantMap MLABClientJob::userData ( ) const
inlineslot

Get user data for this job.

◆ userName

QString MLABClientJob::userName ( ) const
inlineslot

Get the user for which this job was scheduled.

◆ weight

double MLABClientJob::weight ( ) const
inlineslot

Get execution weight of this job.

◆ workingDirectory

QString MLABClientJob::workingDirectory ( ) const
inlineslot

Get the working directory for the execution of this job.