Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Apache Airflow StandaloneCommand Entrypoint

From Leeroopedia


Knowledge Sources
Domains DevOps, CLI
Last Updated 2026-02-08 00:00 GMT

Overview

Concrete tool for bootstrapping a complete Airflow instance provided by the Airflow CLI.

Description

The StandaloneCommand class runs all components of Airflow (scheduler, dag-processor, API server, triggerer) under a single parent process. It is designed for development and testing environments. The companion migratedb function handles database schema migrations via Alembic.

Usage

Use this when setting up a local Airflow development environment or running a single-node deployment. For production, use individual component startup commands instead.

Code Reference

Source Location

  • Repository: Apache Airflow
  • File: airflow-core/src/airflow/cli/commands/standalone_command.py
  • Lines: L48-312

Signature

class StandaloneCommand:
    """Runs all components of Airflow under a single parent process."""

    @classmethod
    def entrypoint(cls, args) -> None:
        """Entry point for the standalone command."""
        ...

    def __init__(self) -> None:
        ...

    @providers_configuration_loaded
    def run(self) -> None:
        """Run scheduler, dag-processor, api-server, triggerer as subprocesses."""
        ...

Database Migration:

def migratedb(args) -> None:
    """Execute Alembic schema upgrade."""
    # Parameters:
    #   args.to_version: str — target version
    #   args.to_revision: str — target revision
    #   args.from_version: str — source version
    #   args.show_sql_only: bool — print SQL without executing

Import

from airflow.cli.commands.standalone_command import StandaloneCommand
from airflow.cli.commands.db_command import migratedb

I/O Contract

Inputs

Name Type Required Description
args Namespace Yes CLI argument namespace (from argparse)
airflow.cfg Config file No Airflow configuration (or env vars)
metadata database Database Yes Empty or existing metadata database

Outputs

Name Type Description
Running services Processes Scheduler + API server + triggerer + dag-processor subprocesses
Migrated database Database Metadata database with current schema
Admin credentials stdout Default admin user credentials (standalone mode only)

Usage Examples

Standalone Quick Start

# Start all Airflow components in standalone mode
airflow standalone

# Or migrate database separately
airflow db migrate
airflow db migrate --to-version 3.0.0
airflow db migrate --show-sql-only

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment