TaskHandler¶
- class TaskKit.TaskHandler.TaskHandler(scheduler, start, period, task, name)¶
Bases:
object
The task handler.
While the Task class only knows what task to perform with the run()-method, the TaskHandler has all the knowledge about the periodicity of the task. Instances of this class are managed by the Scheduler in the scheduled, running and onDemand dictionaries.
- __init__(scheduler, start, period, task, name)¶
- disable()¶
Disable future invocations of this task.
- enable()¶
Enable future invocations of this task.
- isOnDemand()¶
Return True if this task is not scheduled for periodic execution.
- isRunning()¶
- name()¶
- notifyCompletion()¶
- notifyFailure()¶
- period()¶
Return the period of this task.
- reschedule()¶
Determine whether this task should be rescheduled.
Increments the startTime and returns true if this is a periodically executed task.
- reset(start, period, task, reRegister)¶
- runAgain()¶
Determine whether this task should be run again.
This method lets the Scheduler check to see whether this task should be re-run when it terminates.
- runOnCompletion()¶
Request that this task be re-run after its current completion.
Intended for on-demand tasks that are requested by the Scheduler while they are already running.
- runTask()¶
Run this task in a background thread.
- setOnDemand(onDemand=True)¶
- setPeriod(period)¶
Change the period for this task.
- startTime(newTime=None)¶
- stop()¶
- unregister()¶
Request that this task not be kept after its current completion.
Used to remove a task from the scheduler.