Skip to content

Commit 6f11389

Browse files
Merge pull request #159 from pycontw/upgrade-to-airflow-3
Upgrade to Airflow 3.0.2
2 parents 2ab372d + 5f75a86 commit 6f11389

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4231
-4396
lines changed

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ docs/_build/
104104
# PyBuilder
105105
target/
106106

107-
# airflow sqlite db
108-
sqlite/
107+
# mkdocs
109108
site
109+
110+
# airflow
111+
sqlite/
112+
logs/
113+
simple_auth_manager_passwords.json.generated

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG AIRFLOW_VERSION=2.11.0
1+
ARG AIRFLOW_VERSION=3.0.2
22
ARG PYTHON_VERSION=3.10
33
ARG PLATFORM=linux
44

@@ -37,7 +37,9 @@ ENV PATH="/app/.venv/bin:$PATH"
3737

3838
COPY airflow.cfg ${AIRFLOW_HOME}/airflow.cfg
3939
COPY --chown=airflow:root dags ${AIRFLOW_HOME}/dags
40-
# TODO: remove this and the patch files once upgrade to 2.11.1
41-
COPY --chown=airflow:root patch /app/.venv/lib/python3.10/site-packages/airflow/migrations
40+
# TODO: remove this and the patch files once upgrade to 3.0.3
41+
COPY --chown=airflow:root patch/utils.py /app/.venv/lib/python3.10/site-packages/airflow/migrations/utils.py
42+
COPY --chown=airflow:root patch/versions /app/.venv/lib/python3.10/site-packages/airflow/migrations/versions
43+
COPY --chown=airflow:root patch/serialized_objects.py /app/.venv/lib/python3.10/site-packages/airflow/serialization/serialized_objects.py
4244

4345
ENTRYPOINT ["/entrypoint.sh"]

Dockerfile.test

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG AIRFLOW_VERSION=2.11.0
1+
ARG AIRFLOW_VERSION=3.0.2
22
ARG PYTHON_VERSION=3.10
33
ARG PLATFORM=linux
44

@@ -37,8 +37,10 @@ ENV PATH="/app/.venv/bin:$PATH"
3737

3838
COPY airflow.cfg ${AIRFLOW_HOME}/airflow.cfg
3939
COPY --chown=airflow:root dags ${AIRFLOW_HOME}/dags
40-
# TODO: remove this and the patch files once upgrade to 2.11.1
41-
COPY --chown=airflow:root patch /app/.venv/lib/python3.10/site-packages/airflow/migrations
40+
# TODO: remove this and the patch files once upgrade to 3.0.3
41+
COPY --chown=airflow:root patch/utils.py /app/.venv/lib/python3.10/site-packages/airflow/migrations/utils.py
42+
COPY --chown=airflow:root patch/versions /app/.venv/lib/python3.10/site-packages/airflow/migrations/versions
43+
COPY --chown=airflow:root patch/serialized_objects.py /app/.venv/lib/python3.10/site-packages/airflow/serialization/serialized_objects.py
4244

4345
ENV AIRFLOW_TEST_MODE=True
4446

airflow.cfg

Lines changed: 18 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
11
[core]
2-
# The folder where your airflow pipelines live, most likely a
3-
# subfolder in a code repository. This path must be absolute.
4-
dags_folder = /opt/airflow/dags
5-
62
# The amount of parallelism as a setting to the executor. This defines
73
# the max number of task instances that should run simultaneously
84
# on this airflow installation
@@ -16,73 +12,48 @@ max_active_tasks_per_dag = 64
1612
# environment
1713
load_examples = False
1814

19-
# Where your Airflow plugins are stored
20-
plugins_folder = /opt/airflow/plugins
21-
2215
# Secret key to save connection passwords in the db
2316
fernet_key = $FERNET_KEY
2417

2518
# How long before timing out a python file import
2619
dagbag_import_timeout = 600
2720

21+
auth_manager = airflow.providers.fab.auth_manager.fab_auth_manager.FabAuthManager
22+
23+
[dag_processor]
2824
# How long before timing out a DagFileProcessor, which processes a dag file
2925
dag_file_processor_timeout = 600
3026

31-
3227
[database]
3328
# The SqlAlchemy connection string to the metadata database.
3429
# SqlAlchemy supports many different database engine, more information
3530
# their website
3631
sql_alchemy_conn = sqlite:////opt/airflow/sqlite/airflow.db
37-
38-
39-
[logging]
40-
# The folder where airflow should store its log files
41-
# This path must be absolute
42-
base_log_folder = /opt/airflow/logs
43-
44-
# Log format for when Colored logs is enabled
45-
colored_log_format = [%%(blue)s%%(asctime)s%%(reset)s] {{%%(blue)s%%(filename)s:%%(reset)s%%(lineno)d}} %%(log_color)s%%(levelname)s%%(reset)s - %%(log_color)s%%(message)s%%(reset)s
46-
47-
# Format of Log line
48-
log_format = [%%(asctime)s] {{%%(filename)s:%%(lineno)d}} %%(levelname)s - %%(message)s
49-
50-
dag_processor_manager_log_location = /opt/airflow/logs/dag_processor_manager/dag_processor_manager.log
32+
external_db_managers = airflow.providers.fab.auth_manager.models.db.FABDBManager
5133

5234

5335
[api]
54-
# How to authenticate users of the API
55-
auth_backends = airflow.api.auth.backend.default
56-
57-
58-
[webserver]
59-
# Number of seconds the webserver waits before killing gunicorn master that doesn't respond
60-
web_server_master_timeout = 600
61-
62-
# Number of seconds the gunicorn webserver waits before timing out on a worker
63-
web_server_worker_timeout = 600
64-
65-
# Secret key used to run your flask app
66-
# It should be as random as possible
67-
secret_key = l\xba,\xc3\x023\xca\x04\xdb\xf2\xf7\xfa\xb8#\xee>
68-
6936
# Number of workers to run the Gunicorn web server
7037
workers = 2
7138

39+
# Number of seconds the gunicorn webserver waits before timing out on a worker
40+
worker_timeout = 600
41+
7242
# Expose the configuration file in the web server
7343
expose_config = True
7444

75-
# Allow the UI to be rendered in a frame
76-
x_frame_enabled = True
77-
78-
# Minutes of non-activity before logged out from UI
79-
# 0 means never get forcibly logged out
80-
force_log_out_after = 0
45+
# TODO: move it to env var
46+
# Secret key used to run your flask app
47+
# It should be as random as possible
48+
secret_key = l\xba,\xc3\x023\xca\x04\xdb\xf2\xf7\xfa\xb8#\xee>
8149

82-
authenticate = False
83-
auth_backend = airflow.api.auth.backend.default
50+
[api_auth]
51+
jwt_secret = $JWT_SECRET
8452

53+
[fab]
54+
auth_backends = airflow.providers.fab.auth_manager.api.auth.backend.session
8555

56+
# TODO: check whether we need it. I don't think we're using celery
8657
[celery]
8758
# The concurrency that will be used when starting workers with the
8859
# ``airflow celery worker`` command. This defines the number of task instances that
@@ -115,10 +86,8 @@ result_backend = db+postgresql://airflow:airflow@postgres/airflow
11586

11687

11788
[scheduler]
118-
child_process_log_directory = /opt/airflow/logs/scheduler
119-
120-
# Format of the log_id, which is used to query for a given tasks logs
121-
log_id_template = {{dag_id}}-{{task_id}}-{{execution_date}}-{{try_number}}
89+
# TODO: check whether it exists
90+
enable_health_check = True
12291

12392

12493
[kubernetes]
@@ -133,9 +102,6 @@ log_id_template = {{dag_id}}-{{task_id}}-{{execution_date}}-{{try_number}}
133102
# The timeout is specified as [connect timeout, read timeout]
134103
kube_client_request_args = {{"_request_timeout" : [60,60] }}
135104

136-
# Specifies the uid to run the first process of the worker pods containers as
137-
run_as_user =
138-
139105
# ref: https://airflow.apache.org/docs/apache-airflow/1.10.1/security.html#setting-up-google-authentication
140106
[google]
141107
client_id = <check the doc above>

0 commit comments

Comments
 (0)