API Reference¶
This page is automatically generated from the Python source code docstrings.
pyncette
¶
Context
¶
Task execution context. This class can have dynamic attributes.
ExecutionMode
¶
FailureMode
¶
Pyncette
¶
Pyncette(
repository_factory: RepositoryFactory = sqlite_repository,
executor_cls: type = DefaultExecutor,
poll_interval: timedelta = timedelta(seconds=1),
**kwargs: Any,
)
Pyncette application.
task
¶
Decorator for marking the coroutine as a task
dynamic_task
¶
Decorator for marking the coroutine as a dynamic task
partitioned_task
¶
Decorator for marking the coroutine as a partitioned dynamic task
fixture
¶
fixture(name: str | None = None) -> Decorator[FixtureFunc]
Decorator for marking the generator as a fixture
middleware
¶
Decorator for marking the function as a middleware
create
async
¶
create(
context_items: dict[str, Any] | None = None,
) -> AsyncIterator[PyncetteContext]
Creates the execution context.
main
¶
Convenience entrypoint for console apps, which sets up logging and signal handling.
PyncetteContext
¶
PyncetteContext(
app: Pyncette, repository: Repository, executor: DefaultExecutor
)
Execution context of a Pyncette app
schedule_task
async
¶
Schedules a concrete instance of a dynamic task
Args: task: The dynamic task to schedule instance_name: Name for this concrete instance force: If False (default), fails if task is locked or preserves sooner schedule. If True, overwrites everything including locks and schedule. **kwargs: Additional arguments for the task instance (schedule, interval, etc.)
Returns: The concrete task instance
Raises: PyncetteException: If force=False and task is currently locked
unschedule_task
async
¶
unschedule_task(task: Task, instance_name: str | None = None) -> None
Removes the concrete instance of a dynamic task
get_task
async
¶
get_task(task: Task, instance_name: str | None = None) -> TaskState | None
Get the state of a task instance
Args: task: For static tasks, the task itself. For dynamic tasks, either: - The parent task (template) with instance_name provided - An already-instantiated concrete dynamic task (instance_name should be None) instance_name: The instance name for dynamic tasks when passing the parent task. Must be None for static tasks or pre-instantiated dynamic tasks.
Returns: TaskState if found, None otherwise
Raises: ValueError: If instance_name is provided with a non-dynamic task or an already-instantiated task
list_tasks
async
¶
list_tasks(
task: Task,
limit: int | None = None,
continuation_token: ContinuationToken | None = None,
) -> ListTasksResponse
List all instances of a dynamic task with pagination
Args: task: The dynamic task template limit: Maximum number of tasks to return (backend may return less) continuation_token: Token from previous response to get next page
Returns: ListTasksResponse with tasks and optional continuation token
Raises: ValueError: If task is not dynamic
Note: Results are not guaranteed to be in any particular order. Backends may order results to provide stable pagination.
add_to_context
¶
Adds a value with a given key to task context
shutdown
¶
Initiates graceful shutdown, terminating the main loop, but allowing all executing tasks to finish.
options: show_submodules: true