Search code examples
pythonamazon-web-servicesairflowmwaa

MWAA - Impact of configuring a requirements.txt file


I am working with Amazon Managed Workflows for Apache Airflow (MWAA).

We have some DAGs running successfully in the instance. They use the bash operator and the python operator. We do not currently have a requirments.txt file specified for the instance as there are no python external module dependencies that are not included by default in MWAA. I need to deploy a new DAG which will reference a number of external python libraries that are not included by default in MWAA. For this, I will have to specify a requirments.txt file for the MWAA instance.

What is the risk of setting a requirements.txt file on a running instance? If there is a problem with the file such as:

  1. bad file format
  2. unknown library - not available on pypi.org
  3. library version not available on pypi.org
  4. library conflict with some other library

would the existing DAGs that were already working prior to the introduction of the requirements.txt file keep working, or could this file break the running system?

I am trying to understand if it is safe to test out / deploy a requirments.txt to a live production environment. Unfortunately, I don't have a non-production environment available nor access/permission to create one in the relevant AWS account.


Solution

  • What is the risk of setting a requirements.txt file on a running instance?

    In general, yes, all of the problems you listed (e.g. bad file format, unknown library, etc) may cause problems with existing DAGs. This includes errors such as incorrect package versions, which may install correctly, but may not be implemented correctly.

    Example error: https://docs.aws.amazon.com/mwaa/latest/userguide/t-apache-airflow-11012.html#troubleshooting-dependencies

    I am trying to understand if it is safe to test out / deploy a requirments.txt to a live production environment. Unfortunately, I don't have a non-production environment available nor access/permission to create one in the relevant AWS account.

    Test your new requirements.txt file in the MWAA local runner. The local runner has specific functionality for testing requirements.txt.

    ./mwaa-local-env test-requirements
    

    References:

    1. aws-mwaa-local-runner (GitHub)
    2. Testing requirements.txt (GitHub)
    3. Tutorial: Configuring the aws-mwaa-local-runner in a Continuous Delivery (CD) pipeline