Skip to content

Commit b0c372f

Browse files
authored
Merge pull request #259 from raphaelrpl/patch-1.0
🐛 Fix bug related jinja2 dependency (close #258) and 💡 remove warnings celery 5.x
2 parents cef77dd + 90cd352 commit b0c372f

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

cube_builder/celery/__init__.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,20 @@ def create_celery_app(flask_app: Flask) -> Celery:
5757
celery.autodiscover_tasks(CELERY_TASKS)
5858

5959
# Set same config of Flask into Celery flask_app
60-
celery.conf.update(flask_app.config)
60+
flask_conf = {
61+
key: value for key, value in flask_app.config.items()
62+
# Disable the following patterns for env vars due deprecation in celery 5.x+
63+
if not key.startswith('CELERY_') and not key.startswith('CELERYD_')
64+
}
65+
66+
celery.conf.update(flask_conf)
6167

6268
always_eager = flask_app.config.get('TESTING', False)
6369
celery.conf.update(dict(
64-
CELERY_ACKS_LATE=to_bool(os.getenv('CELERY_ACKS_LATE', '1')),
65-
CELERY_TASK_ALWAYS_EAGER=always_eager,
66-
CELERYD_PREFETCH_MULTIPLIER=Config.CELERYD_PREFETCH_MULTIPLIER,
67-
CELERY_RESULT_BACKEND='db+{}'.format(flask_app.config.get('SQLALCHEMY_DATABASE_URI')),
70+
task_acks_late=to_bool(os.getenv('CELERY_ACKS_LATE', '1')),
71+
task_always_eager=always_eager,
72+
worker_prefetch_multiplier=Config.CELERYD_PREFETCH_MULTIPLIER,
73+
result_backend='db+{}'.format(flask_app.config.get('SQLALCHEMY_DATABASE_URI')),
6874
))
6975

7076
TaskBase = celery.Task

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
'bdc-auth-client @ git+https://github.com/brazil-data-cube/bdc-auth-client.git@v0.4.3#egg=bdc-auth-client',
6565
'bdc-catalog @ git+https://github.com/brazil-data-cube/bdc-catalog.git@v1.0.1#egg=bdc-catalog',
6666
'celery>=5.2', # For PEP517
67-
'Flask>=1.1.1,<2',
67+
# Remove Flask 2.3 limitation due warnings related dependencies (flask-redoc)
68+
"Flask>=1.1.1,<2.3",
6869
'flask-redoc>=0.2.1',
6970
'marshmallow-sqlalchemy>=0.19.0,<0.25',
7071
'numpy>=1.17.2',
@@ -77,7 +78,6 @@
7778
'rio_cogeo==3.0.2',
7879
'shapely>=1.7,<2',
7980
'SQLAlchemy-Utils>=0.34.2,<1',
80-
'MarkupSafe==2.0.1',
8181
]
8282

8383
packages = find_packages()

0 commit comments

Comments
 (0)