MeVisLab Scripting Reference
MLABJobSchedulerClient Class Reference

Inherits QObject.

Public Slots

bool checkJobScheduler ()
MLABClientJobcreateJob ()
QString defaultUserName () const
bool isConnected ()
QList< MLABClientJob * > queryJobs (const QVariantMap &properties=QVariantMap())
void setDefaultUserName (const QString &userName)


void connectionLost ()
void newJob (qlonglong jobID)

Detailed Description

A scripting extension offering access to the MeVisLab job scheduler service, which allows to execute batch jobs in the background even if MeVisLab is not running.

Create a new instance of this class with

client = MLAB.getScriptExtension("JobSchedulerClient")
Access to all global functions and objects of MLAB.
Definition: mlabGlobalScriptAccess.h:81
QObject * getScriptExtension(const QString &extension)
Returns access to the given script extension.

The actual JobScheduler is not started automatically. The JobScheduler can, e.g., be started from Python in MeVisLab like this:

from PythonQt import QtCore
executable = MLABFileManager.getExecutable("MeVisLabJobScheduler")
QtCore.QProcess.startDetached(executable, ["-exec"])
Global MLABFileManager object available in all scripts.
Definition: mlabScriptWrappers.h:248
QString getExecutable(const QString &name)
Returns the absolute path of the given executable (where name is given without debug and file extensi...

(this way the JobScheduler keeps running when MeVisLab is terminated).

In theory the JobScheduler could be also be installed as a service on Windows, but services on Windows don't have access to a GUI context, which would preclude the use of MeVisLab for batch jobs, which most users will find undesirable.

Member Function Documentation

◆ checkJobScheduler

bool MLABJobSchedulerClient::checkJobScheduler ( )

Check if the job scheduler is available,.

◆ connectionLost

void MLABJobSchedulerClient::connectionLost ( )

Emitted when the connection to the job scheduler is lost.

◆ createJob

MLABClientJob* MLABJobSchedulerClient::createJob ( )

Create a new job.

Configuration is done on the returned object.

◆ defaultUserName

QString MLABJobSchedulerClient::defaultUserName ( ) const

Get the user name that is set by default in all new jobs.

◆ isConnected

bool MLABJobSchedulerClient::isConnected ( )

Check if the client is currently connected to the job scheduler; checkJobScheduler() will automatically try to connect, but isConnected() will not.

◆ newJob

void MLABJobSchedulerClient::newJob ( qlonglong  jobID)

Emitted when a new job is submitted from any client (even this one).

◆ queryJobs

QList<MLABClientJob*> MLABJobSchedulerClient::queryJobs ( const QVariantMap &  properties = QVariantMap())

Retrieve list of jobs with given properties.

Typically one might query for jobs with a given "jobID", "status", "application", or "userName".

For "status" one can use one of the values "Waiting", "ReadyToRun", "Starting", "Running", "Finished", or "Failed".

If no properties are given, all registered jobs are returned, this includes finished jobs.

If more than one property is given, all properties must match.


jobs = client.queryJobs({"status": "Finished", "userName": "jdoe"})

◆ setDefaultUserName

void MLABJobSchedulerClient::setDefaultUserName ( const QString &  userName)

Set a new default user name.

This should identify the user that creates any new jobs.