monkey_wrench.task.base module

The module providing base models for tasks.

class monkey_wrench.task.base.Context(*values)[source]

Bases: str, Enum

Enum for all possible task contexts.

product_ids = 'ids'
product_files = 'files'
chimp = 'chimp'
class monkey_wrench.task.base.Action(*values)[source]

Bases: str, Enum

Enum for all possible task actions.

fetch = 'fetch'
verify = 'verify'
retrieve = 'retrieve'
class monkey_wrench.task.base.TaskBase(*, context: Context, action: Action, specifications: type[Model])[source]

Bases: BaseModel

Pydantic base model for a task.

context: Context
action: Action
specifications: type[Model]
static log(func: Callable[[...], dict[str, Any]]) Callable[[...], dict[str, Any]][source]

Decorator to log the details of the given task as well as the returned result.

perform() dict[str, Any] | None[source]

Perform the action using the given arguments.