Yeonguk Choo

Explorer

← All talks

Apache Airflow 101 with Astro CLI

Python PIP Deployment & Airflow Introduction Hands-On!, Busan · Workshop

· Intro

Presentation language not specified

A hands-on introduction to Apache Airflow with Astro CLI, using a daily news summary and investment-advice messaging service as the exercise.

Original materials

This was a hands-on workshop held on October 26, 2024, at Elice-Lab in Busan as part of Python PIP & Airflow Hands-On.

About the Workshop

You do not need to build a production environment from scratch to learn Airflow. It is important to first run it on your own computer, connect small tasks, and learn where to look when something fails. In this workshop, we used Astro CLI to bring news collection, summarization, evaluation, and email delivery together in one workflow.

Workshop Materials

The Workshop in Writing

Focus on the workflow, not installation

Spending all the time on environment setup in an introductory workshop can be exhausting before you even begin learning what you came for. Astro CLI was chosen in these materials so that starting and stopping local Airflow and checking DAG changes could be handled as one development workflow.

After initializing the project, run it with astro dev start and control the environment with stop and restart. The important thing is not memorizing commands, but creating a short cycle of changing code and checking the results.

Split one script into multiple tasks

The functionality for fetching news and sending an email could be implemented as one long function. But if you want to know where a failure happened and rerun only the necessary part, it is better to make the task boundaries explicit.

Collect news → Summarize → Evaluate → Send email

After looking at DAGs written in both the basic and decorator styles, the workshop expresses each of these stages as a Task. A failure while collecting news is a different problem from a failure while sending email. When the workflow's structure is visible in both the code and the UI, it is easier to find that difference.

Notifications are part of automation, too

If people have to open and check every automated task themselves, a management burden remains. That is why, before processing news in depth, the workshop covers a DAG that sends email and Slack notifications on success or failure.

The slides explain how to configure email authentication and a Slack webhook, and describe how to manage the required settings in a container environment. Actual keys and credentials are not included in this article.

A pipeline that reads and delivers the news

The workshop materials use yfinance to fetch relevant news, ChatGPT to create summaries and positive or negative evaluations, and email to deliver the results. A model call is also an independent task, so its output can be checked between the data collection and delivery stages.

The goal here is to learn how to manage the execution order of multiple tools, not the accuracy of investment decisions. The example's evaluation is for learning and is not verified advice for actual trading.

Summary

  • A local environment should be easy to run repeatedly so you can focus on the workshop.
  • Making task boundaries visible makes it easier to understand which part failed and what to rerun.
  • For automation to be useful day to day, connect not only data processing, but also result delivery and failure notifications.