Workspace 6.21.5
Public Types | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | List of all members
SchedulerController Class Reference

Schedules both the local and remote execution of workspaces. The SchedulerController manages the scheduling of workspaces. A workspace can be scheduled to run either locally or remotely. The SchedulerController determines the optimum number of jobs that can be run locally, once exceeded, any additional workspaces are then remoted (subject to the availability of remote workspace-servers and the suitability of the workspace to be scheduled). If a workspace fails to be executed remotely then the workspace is scheduled locally. Irrespective of the location of workspace execution the key workspace events i.e. Start/Stop execution and Start/Stop update are observed. Workspace events that occurr on a remote machine find their way back to the scheduler by way of network messages that are translated and re-emitted locally to provide the appearance of local execution. The SchedulerController also emits significant workspace and scheduler related events that can be observed in case additional notification and/or processing is required in response to these events.

#include <Workspace/DataExecution/Execution/schedulercontroller.h>

Inherits QObject.

Public Types

enum  TypeOfPriorityChange { Promote , Demote }
 
enum  TypeOfScheduler { ClientSideScheduler , ServerSideScheduler , WorkerScheduler }
 

Public Slots

void cleanup ()
 

Signals

void delayRequestSignal (QString)
 
void handleExecutionStateChangeSignal (bool)
 
void requestAbortRequest (QString, const CSIRO::DataExecution::AbortReason &reason)
 
void requestCompleted (QString)
 
void requestHasAbortedUpdating (QString, bool hasError)
 
void requestHasFailedToBeScheduled (QString)
 
void requestHasFinishedExecution (QString)
 
void requestHasFinishedUpdating (QString)
 
void requestHasStartedExecuting (QString)
 
void requestHasStartedUpdating (QString)
 
void requestProgressUpdate (QString uuid, int percentComplete)
 
void requestStartRequest (CSIRO::DataExecution::SchedulerRequest *)
 
void requestStopRequest (QString)
 
void retryDelayed ()
 
void started ()
 
void stopped ()
 
void stopping ()
 

Public Member Functions

void abortRequest (SchedulerRequest &, const AbortReason &)
 
void abortScheduleWorkAllocatedTo (AbstractScheduler &, const AbortReason &reason)
 
bool changePriorityOfDelayedRequest (const QString &uuid, TypeOfPriorityChange type)
 
void decreaseMaxWorkload ()
 
int getCountOfWork () const
 
int getCountOfWorkScheduled () const
 
int getCountOfWorkScheduledOn (AbstractScheduler &)
 
const SchedulerFeaturesgetFeatures () const
 
int getIdealWorkload ()
 
SchedulerFeatures getLocalOccupiedFeatures () const
 
int getMaxConcurrencyCount () const
 
SchedulerFeatures getOccupiedFeaturesOnScheduler (const AbstractScheduler &) const
 
bool getRemoteExecutionEnabled () const
 
SchedulerRequestgetRequest (QString uuid)
 
TypeOfScheduler getTypeOfScheduler () const
 
QFuture< ObjectDictionarygetWorkflowOutputs (QString uuid)
 
QFuture< ObjectDictionarygetWorkflowOutputs (QString uuid, const SchedulerFeatures &features)
 
void handleExecutionStateChange (bool running)
 
bool haveRequest (const QString &uuid) const
 
bool haveSchedulerWithFeatures (const SchedulerFeatures &) const
 
void increaseMaxWorkload ()
 
void initialise (TypeOfScheduler schedulerType)
 
void initialise (TypeOfScheduler schedulerType, const SchedulerSettings &settings)
 
bool isPauseDelayed () const
 
void logText (const Application::LogManager::MessageCategory &, const QString &)
 
void pauseDelayed ()
 
void removeScheduler (QString schedulerType)
 
void resumeDelayed ()
 
bool running () const
 
void schedule (SchedulerRequest &)
 
void setMaxConcurrencyCount (int concurrencyCount)
 
void setRemoteExecutionEnabled (bool enable)
 
void sortTaskIdsByDelayedRequest (QStringList &uuids) const
 
void start ()
 
void stop ()
 
void stop (QString uuid)
 

Static Public Member Functions

static SchedulerControllergetInstance ()
 
static QString getVersion ()
 

Static Public Attributes

static SchedulerFeature workspaceLocalFeature
 
static SchedulerFeature workspaceQueueFeature
 

Protected Member Functions

void doRequest (SchedulerRequest &)
 
void onRequestHasAbortedUpdating (QString, bool hasErrorSource)
 
void onRequestHasFailedToBeScheduled (QString)
 
void onRequestHasFinishedExecution (QString)
 
void onRequestHasFinishedUpdating (QString)
 
void onRequestHasStartedExecuting (QString)
 
void onRequestHasStartedUpdating (QString)
 
void onRequestProgressEvent (QString uuid, int percentComplete)
 
void reScheduleWorkAllocatedTo (AbstractScheduler &)
 

Member Enumeration Documentation

◆ TypeOfPriorityChange

Enumerator
Promote 
Demote 

◆ TypeOfScheduler

Enumerator
ClientSideScheduler 
ServerSideScheduler 
WorkerScheduler 

Member Function Documentation

◆ abortRequest()

void abortRequest ( SchedulerRequest request,
const AbortReason reason 
)

◆ abortScheduleWorkAllocatedTo()

void abortScheduleWorkAllocatedTo ( AbstractScheduler server,
const AbortReason reason 
)

Re-schedules all work scheduled to the server

◆ changePriorityOfDelayedRequest()

bool changePriorityOfDelayedRequest ( const QString &  uuid,
SchedulerController::TypeOfPriorityChange  type 
)

◆ cleanup

void cleanup ( )
slot

Cleanup the scheduler.

◆ decreaseMaxWorkload()

void decreaseMaxWorkload ( )

◆ delayRequestSignal

void delayRequestSignal ( QString  )
signal

◆ doRequest()

void doRequest ( SchedulerRequest request)
protected
Parameters
requestThe request to schedule for processing

Processes a SchedulerRequest.

See also
SchedulerRequest

◆ getCountOfWork()

int getCountOfWork ( ) const

◆ getCountOfWorkScheduled()

int getCountOfWorkScheduled ( ) const

◆ getCountOfWorkScheduledOn()

int getCountOfWorkScheduledOn ( AbstractScheduler server)

◆ getFeatures()

const SchedulerFeatures & getFeatures ( ) const

◆ getIdealWorkload()

int getIdealWorkload ( )

Returns the ideal number of tasks that can be executed in parallel.

Returns
The ideal task count.

◆ getInstance()

SchedulerController & getInstance ( )
static

Returns a reference to the singleton scheduler.

◆ getLocalOccupiedFeatures()

SchedulerFeatures getLocalOccupiedFeatures ( ) const

◆ getMaxConcurrencyCount()

int getMaxConcurrencyCount ( ) const
Returns
the maximum number of parallel jobs.

◆ getOccupiedFeaturesOnScheduler()

SchedulerFeatures getOccupiedFeaturesOnScheduler ( const AbstractScheduler scheduler) const

◆ getRemoteExecutionEnabled()

bool getRemoteExecutionEnabled ( ) const
Returns
true if remote execution is enabled.

◆ getRequest()

SchedulerRequest * getRequest ( QString  uuid)

◆ getTypeOfScheduler()

SchedulerController::TypeOfScheduler getTypeOfScheduler ( ) const

◆ getVersion()

QString getVersion ( )
static

Returns the version of the scheduler.

◆ getWorkflowOutputs() [1/2]

QFuture< ObjectDictionary > getWorkflowOutputs ( QString  uuid)

◆ getWorkflowOutputs() [2/2]

QFuture< ObjectDictionary > getWorkflowOutputs ( QString  uuid,
const SchedulerFeatures features 
)

◆ handleExecutionStateChange()

void handleExecutionStateChange ( bool  running)

◆ handleExecutionStateChangeSignal

void handleExecutionStateChangeSignal ( bool  )
signal

◆ haveRequest()

bool haveRequest ( const QString &  uuid) const

◆ haveSchedulerWithFeatures()

bool haveSchedulerWithFeatures ( const SchedulerFeatures features) const

◆ increaseMaxWorkload()

void increaseMaxWorkload ( )

◆ initialise() [1/2]

void initialise ( TypeOfScheduler  schedulerType)

◆ initialise() [2/2]

void initialise ( TypeOfScheduler  schedulerType,
const SchedulerSettings settings 
)

◆ isPauseDelayed()

bool isPauseDelayed ( ) const

◆ logText()

void logText ( const Application::LogManager::MessageCategory categorie,
const QString &  msg 
)

Logs text to the logger

◆ onRequestHasAbortedUpdating()

void onRequestHasAbortedUpdating ( QString  uuid,
bool  hasErrorSource 
)
protected

◆ onRequestHasFailedToBeScheduled()

void onRequestHasFailedToBeScheduled ( QString  uuid)
protected

◆ onRequestHasFinishedExecution()

void onRequestHasFinishedExecution ( QString  uuid)
protected

◆ onRequestHasFinishedUpdating()

void onRequestHasFinishedUpdating ( QString  uuid)
protected

◆ onRequestHasStartedExecuting()

void onRequestHasStartedExecuting ( QString  uuid)
protected

◆ onRequestHasStartedUpdating()

void onRequestHasStartedUpdating ( QString  uuid)
protected

◆ onRequestProgressEvent()

void onRequestProgressEvent ( QString  uuid,
int  percentComplete 
)
protected

◆ pauseDelayed()

void pauseDelayed ( )

◆ removeScheduler()

void removeScheduler ( QString  schedulerType)

Cleanup the scheduler.

◆ requestAbortRequest

void requestAbortRequest ( QString  ,
const CSIRO::DataExecution::AbortReason reason 
)
signal

◆ requestCompleted

void requestCompleted ( QString  )
signal

◆ requestHasAbortedUpdating

void requestHasAbortedUpdating ( QString  ,
bool  hasError 
)
signal

◆ requestHasFailedToBeScheduled

void requestHasFailedToBeScheduled ( QString  )
signal

◆ requestHasFinishedExecution

void requestHasFinishedExecution ( QString  )
signal

◆ requestHasFinishedUpdating

void requestHasFinishedUpdating ( QString  )
signal

◆ requestHasStartedExecuting

void requestHasStartedExecuting ( QString  )
signal

◆ requestHasStartedUpdating

void requestHasStartedUpdating ( QString  )
signal

◆ requestProgressUpdate

void requestProgressUpdate ( QString  uuid,
int  percentComplete 
)
signal

◆ requestStartRequest

void requestStartRequest ( CSIRO::DataExecution::SchedulerRequest )
signal

◆ requestStopRequest

void requestStopRequest ( QString  )
signal

◆ reScheduleWorkAllocatedTo()

void reScheduleWorkAllocatedTo ( AbstractScheduler server)
protected

Re-schedules all work scheduled to the server

◆ resumeDelayed()

void resumeDelayed ( )

◆ retryDelayed

void retryDelayed ( )
signal

◆ running()

bool running ( ) const

◆ schedule()

void schedule ( SchedulerRequest request)
Parameters
requestThe request to schedule for execution.

As scheduling can be a non-trivial operation, scheduling is performed in an asynchronous fashion to avoid blocking the calling thread. Therefore, the request to be scheduled should not be destroyed by the caller of this function.

◆ setMaxConcurrencyCount()

void setMaxConcurrencyCount ( int  concurrencyCount)

Sets the maximum number of workspaces that can be run in paralel. Providing a value that is <=0 will result in the scheduler determining the ideal thread count to use.

Parameters
concurrencyCountthe maximum number of concurrently running workspaces

◆ setRemoteExecutionEnabled()

void setRemoteExecutionEnabled ( bool  enable)

Enables / disables remote execution.

◆ sortTaskIdsByDelayedRequest()

void sortTaskIdsByDelayedRequest ( QStringList uuids) const

Sort the uuids by delayed request, for those not in the delayed request list put them in the begining and not change the order.

◆ start()

void start ( )

Starts the scheduler.

◆ started

void started ( )
signal

◆ stop() [1/2]

void stop ( )

Stops the scheduler.

◆ stop() [2/2]

void stop ( QString  uuid)

Schedules the stopping of a request. As stopping can be a non-trivial operation, stopping is performed in an asynchronous fashion to avoid blocking the "stopping" thread, as such, the request to be stopped should not be destroyed by the caller of this function.

◆ stopped

void stopped ( )
signal

◆ stopping

void stopping ( )
signal

Member Data Documentation

◆ workspaceLocalFeature

SchedulerFeature workspaceLocalFeature
static

◆ workspaceQueueFeature

SchedulerFeature workspaceQueueFeature
static