QExecutor
@quik/scheduler / QExecutor
Class: QExecutor
Defined in: scheduler/src/QExecutor.ts:52
Default in-memory task scheduler executor.
Extends
QObject
Implements
Constructors
Constructor
new QExecutor():
QExecutor
Defined in: scheduler/src/QExecutor.ts:54
Create a new executor instance.
Returns
QExecutor
Overrides
QObject.constructor
Properties
_lastRunStart
protected_lastRunStart:Map<string,DateTime<boolean>>
Defined in: scheduler/src/QExecutor.ts:63
_runningTasks
protected_runningTasks:Map<string,number>
Defined in: scheduler/src/QExecutor.ts:62
_scheduledJobs
protected_scheduledJobs:Map<string,ScheduledTask>
Defined in: scheduler/src/QExecutor.ts:64
_tasks
protected_tasks:QTask[] =[]
Defined in: scheduler/src/QExecutor.ts:61
Internal list of task instances registered with the executor.
Accessors
logger
Get Signature
get
protectedlogger():IQLogger
Defined in: core/src/QObject.ts:15
The logger getter for the object.
Returns
IQLogger
Inherited from
QObject.logger
name
Get Signature
get name():
string
Defined in: core/src/QObject.ts:8
Returns
string
Inherited from
QObject.name
tasks
Get Signature
get tasks():
QTask[]
Defined in: scheduler/src/QExecutor.ts:69
Retrieve registered task instances.
Returns
QTask[]
Array of registered tasks managed by this executor. Contains all scheduled tasks regardless of their state.
Implementation of
Methods
afterExecute()
protectedafterExecute(taskExecution,isSuccessfulRun,err?):Promise<void>
Defined in: scheduler/src/QExecutor.ts:220
Hook executed after a task run.
Parameters
taskExecution
Execution context for the task.
isSuccessfulRun
boolean
Indicates if the task was executed without error.
err?
QError
Optional error thrown during execution.
Returns
Promise<void>
beforeExecute()
protectedbeforeExecute(taskExecution):Promise<void>
Defined in: scheduler/src/QExecutor.ts:229
Hook executed before a task run.
Parameters
taskExecution
Execution context for the task.
Returns
Promise<void>
cleanup()
cleanup():
void
Defined in: scheduler/src/QExecutor.ts:73
Cleanup the executors.
Returns
void
Implementation of
endSpan()
protectedendSpan(span):void
Defined in: core/src/QObject.ts:35
End a span returned by startSpan.
Parameters
span
TelemetrySpan
The span to end.
Returns
void
Inherited from
QObject.endSpan
execute()
protectedexecute(task):Promise<void>
Defined in: scheduler/src/QExecutor.ts:147
Execute a single task instance.
Parameters
task
Task instance to run.
Returns
Promise<void>
getDays()
protectedgetDays(days,months?):string
Defined in: scheduler/src/QExecutor.ts:313
Convert day values to a cron expression segment.
Parameters
days
Day values.
months?
Optional months context used for validation.
Returns
string
getExecutionPlan()
protectedgetExecutionPlan(executionPlan):string
Defined in: scheduler/src/QExecutor.ts:238
Build a cron expression from an execution plan definition.
Parameters
executionPlan
string | IQExecutionPlan
Execution plan object or cron string.
Returns
string
getHours()
protectedgetHours(hours):string
Defined in: scheduler/src/QExecutor.ts:354
Convert hour values to a cron expression segment.
Parameters
hours
Hour values.
Returns
string
getMaxConcurrency()
protectedgetMaxConcurrency():number
Defined in: scheduler/src/QExecutor.ts:208
Maximum number of concurrent task executions allowed.
Returns
number
getMinutes()
protectedgetMinutes(minutes):string
Defined in: scheduler/src/QExecutor.ts:374
Convert minute values to a cron expression segment.
Parameters
minutes
Minute values.
Returns
string
getMonths()
protectedgetMonths(months):string
Defined in: scheduler/src/QExecutor.ts:292
Convert month values to a cron expression segment.
Parameters
months
Month values.
Returns
string
getWeekDay()
protectedgetWeekDay(weekDays):string
Defined in: scheduler/src/QExecutor.ts:394
Convert weekday values to a cron expression segment.
Parameters
weekDays
Weekday values.
Returns
string
pause()
pause(
taskName):void
Defined in: scheduler/src/QExecutor.ts:117
Pause a single scheduled task without stopping the rest of the scheduler. A paused task can be resumed with resume.
Parameters
taskName
string
Name of the task to pause.
Returns
void
recordSpanError()
protectedrecordSpanError(span,err):void
Defined in: core/src/QObject.ts:45
Record an exception on an active span.
Parameters
span
TelemetrySpan
The span to record the error on.
err
unknown
The error to record.
Returns
void
Inherited from
QObject.recordSpanError
register()
register(...
tasks):void
Defined in: scheduler/src/QExecutor.ts:83
Register one or more tasks to be executed.
Parameters
tasks
...Constructor<QTask>[]
Task constructors to register.
Returns
void
Implementation of
resume()
resume(
taskName):void
Defined in: scheduler/src/QExecutor.ts:132
Resume a previously paused task.
Parameters
taskName
string
Name of the task to resume.
Returns
void
setSpanAttribute()
protectedsetSpanAttribute(span,key,value):void
Defined in: core/src/QObject.ts:64
Set a single attribute on an active span.
Parameters
span
TelemetrySpan
The span to update.
key
string
Attribute key.
value
string | number | boolean
Attribute value.
Returns
void
Inherited from
QObject.setSpanAttribute
start()
start():
Promise<void>
Defined in: scheduler/src/QExecutor.ts:88
Start the scheduler.
Returns
Promise<void>
Implementation of
startSpan()
protectedstartSpan(spanName,options?):TelemetrySpan
Defined in: core/src/QObject.ts:26
Start a telemetry span for the given operation name. Returns undefined when no telemetry provider is active.
Parameters
spanName
string
Name of the span.
options?
TelemetrySpanOptions
Optional span attributes and kind.
Returns
TelemetrySpan
Inherited from
QObject.startSpan
stop()
stop():
Promise<void>
Defined in: scheduler/src/QExecutor.ts:103
Stop all scheduled tasks.
Returns
Promise<void>
Implementation of
toSet()
protectedtoSet(item):Set<number> |"*"
Defined in: scheduler/src/QExecutor.ts:267
Normalise an execution plan field to a Set.
Parameters
item
Numeric value, array, set or *.
Returns
Set<number> | "*"
A set, *, or undefined when no value is provided.
transfer()
transfer(
originalExecutor):void
Defined in: scheduler/src/QExecutor.ts:78
Transfer state from another executor instance.
Parameters
originalExecutor
QExecutor
Executor to copy tasks from.
Returns
void