Skip to content

Commit

Permalink
dependencies: update celery to version 5
Browse files Browse the repository at this point in the history
Updates celery to version 5 and adapts celery server commands.

* Updates celery command in `server` script.
* Updates celery command in docker deployment file.
* Purges celery tasks in `setup` script.
* Avoids error with `invenio-previewer` by fixing `nbconvert` library to a smaller version than 6.
* Registers celery testing plugins in main `conftest.py` file.
* Closes #331.

Co-Authored-by: Sébastien Délèze <sebastien.deleze@rero.ch>
  • Loading branch information
Sébastien Délèze committed Oct 9, 2020
1 parent 6e26fa7 commit b3d016c
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 196 deletions.
2 changes: 2 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ wand = ">=0.5.0,<0.6.0"
transifex-client = "*"
python-dotenv = "*"
flask-cors = ">3.0.8"
# Avoid an error during invenio-previewer initialization
nbconvert = ">=5.6.1,<6.0.0"

[dev-packages]
Flask-Debugtoolbar = ">=0.10.1"
Expand Down
412 changes: 219 additions & 193 deletions Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docker-compose.full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ services:
file: docker-services.yml
service: app
restart: "always"
command: ["celery worker -A invenio_app.celery --loglevel=INFO"]
command: ["celery --app invenio_app.celery worker --loglevel=INFO"]
image: sonar
links:
- cache
Expand Down
6 changes: 5 additions & 1 deletion pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@

[pytest]
pep8ignore = docs/conf.py ALL
addopts = --pep8 --doctest-glob="*.rst" --doctest-modules --cov=sonar --cov-report=term-missing --ignore=setup.py
; Add pluging for celery fixtures manually. This can be removed when invenio-celery will be on version 1.2.1
addopts = --pep8 --doctest-glob="*.rst" --doctest-modules --cov=sonar --cov-report=term-missing --ignore=setup.py -p celery.contrib.pytest
testpaths = docs tests sonar
; Not displaying all the PendingDeprecationWarnings from invenio
filterwarnings =
ignore::PendingDeprecationWarning
2 changes: 1 addition & 1 deletion scripts/server
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export FLASK_ENV=development

# Start Worker and Server
section "Start celery worker" "info"
celery worker -A invenio_app.celery -l INFO --beat --without-heartbeat & pid_celery=$!
celery --app invenio_app.celery worker --loglevel INFO --beat & pid_celery=$!
message "Done" "success"

# Start web server
Expand Down
4 changes: 4 additions & 0 deletions scripts/setup
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ if $import; then
message "Size of import sets is set to \"$size\"" "info"
fi

# Purge celery
section "Purge celery tasks" "info"
celery --app invenio_app.celery purge -f

# Clean redis
section "Clear redis cache" "info"
invenio shell --no-term-title -c "import redis; redis.StrictRedis.from_url(app.config['CACHE_REDIS_URL']).flushall(); print('Cache cleared')"
Expand Down

0 comments on commit b3d016c

Please sign in to comment.