Skip to content

Commit 7336340

Browse files
committed
Bump to Airflow 1.10.4 and Python 3.7
1 parent c0edbbf commit 7336340

File tree

7 files changed

+81
-30
lines changed

7 files changed

+81
-30
lines changed

.circleci/config.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,18 @@ jobs:
99
- checkout
1010
- setup_remote_docker:
1111
docker_layer_caching: true
12-
- run:
12+
- run:
1313
name: Build docker image
1414
command: |
1515
docker build -t puckel/docker-airflow .
16-
- run:
16+
- run:
17+
name: Test Python version
18+
command: |
19+
docker run puckel/docker-airflow python -V | grep '3.7'
20+
- run:
1721
name: Test docker image
1822
command: |
19-
docker run puckel/docker-airflow version |grep '1.10.3'
23+
docker run puckel/docker-airflow version |grep '1.10.4'
2024
workflows:
2125
version: 2
2226
build_and_test:

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# VERSION 1.10.3
1+
# VERSION 1.10.4
22
# AUTHOR: Matthieu "Puckel_" Roisil
33
# DESCRIPTION: Basic Airflow container
44
# BUILD: docker build --rm -t puckel/docker-airflow .
55
# SOURCE: https://github.com/puckel/docker-airflow
66

7-
FROM python:3.6-slim-stretch
7+
FROM python:3.7-slim-stretch
88
LABEL maintainer="Puckel_"
99

1010
# Never prompts the user for choices on installation/configuration of packages
1111
ENV DEBIAN_FRONTEND noninteractive
1212
ENV TERM linux
1313

1414
# Airflow
15-
ARG AIRFLOW_VERSION=1.10.3
15+
ARG AIRFLOW_VERSION=1.10.4
1616
ARG AIRFLOW_USER_HOME=/usr/local/airflow
1717
ARG AIRFLOW_DEPS=""
1818
ARG PYTHON_DEPS=""

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ This repository contains **Dockerfile** of [apache-airflow](https://github.com/a
1010

1111
## Informations
1212

13-
* Based on Python (3.6-slim-stretch) official Image [python:3.6-slim-stretch](https://hub.docker.com/_/python/) and uses the official [Postgres](https://hub.docker.com/_/postgres/) as backend and [Redis](https://hub.docker.com/_/redis/) as queue
13+
* Based on Python (3.7-slim-stretch) official Image [python:3.7-slim-stretch](https://hub.docker.com/_/python/) and uses the official [Postgres](https://hub.docker.com/_/postgres/) as backend and [Redis](https://hub.docker.com/_/redis/) as queue
1414
* Install [Docker](https://www.docker.com/)
1515
* Install [Docker Compose](https://docs.docker.com/compose/install/)
1616
* Following the Airflow release from [Python Package Index](https://pypi.python.org/pypi/apache-airflow)

config/airflow.cfg

Lines changed: 61 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,11 @@ fab_logging_level = WARN
2828
logging_config_class =
2929

3030
# Log format
31-
# we need to escape the curly braces by adding an additional curly brace
31+
# Colour the logs when the controlling terminal is a TTY.
32+
colored_console_log = True
33+
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
34+
colored_formatter_class = airflow.utils.log.colored_log.CustomTTYColoredFormatter
35+
3236
log_format = [%%(asctime)s] {{%%(filename)s:%%(lineno)d}} %%(levelname)s - %%(message)s
3337
simple_log_format = %%(asctime)s %%(levelname)s - %%(message)s
3438

@@ -54,16 +58,26 @@ executor = SequentialExecutor
5458
# their website
5559
# sql_alchemy_conn = sqlite:////tmp/airflow.db
5660

57-
# If SqlAlchemy should pool database connections.
58-
sql_alchemy_pool_enabled = True
59-
6061
# The encoding for the databases
6162
sql_engine_encoding = utf-8
6263

64+
# If SqlAlchemy should pool database connections.
65+
sql_alchemy_pool_enabled = True
66+
6367
# The SqlAlchemy pool size is the maximum number of database connections
6468
# in the pool. 0 indicates no limit.
6569
sql_alchemy_pool_size = 5
6670

71+
# The maximum overflow size of the pool.
72+
# When the number of checked-out connections reaches the size set in pool_size,
73+
# additional connections will be returned up to this limit.
74+
# When those additional connections are returned to the pool, they are disconnected and discarded.
75+
# It follows then that the total number of simultaneous connections the pool will allow is pool_size + max_overflow,
76+
# and the total number of "sleeping" connections the pool will allow is pool_size.
77+
# max_overflow can be set to -1 to indicate no overflow limit;
78+
# no limit will be placed on the total number of concurrent connections. Defaults to 10.
79+
sql_alchemy_max_overflow = 10
80+
6781
# The SqlAlchemy pool recycle is the number of seconds a connection
6882
# can be idle in the pool before it is invalidated. This config does
6983
# not apply to sqlite. If the number of DB connections is ever exceeded,
@@ -182,7 +196,7 @@ password =
182196
[operators]
183197
# The default owner assigned to each new operator, unless
184198
# provided explicitly or passed via `default_args`
185-
default_owner = Airflow
199+
default_owner = airflow
186200
default_cpus = 1
187201
default_ram = 512
188202
default_disk = 512
@@ -191,9 +205,6 @@ default_gpus = 0
191205
[hive]
192206
# Default mapreduce queue for HiveOperator tasks
193207
default_hive_mapred_queue =
194-
# Template for mapred_job_name in HiveOperator, supports the following named parameters:
195-
# hostname, dag_id, task_id, execution_date
196-
mapred_job_name_template = Airflow HiveOperator task for {hostname}.{dag_id}.{task_id}.{execution_date}
197208

198209
[webserver]
199210
# The base url of your website as airflow cannot guess what domain or
@@ -301,6 +312,9 @@ cookie_secure = False
301312
# Set samesite policy on session cookie
302313
cookie_samesite =
303314

315+
# Default setting for wrap toggle on DAG code and TI log views.
316+
default_wrap = False
317+
304318
[email]
305319
email_backend = airflow.utils.email.send_email_smtp
306320

@@ -391,6 +405,13 @@ ssl_key =
391405
ssl_cert =
392406
ssl_cacert =
393407

408+
# Celery Pool implementation.
409+
# Choices include: prefork (default), eventlet, gevent or solo.
410+
# See:
411+
# https://docs.celeryproject.org/en/latest/userguide/workers.html#concurrency
412+
# https://docs.celeryproject.org/en/latest/userguide/concurrency/eventlet.html
413+
pool = prefork
414+
394415
[celery_broker_transport_options]
395416
# This section is for specifying options which can be passed to the
396417
# underlying celery broker transport. See:
@@ -505,8 +526,8 @@ basedn = dc=example,dc=com
505526
cacert = /etc/ca/ldap_ca.crt
506527
search_scope = LEVEL
507528

508-
# This setting allows the use of LDAP servers that either return a
509-
# broken schema, or do not return a schema.
529+
# This setting allows the use of LDAP servers that either return a
530+
# broken schema, or do not return a schema.
510531
ignore_malformed_schema = False
511532

512533
[mesos]
@@ -567,10 +588,22 @@ api_rev = v3
567588
hide_sensitive_variable_fields = True
568589

569590
[elasticsearch]
570-
elasticsearch_host =
571-
# we need to escape the curly braces by adding an additional curly brace
572-
elasticsearch_log_id_template = {dag_id}-{task_id}-{execution_date}-{try_number}
573-
elasticsearch_end_of_log_mark = end_of_log
591+
# Elasticsearch host
592+
host =
593+
# Format of the log_id, which is used to query for a given tasks logs
594+
log_id_template = {{dag_id}}-{{task_id}}-{{execution_date}}-{{try_number}}
595+
# Used to mark the end of a log stream for a task
596+
end_of_log_mark = end_of_log
597+
# Qualified URL for an elasticsearch frontend (like Kibana) with a template argument for log_id
598+
# Code will construct log_id using the log_id template from the argument above.
599+
# NOTE: The code will prefix the https:// automatically, don't include that here.
600+
frontend =
601+
# Write the task logs to the stdout of the worker, rather than the default files
602+
write_stdout = False
603+
# Instead of the default log formatter, write the log lines as JSON
604+
json_format = False
605+
# Log fields to also attach to the json output, if enabled
606+
json_fields = asctime, filename, lineno, levelname, message
574607

575608
[kubernetes]
576609
# The repository, tag and imagePullPolicy of the Kubernetes Image for the Worker to Run
@@ -606,7 +639,6 @@ logs_volume_subpath =
606639
# A shared volume claim for the logs
607640
logs_volume_claim =
608641

609-
610642
# For DAGs mounted via a hostPath volume (mutually exclusive with volume claim and git-sync)
611643
# Useful in local environment, discouraged in production
612644
dags_volume_host =
@@ -634,7 +666,7 @@ git_password =
634666
git_sync_root = /git
635667
git_sync_dest = repo
636668
# Mount point of the volume if git-sync is being used.
637-
# i.e. /root/airflow/dags
669+
# i.e. {AIRFLOW_HOME}/dags
638670
git_dags_folder_mount_point =
639671

640672
# To get Git-sync SSH authentication set up follow this format
@@ -705,6 +737,13 @@ affinity =
705737
# https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.12/#toleration-v1-core
706738
tolerations =
707739

740+
# **kwargs parameters to pass while calling a kubernetes client core_v1_api methods from Kubernetes Executor
741+
# provided as a single line formatted JSON dictionary string.
742+
# List of supported params in **kwargs are similar for all core_v1_apis, hence a single config variable for all apis
743+
# See:
744+
# https://raw.githubusercontent.com/kubernetes-client/python/master/kubernetes/client/apis/core_v1_api.py
745+
kube_client_request_args =
746+
708747
# Worker pods security context options
709748
# See:
710749
# https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
@@ -753,3 +792,9 @@ fs_group =
753792
#
754793
# Additionally you may override worker airflow settings with the AIRFLOW__<SECTION>__<KEY>
755794
# formatting as supported by airflow normally.
795+
796+
[kubernetes_labels]
797+
# The Key-value pairs to be given to worker pods.
798+
# The worker pods will be given these static labels, as well as some additional dynamic labels
799+
# to identify the task.
800+
# Should be supplied in the format: key = value

docker-compose-CeleryExecutor.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
version: '2.1'
22
services:
33
redis:
4-
image: 'redis:3.2.7'
4+
image: 'redis:5.0.5'
55
# command: redis-server --requirepass redispass
66

77
postgres:
@@ -16,7 +16,7 @@ services:
1616
# - ./pgdata:/var/lib/postgresql/data/pgdata
1717

1818
webserver:
19-
image: puckel/docker-airflow:1.10.3
19+
image: puckel/docker-airflow:1.10.4
2020
restart: always
2121
depends_on:
2222
- postgres
@@ -43,7 +43,7 @@ services:
4343
retries: 3
4444

4545
flower:
46-
image: puckel/docker-airflow:1.10.3
46+
image: puckel/docker-airflow:1.10.4
4747
restart: always
4848
depends_on:
4949
- redis
@@ -55,7 +55,7 @@ services:
5555
command: flower
5656

5757
scheduler:
58-
image: puckel/docker-airflow:1.10.3
58+
image: puckel/docker-airflow:1.10.4
5959
restart: always
6060
depends_on:
6161
- webserver
@@ -74,7 +74,7 @@ services:
7474
command: scheduler
7575

7676
worker:
77-
image: puckel/docker-airflow:1.10.3
77+
image: puckel/docker-airflow:1.10.4
7878
restart: always
7979
depends_on:
8080
- scheduler

docker-compose-LocalExecutor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ services:
88
- POSTGRES_DB=airflow
99

1010
webserver:
11-
image: puckel/docker-airflow:1.10.3
11+
image: puckel/docker-airflow:1.10.4
1212
restart: always
1313
depends_on:
1414
- postgres

script/entrypoint.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ TRY_LOOP="20"
1313
: "${POSTGRES_DB:="airflow"}"
1414

1515
# Defaults and back-compat
16+
: "${AIRFLOW_HOME:="/usr/local/airflow"}"
1617
: "${AIRFLOW__CORE__FERNET_KEY:=${FERNET_KEY:=$(python -c "from cryptography.fernet import Fernet; FERNET_KEY = Fernet.generate_key().decode(); print(FERNET_KEY)")}}"
1718
: "${AIRFLOW__CORE__EXECUTOR:=${EXECUTOR:-Sequential}Executor}"
1819

1920
export \
21+
AIRFLOW_HOME \
2022
AIRFLOW__CELERY__BROKER_URL \
2123
AIRFLOW__CELERY__RESULT_BACKEND \
2224
AIRFLOW__CORE__EXECUTOR \
@@ -33,7 +35,7 @@ fi
3335

3436
# Install custom python package if requirements.txt is present
3537
if [ -e "/requirements.txt" ]; then
36-
$(which pip) install --user -r /requirements.txt
38+
$(command -v pip) install --user -r /requirements.txt
3739
fi
3840

3941
if [ -n "$REDIS_PASSWORD" ]; then

0 commit comments

Comments
 (0)