Task Execution
Tasks are executed on background using Celery – function ppc_robot_worker.tasks.tasks.run_job()
.
Task execution is described by the following diagram:

Before the task is executed, job definition is retrieved from the database – this is not described in the diagram, as the worker uses standard Django models.
When the definition is ready, run_job
calls method
ppc_robot_lib.tasks.task_factory.TaskFactory.create_task()
(1). TaskFactory
then selects appropriate
taskType
(given by the task_type_name
and version
parameters) and creates a new instance of
the report type (1.1). The factory then creates a new ppc_robot_lib.tasks.task.Task
instance with
reference to the given task and parameters (1.2) and returns it (1.3).
run_job
then passes the Task instance to ppc_robot_lib.tasks.task_executor.TaskExecutor.execute()
(2).
TaskExecutor
calls the ppc_robot_lib.tasks.abstract_task_type.AbstractFunctionTaskType.execute()
(2.1).
After the execute()
method completes, run_job
updates the job status and sends notification to the user.