Skip to content

Commit

Permalink
Fix issue: Sentry causes failures in 2.9.2
Browse files Browse the repository at this point in the history
Fix issue aws#121. The issue is caused because we are trying to initialize
the DB before installing the requirements. This causes this line in
Airflow code base to fail because `sentry_sdk` isn't installed yet:

https://github.com/apache/airflow/blob/2.9.2/airflow/sentry.py#L58

To fix this issue, I moved the installation of PIP requirements before
the DB initialization.

This is unrelated to this issue, but when creating a process to install
the requirements, there is no need to pass the environment variables we
craft for Airflow processes, as what we simply just running a pip
install command.
  • Loading branch information
rafidka committed Jul 21, 2024
1 parent 104560a commit e35fdb2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions images/airflow/2.9.2/python/mwaa/entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,6 @@ async def install_user_requirements(cmd: str, environ: dict[str, str]):

pip_process = Subprocess(
cmd=["safe-pip-install", "-r", requirements_file, *extra_args],
env=environ,
process_logger=subprocess_logger,
conditions=[
TimeoutCondition(USER_REQUIREMENTS_MAX_INSTALL_TIME),
Expand Down Expand Up @@ -683,6 +682,7 @@ async def main() -> None:
# being captured and sent to the service hosting.
logger.debug(f"Environment variables: %s", environ)

await install_user_requirements(command, environ)
await airflow_db_init(environ)
if os.environ.get("MWAA__CORE__AUTH_TYPE", "").lower() == "testing":
# In "simple" auth mode, we create an admin user "airflow" with password
Expand All @@ -691,7 +691,6 @@ async def main() -> None:
# production environments.
await create_airflow_user(environ)
create_queue()
await install_user_requirements(command, environ)

# Export the environment variables to .bashrc and .bash_profile to enable
# users to run a shell on the container and have the necessary environment
Expand Down

0 comments on commit e35fdb2

Please sign in to comment.