Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable plugins folder #98

Merged
merged 8 commits into from
Jun 12, 2024

Conversation

LucaCinquini
Copy link
Collaborator

Purpose

  • This PR creates a "plugins/" folder that will be used to store code and utilities common to all DAGs

Proposed Changes

  • [ADD] "plugins/" folder to the Airflow custom containers under /opt/airflow/plugins

Issues

Testing

  • Tested the execution of the "karpenter_test" DAG when using the "unity_sps_utils" library loaded from the plugins folder.

@drewm-swe
Copy link
Contributor

drewm-swe commented Jun 12, 2024

Thanks Luca. I'm seeing a failure in the unit tests during dag validation:

ModuleNotFoundError: No module named 'unity_sps_utils'

I'm wondering if we should try to follow this technique for incorporating additional sps python modules in our dags:
https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/modules_management.html#modules-management

@LucaCinquini
Copy link
Collaborator Author

That module should be part of the "plugins/" folder. Which version of the Docker image is used by the unit tests? It will probably need to be rebuilt.

@drewm-swe
Copy link
Contributor

The unit tests do not utilize a docker image, they are simply static tests.

If we were to use a dag directory structure like this, it seems like we could still utilize our static unit tests:
image

@LucaCinquini
Copy link
Collaborator Author

We could... Let me see if I can make the changes.

@LucaCinquini
Copy link
Collaborator Author

But it does becomes messy with the "dags/" and "dags-catalog/" folder because we would need to copy selected portions of that "dags/" folder to "/opt/airflow/dags", and not others.

@drewm-swe
Copy link
Contributor

drewm-swe commented Jun 12, 2024

Another option could be to have the custom dag utils/plugins be a python package which is pip installed in the Dockerfile. For all of the other dependencies in our DAGs, they are made available to pytest through pip install as part of our pyproject.toml:
https://github.com/unity-sds/unity-sps/blob/develop/pyproject.toml#L34-L45

Airflow docs about this:
https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/modules_management.html#creating-a-package-in-python

@drewm-swe drewm-swe merged commit 7a5974d into sbg-e2e-concurrent-executions Jun 12, 2024
2 checks passed
@drewm-swe drewm-swe deleted the enable-plugins-folder branch June 12, 2024 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants