async-tasks

Async task functions.

Generated by make records from the decisions whose topic (or also) is this one; edit the decisions, not this page.

Current

Async tasks

  • Async task calls return coroutines outside a DAG (D49): Outside a DAG, a plain async task call returns a coroutine; typed tests use await task.fn(...), since a plain call is typed as its result. Async cleanups and resource setups/cleanups are supported. Remaining background tasks are cancelled; their errors are warnings and do not change the attempt’s result.

  • Async tasks and watcher hosts use uvloop whenever installed (D316): The interpreter uses uvloop when it can import it; otherwise it uses asyncio. Each async attempt logs its loop, and schedr[uvloop] offers an installation extra.

  • Tests await an async task through its fn attribute (D319): await task.fn(…) calls the coroutine with the task’s declarations in force. Its type is the function’s return type, including None; wrapped functions retain their kind.

From other topics

  • Connections provide sync and async clients and checks (D53, connections; built M4.10)

  • Connections use optional clients and worker-side checks and tests (D174, connections; built M4.7c)

  • Async in-task calls use an a prefix (D315, task-context; built M4.10)

  • Async SQL connections support PostgreSQL (D317, connections; built M4.10)

  • One connection definition provides sync and async clients (D318, connections; built M4.10)

Replaced

None.

Where in code

  • crates/schedr-agent/src/agent.rs (D174)

  • crates/schedr-agent/src/connection_jobs.rs::check (D174)

  • crates/schedr-master/src/dispatch.rs::set_connections (D174)

  • crates/schedr-model/src/connection.rs::ConnectionDef (D53)

  • python/schedr/connection_types.py::AsyncSqlConnection (D317)

  • python/schedr/connection_types.py::Generic (D318)

  • python/schedr/connection_types.py::SQL (D317)

  • python/schedr/connections.py::TwoWayConnection (D53, D318)

  • python/schedr/context.py::acleanup_handle (D315)

  • python/schedr/context.py::asecret (D315)

  • python/schedr/resources.py (D319)

  • python/schedr/runner/coroutines.py::loop_factory (D316)

  • python/schedr/runner/coroutines.py::run_coroutine (D49)

  • python/schedr/tasks.py::_declaring_while (D319)

  • python/schedr/tasks.py::is_async (D49)

Open

None.

Details and edge cases, with the reasons; read them before changing this:

  • archive/PROJECT.md: Async task functions