npx skills add ...
npx skills add google/skills --skill managed-airflow-migrations
Provides guidance for migrating Apache Airflow DAGs in Managed Service for Apache Airflow (MSAA; formerly Cloud Composer). Covers migration to Airflow 2.11.1 (MSAA Gen 2 and 3) and Airflow 3 (MSAA Gen 3), including environment inspection, GCS download/upload and scanning patterns for breaking changes. Use when migrating the DAG code to newer Airflow version. Don't use when checking DAG run failures unrelated to code migration.
npx skills add google/skills --skill managed-airflow-migrations
This skill guides you through the process of adjusting Airflow DAGs from an existing Managed Service for Apache Airflow (formerly Cloud Composer) environment (or available locally) to make them compatible with Airflow 2.11.1 (MSAA Gen 2 or 3) or Airflow 3 (MSAA Gen 3).
Before making any changes, download the existing DAG files if explicitly requested. Inspect the source environment to confirm source version only if explicitly requested. For detailed instructions about environment inspection and downloading files check references/environment-inspection.md.
If migrating to Airflow 2.11.1 (MSAA Gen 2) or Airflow 3, use the list below to trace the version progression of key dependencies. The list covers changes needed to get to Airflow 2.11.1. Take them into account when migrating from Airflow 2 (earlier than 2.11.1) to Airflow 3.
10.26.03.14.04.13.318.0.04.1.45.3.4timeout removed; get_conn() context
manager.SimpleHttpOperator -> HttpOperator.BigQueryExecuteQueryOperator removed.AutoMLBatchPredictOperator removed.BigQueryCreateEmptyTableOperator and
BigQueryCreateExternalTableOperator removed; Life Sciences operators
removed.19.0.04.1.65.5.020.0.05.0.06.0.2sshtunnel removed (native tunneling).If migrating to Airflow 3 (MSAA Gen 3), note that this is a major version upgrade with significant changes, including:
airflow to airflow.sdk).Dataset to Asset.Take into account all applicable changes within Airflow 2 (e.g. when migrating from Airflow 2.10.2, apply changes needed to move to Airflow 2.11.1 and Airflow 3 migration changes on top of that).
Run the scan commands from the root of your local workspace
(./migration_workspace unless indicated otherwise).
Use these scans if migrating to Airflow 2.11.1+ (intermediate step when migrating to Airflow 3).
grep -rn "Dataset(" ./dagsChange: Raw HTML in DAG docs / params is escaped by default.
Scan Command:
Remediation: Convert HTML to Markdown, or set
AIRFLOW__WEBSERVER__ALLOW_RAW_HTML_DESCRIPTIONS=True in target.
grep -rn "as_teardown" ./dagsChange: Period renamed to Interval, testing helpers removed.
Scan Command (Code):
Scan Command (Tests):
Remediation: Replace Period with Interval, and period(...) with
interval(...).
grep -rn "SSHHook" ./dags | grep "timeout"grep -rn "with SSHHook" ./dagsgrep -rn "\.get_tunnel" ./dagstimeout with conn_timeout in SSHHook.with hook as conn: with with hook.get_conn() as conn:.get_tunnel() as context manager: with hook.get_tunnel(...) as tunnel:.grep -rn "SimpleHttpOperator" ./dagsSimpleHttpOperator with HttpOperator.Scan Command (BigQuery query):
BigQueryInsertJobOperator (use
configuration dict).Scan Command (BigQuery table):
BigQueryCreateTableOperator (use
table_resource dict).Scan Command (AutoML):
Scan Command (Dataflow):
DataflowCreatePipelineOperator/DataflowRunPipelineOperator.Scan Command (Life Sciences):
BatchCreateJobOperator).Scan Command (ADLS to GCS): grep -rn "ADLSToGCSOperator" ./dags
file_system_name is provided.Use instructions from references/airflow-3.md when migrating to Airflow 3.
Perform deployment and verification steps only if explicitly requested to do so.
After applying code changes for Airflow 3, verify syntax correctness. If available in the development environment, run static lint checks:
Resolve any reported deprecation warnings before finalization. If ruff is not available, recommend installing one.
Expected Output: gs://<target-bucket-name>/dags
Perform this step only if explicitly requested to do so. Copy the modified
DAGs and any backed-up bucket dependencies from your local workspace to the
target GCS bucket. If you skipped the inspection step, ensure you have the
correct <target-bucket-name>.
Upload DAGs:
Upload Other Bucket Dependencies (If applicable):
Perform this step only if explicitly requested to upload modified DAGS to a target environment (and after uploading).
You can verify that your DAGs have been successfully uploaded, parsed, and registered by the Airflow scheduler in the target environment using the Airflow CLI.
List Registered DAGs: Run the following command to list all DAGs registered in the target environment. Verify that your migrated DAGs appear in this list.
Check for Import Errors: If some DAGs are missing from the list, or to ensure there are no parsing issues, check for import errors:
Expected Output:
No data found.Note: It may take a couple of minutes for the Airflow scheduler to parse the new files and for changes to reflect in these commands.
Perform this step only if explicitly requested to upload modified DAGS to a target environment (and after uploading). Monitor Cloud Logging for the target environment to detect any runtime errors or import errors.
Run the following query in the GCP Cloud Logging Console (or via gcloud logging read):
If you want to verify your changes locally before deploying to the target
environment, you can use the Composer Local Development CLI tool
(composer-dev). Use
references/local-development-environment.md
as a reference for interactions with local development environments.`