pynenc.app#
Module Contents#
Classes#
The main class of the Pynenc library that creates an application object. |
API#
- class pynenc.app.Pynenc(app_id: str | None = None, config_values: Optional[dict[str, Any]] = None, config_filepath: Optional[str] = None)[source]#
The main class of the Pynenc library that creates an application object.
- Parameters:
Note
All of these base classes are abstract and cannot be used directly. If none is specified, they will default to
MemTaskBroker,MemStateBackend, etc. These default classes do not actually distribute the code but are helpers for tests or for running an application on your localhost. They may help to parallelize to some degree but cannot be used in a production system.Initialization
- logger() logging.Logger#
- orchestrator() pynenc.orchestrator.base_orchestrator.BaseOrchestrator#
- state_backend() pynenc.state_backend.base_state_backend.BaseStateBackend#
- serializer() pynenc.serializer.base_serializer.BaseSerializer#
- property runner: pynenc.runner.base_runner.BaseRunner#
- task(func: Optional[pynenc.types.Func] = None, **options: Any) pynenc.task.Task | Callable[[pynenc.types.Func], pynenc.task.Task][source]#
The task decorator converts the function into an instance of a BaseTask. It accepts any kind of options, however these options will be validated with the options class assigned to the class.
Check the options reference in conf.config_task or the Pynenc documentation for a detailed explanation of the BaseTask instance you are applying.
- Parameters:
func (Optional[“Func”]) – The function to be converted into a BaseTask instance.
**options – Arbitrary keyword arguments representing options for the BaseTask instance. Each key-value pair in options corresponds to a specific configuration setting for the task. The available options and their meanings depend on the BaseTask implementation and configuration.
- Returns:
The BaseTask instance or a callable that returns a BaseTask instance.
- Example:
@app.task(option1='value1', option2='value2') def my_func(x, y): return x + y result = my_func(1, 2)