base_tasks.py

class host.base_tasks.SystemTaskRunner[source]

Abstract base class for a SystemTaskRunner.

task_frequency_seconds

Positive integer defining the frequency the task in run at. Defaults to 60 seconds.

Type:

int

task_initially_enabled

True means the task is initially enabled, False means the task is initially disabled. Default is enabled (True).

Type:

bool

task_name

Name of the task the TaskRunner works on.

Type:

str

task_type

Type of task the TaskRunner works on.

Type:

str

task_function_name

Name of the function used to register the task in celery.

Type:

str

property task_function_name: str

TaskRunner function name to be registered by celery.

property task_type

Type of task the TaskRunner works on.

class host.base_tasks.TaskRunner[source]

Abstract base class for a TaskRunner.

task_frequency_seconds

Positive integer defining the frequency the task in run at. Defaults to 60 seconds.

Type:

int

task_initially_enabled

True means the task is initially enabled, False means the task is initially disabled. Default is enabled (True).

Type:

bool

task_name

Name of the task the TaskRunner works on.

Type:

str

task_type

Type of task the TaskRunner works on.

Type:

str

task_function_name

Name of the function used to register the task in celery.

Type:

str

abstract run_process()[source]

Runs a task runner process. Needs to be implemented.

property task_frequency_seconds: int

Defines the frequency in seconds the task should be run at.

property task_function_name: str

TaskRunner function name to be registered by celery.

property task_initially_enabled

Defines if the task should be run on blast startup.

abstract property task_name: str

Name of the task the TaskRunner works on.

abstract property task_type: str

Type of task the TaskRunner works on.

class host.base_tasks.TransientTaskRunner(transient_name=None)[source]

Abstract base class for a TransientTaskRunner.

task_frequency_seconds

Positive integer defining the frequency the task in run at. Defaults to 60 seconds.

Type:

int

task_initially_enabled

True means the task is initially enabled, False means the task is initially disabled. Default is enabled (True).

Type:

bool

task_name

Name of the task the TaskRunner works on.

Type:

str

task_type

Type of task the TaskRunner works on.

Type:

str

task_function_name

Name of the function used to register the task in celery.

Type:

str

processing_status

Status of the task while runner is running a task.

Type:

models.Status

failed_status

Status of the task is if the runner fails.

Type:

model.Status

prerequisites

Prerequisite tasks and statuses required for the runner to process.

Type:

dict

find_register_items_meeting_prerequisites()[source]

Finds the register items meeting the prerequisites.

Returns:

Task register items meeting prerequisites.

Return type:

(QuerySet)

run_process(task_register_item=None)[source]

Runs task runner process.

select_register_item()[source]

Selects register item to be processed by task runner.

Returns:

returns item if one exists,

returns None otherwise.

Return type:

register item (models.TaskRegister)

property task_function_name: str

TaskRunner function name to be registered by celery.

property task_type

Type of task the TaskRunner works on.

host.base_tasks.initialise_all_tasks_status(transient)[source]

Set all available tasks for a transient to not processed.

Parameters:

transient (models.Transient) – Transient to have all of its task status initialized.

Returns:

Saves the new updates to the backend.

Return type:

None

host.base_tasks.task_soft_time_limit = 3600

This module contains the base classes for TaskRunner in blast.

host.base_tasks.update_status(task_status, updated_status)[source]

Update the processing status of a task.

Parameters:
  • task_status (models.TaskProcessingStatus) – task processing status to be updated.

  • updated_status (models.Status) – new status to update the task with.

Returns:

Saves the new updates to the backend.

Return type:

None