schedule()
Schedule a task for later execution.
Usage
schedule(
task,
delay=0.0,
)Registers the given task identifier to be executed after the specified delay. Returns whether the scheduling was successful.
Note
Tasks are identified by their string name. Scheduling the same task twice will return False the second time.
Examples
>>> schedule(“cleanup”) True
>>> schedule(“backup”, delay=60.0) True
>>> schedule(“cleanup”) FalseParameters
task: str-
The task identifier string to schedule.
delay: float = 0.0-
Number of seconds to wait before executing. Must be non-negative. Defaults to
0.0.
Returns
bool-
True if the task was successfully scheduled, False if the task is already scheduled.
Raises
ValueError-
If
delayis negative. TypeError-
If
taskis not a string.