The "Local" HQS Tasks Backend

This backend is intended to run HQS Tasks locally on your laptop, or, more precisely, on the same machine where the client script runs on.

This, of course, requires that the task and not just the task client package is installed on your machine. We therefore refer you to the documentation of the corresponding software package for installation instructions.

At the moment, this backend is more targeted towards tasks developers and less towards end-users.

Prerequisites

Before being able to use this backend, you need to install some additional (extra) dependencies. For this, please install the component to support local execution by adding [local] to the package name in the install command. For instance, using the example client package introduced in "Running tasks", the corresponding install command for hqstage is:

hqstage install hqs_task_example_client[local]

Note

This only needs to be done once (not for each client package separately).

Configuration

In the current version of HQS Tasks, this is the default backend and does not need to be configured explicitly. However, since the primary backend which most end-users will be using is a different one, we consider changing this in the future. We therefore suggest, when you run tasks locally, to explicitly configure your client script to use this backend.

For that, add the following basic configuration to your client script:

from hqs_tasks_execution.config import global_config, BackendConfigurationLocal

global_config.backend = BackendConfigurationLocal()

Technical details

Tasks are run as a separate system process detached from the Python session of the user script. To be more precise, it is ran as a systemd scope unit.

Similar to other backends, you can interrupt waiting for the result of such a task execution by terminating the user script. Note that the task continues to run in the detached process. When re-running the user script, it tries to find and reattach to the previously started process. Cancelling such a running task can be done by interactively answering the question when being prompted when attempting to cancel the script, or by using the systemd CLI.