SAService Architect Back to designer
SAService ArchitectDocumentation
Framework lifecycle start_service / stop_service

Python lifecycle

asyncio maker groups, explicit construction phases, source-last start, and deadline-aware shutdown.

When to use

Use this page when implementing maker hooks, owning resources, or diagnosing startup and shutdown.

Behavior

  • custom_makers_init runs once before infrastructure and function creation.
  • _MakerGroup uses asyncio.gather, cancels its context, and raises the first error.
  • build_stream_graph precedes bind_transports; runtime start activates Sources last.
  • stop_service bounds Context once, calls on_stop, then runtime stop with the remaining deadline.

Python startup sequence

Python shutdown sequence

  • Network admission drains before endpoint state is released.
  • Ordinary Sources stop before managed connector admission.
  • Nested asyncio tasks drain before pools, storage, and Sinks.
  • Timed-out detached tasks are cancelled and observed.

Hooks and boundaries properties

Generated extension points and runtime-owned lifecycle boundaries.

PropertyTypeDescription
custom_makers_initasync hook

Mutates generated makers once.

initialize_infrastructuregenerated

Creates servers, clients, and infrastructure.

initialize_functionsgenerated

Runs function makers concurrently.

on_start / on_stopasync hooks

Run around runtime activation and drain.

run_shutdown_operationsruntime

Uses only the remaining shared deadline.

Lifecycle outline

configure -> make once -> bind -> start -> admit -> drain -> stop