Use the following topics to resolve common issues with running an Astro project in a local Airflow environment.
View local Kubernetes logs to troubleshoot issues with Pods that are created by the KubernetesPodOPerator. See Test and Troubleshoot the KubernetesPodOperator Locally.
When dependency errors occur, the error message that is returned often doesn’t contain enough information to help you resolve the error. To retrieve additional error information, you can review individual operating system or python package dependencies inside your local Docker containers.
For example, if your packages.txt file contains several packages and you receive build errors after running astro dev start, you can enter the container and install the packages manually to review additional information about the errors.
Open your Astro project packages.txt file and remove the references to the packages that are returning error messages.
Run the following command to build your Astro project into a Docker image and start a local Docker container for each Airflow component:
Run the following command to open a bash terminal in your scheduler container:
In the bash terminal for your container, run the following command to install a package and review any error messages that are returned:
For example, to install the GNU Compiler Collection (GCC) compiler, you would run:
Open your Astro project packages.txt file and add the package references you removed in Step 1 individually until you find the package that is the source of the error.
Make sure that no dags have duplicate dag_ids. When two dags use the same dag_id, the newest dag won’t appear in the Airflow UI and you won’t receive an error message.
By default, the Airflow scheduler scans the dags directory of your Astro project for new files every 300 seconds (5 minutes). For this reason, it might take a few minutes for new dags to appear in the Airflow UI. Changes to existing dags appear immediately.
To have the scheduler check for new dags more frequently, you can set the AIRFLOW__SCHEDULER__DAG_DIR_LIST_INTERVAL environment variable to less than 300 seconds. If you have less than 200 dags in a Deployment, it’s safe to set AIRFLOW__SCHEDULER__DAG_DIR_LIST_INTERVAL to 30 (30 seconds). See Set environment variables for how to set this on Astro.
In Astro Runtime 7.0 and later, the Airflow UI Code page includes a Parsed at value which shows when a dag was last parsed. This value can help you determine when a dag was last rendered in the Airflow UI. To view the Parsed at value in the Airflow UI, click Dags, select a dag, and then click Code. The Parsed at value appears at the top of the dag code pane.
If your Astro project contains many dags or tasks, then you might experience performance issues in your local Airflow environment.
To improve the performance of your environment, you can:
Generating dags dynamically can also decrease the performance of your local Airflow environment, though it’s a common authoring pattern for advanced use cases. For more information, see Dynamically Generating dags in Airflow. If your dags continue to run slowly and you can’t scale Docker or Airflow any further, Astronomer recommends pushing your project to a Deployment on Astro that’s dedicated to testing.
If you don’t have enough Docker resources allocated to your local Airflow environment, you might see tasks fail and exit with this error:
If you see this error, increase the CPU and memory allocated to Docker. If you’re using Docker Desktop, you can do this by opening Docker Desktop and going to Preferences > Resources > Advanced. See Change Docker Desktop preferences on Mac.
If you are using Podman, you can run podman machine set --cpus 4 --memory 4096. See Podman commands reference for more details.
astro dev startIf you’re running the Astro CLI on a Mac computer that’s built with the Apple M1 chip, your Astro project might take more than 5 mins to start after running astro dev start. This is a current limitation of Astro Runtime and the Astro CLI.
If your project won’t load, it might also be because your webserver or scheduler is unhealthy. In this case, you might need to debug your containers.
After running astro dev start, retrieve a list of running containers by running astro dev ps.
If the webserver and scheduler containers exist but are unhealthy, check their logs by running:
(Optional) Run the following command to prune all unused Docker objects including volumes and free disk space:
See docker system prune for more information about pruning.
These logs should help you understand why your webserver or scheduler is unhealthy. Possible reasons why these containers might be unhealthy include:
packages.txt or requirements.txt.By default, the Astro CLI uses port 8080 for the Airflow webserver and port 5432 for the Airflow metadata database in a local Airflow environment. If these ports are already in use on your local computer, an error message similar to the following appears:
To resolve a port availability error, you have the following options:
astro dev restart.astro config set webserver.port 8081 for the webserver and astro config set postgres.port 5433 for Postgres. See Configure CLI for all available configurations.Run docker ps to identify the Docker containers running on your computer.
Copy the values in the CONTAINER ID column.
Select one of the following options:
docker stop <container_id> to stop a specific Docker container. Replace <container_id> with one of the values you copied in step 2.docker stop $(docker ps -q) to stop all running Docker containers.If port 8080 or 5432 are in use on your machine by other services, the Airflow webserver and metadata database won’t be able to start. To run these components on different ports, run the following commands in your Astro project:
For example, to use 8081 for your webserver port and 5435 for your database port, you would run the following commands: