Skip to content

Work

Philosophy

The core tenant of workflow is to provide impeccable bookkeeping for performing any task through a simple and intuitive interfaces. At the core of the workflow system is the Work object which consists of a generic set of metadata that can be used to describe any task to be performed. The workflow system manages the lifecycle of a single or collection of pipelined or parallel work objects, from creation, processing and eventual storage in a database. The user can then query the workflow framework to get any parameters work lifecycle.

Work Object

The Work object at the core of the workflow system is simply a python dictionary object which contains all parameters that can be used to define a task at the telescope. The Work object is defined as follows:

Python
from workflow.definitions.work import Work

work = Work(
    pipeline="sample-pipeline",
    site="local",
    function="workflow.examples.function.math",
    parameters={"alpha": 1, "beta": 2},
)

At a minimum, the Work object requires only requires the pipeline parameter. Additional lifecycle are automatically added to the Work object as it progresses through the workflow system. At any time in its lifecycle, you can see all the parameters in the Work object by simply running,

Python
work.payload
{
    "pipeline": "sample-pipeline",
    "parameters": None,
    "results": None,
    "path": ".",
    "event": None,
    "tags": None,
    "group": None,
    "timeout": 3600,
    "retries": 2,
    "priority": 3,
    "products": None,
    "plots": None,
    "site": "local",
    "user": None,
    "archive": True,
    "precursors": None,
    "config": None,
    "id": None,
    "creation": 1673298165.260349,
    "start": None,
    "stop": None,
    "attempt": 1,
    "status": "created",
}