Executor#

class GraderExecutor(**kwargs: Any)[source]#
cancel_tasks()[source]#

Immediately cancel all tasks being executed.

get_event_loop#

A trait which is callable.

Notes

Classes are callable, as are instances with a __call__() method.

n_concurrent_tasks#

An int trait.

remove_queued_tasks()[source]#

Remove all items in the queue.

resubmit_cancelled_tasks#

A boolean (True, False) trait.

start()[source]#

Restart the executor. If it is already running this has no effect.

async stop(timeout=5)[source]#

Wait for tasks to finish within the timout and cancel remaining tasks.

Parameters

timeout – Timeout in seconds.

submit(task: Callable, on_finish: Optional[Callable] = None)[source]#

Submit a task to be processed by the executor.

Parameters
  • task – The task to be executed.

  • on_finish – Callable that is executed when submitted task finishes. Can be synchronous or asynchronous call.

async task_executor()[source]#