• Home
  • API Documentation
  • wte.scripts.timed_tasks – Script to run timed tasks

wte.scripts.timed_tasks – Script to run timed tasks¶

The timed_tasks module provides the functionality for running TimedTask. Only a single instance of it should ever be run as otherwise it is possible that tasks are run multiple times.

wte.scripts.timed_tasks.init(subparsers)[source]¶

Initialises the ArgumentParser, adding the “run-timed-tasks” command that runs run_timed_tasks().

wte.scripts.timed_tasks.run_change_status(task_id)[source]¶

Run the status change task for the TimedTask with the id task_id. It changes the TimedTasks status to the value of the “target_status” key in the options.

wte.scripts.timed_tasks.run_timed_tasks(args)[source]¶

Runs all timed tasks where the timestamp is in the past and the status is “ready”.

All TimedTask that are to be run are given a unique “run-{random-number}” status to uniquely identify them for this run. Individual task runners are then responsible for setting that status to “completed” after the task completes successfully or to “failed” if it failed.

All task runners are run in independent threading.Threads. After all Thread complete, any TimedTask that still have the unique “run-{random-number}” status are automatically set to the “failed” status.

  • wte.scripts.main – Administration application
  • wte.text_formatter