appendix-a

appendix A  Running code samples

 

This book comes with an accompanying code repository on GitHub (https://mng.bz/Ow82). The repository holds the code used in this book, along with easy-to-­execute Docker environments that enable you to run all the examples yourself. This appendix explains how the code is organized and how to run the examples.

A.1 Understanding the code structure

The code is organized by chapter, and each chapter is structured the same way. The top level of the repository consists of several chapter directories (numbered 01–17), which contain self-contained code examples for the corresponding chapters. Each directory contains at least the following files/directories:

  • dags—Directory containing the DAG files demonstrated in the chapter
  • compose.yaml—File describing the standard Airflow setup needed to run the DAGs
  • compose.override.yaml—File with chapter-specific overrides and extra services
  • .env—Chapter-specific environment variables
  • README.md—Readme file introducing the chapter examples and explaining any chapter-specific details on how to run the examples

Where possible, code listings in the book refer to the corresponding file in the chapter directory. For some chapters, code listings shown in the chapters correspond to individual DAGs. In other cases (particularly for more complex examples), several code listings are combined into a single DAG file.

A.2 Running the examples

A.2.1 Starting the Docker environment

A.2.2 Inspecting running services

A.2.3 Tearing down the environment