Skip to content

Commit

Permalink
makefile: bugfix for syntax error (unterminated quoted string)
Browse files Browse the repository at this point in the history
  • Loading branch information
hklarner authored and m4ra committed Sep 28, 2023
1 parent 37f21d1 commit 92b0ff1
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ help:
@echo " make postgres-stop -- stops the local postgres cluster"
@echo " make postgres-create -- create the local postgres cluster (only works on ubuntu 20.04)"
@echo " make local-a4 -- patch to use local a4 (needs to have path ../adhocracy4)"
@echo " make celery-worker-start -- starts the celery worker in the foreground
@echo " make celery-worker-status -- lists all registered tasks and active worker nodes
@echo " make celery-worker-dummy-task -- calls the dummy task and prints result from redis
@echo " make celery-worker-start -- starts the celery worker in the foreground"
@echo " make celery-worker-status -- lists all registered tasks and active worker nodes"
@echo " make celery-worker-dummy-task -- calls the dummy task and prints result from redis"
@echo

.PHONY: install
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ adhocracy+ is designed to make online participation easy and accessible to every
* nodejs (+ npm)
* python 3.x (+ venv + pip)
* libpq (only if postgres should be used)
* redis (only if celery is used)
* redis (in production, not needed for development)

### Installation

Expand Down
2 changes: 1 addition & 1 deletion adhocracy-plus/config/settings/dev.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

CELERY_TASK_ALWAYS_EAGER = True

# The local.py import happen at the end of this file so that it can overwrite
# The local.py import happens at the end of this file so that it can overwrite
# any defaults in dev.py.
# Special cases are:
# 1) ADDITIONAL_APPS in local.py should be appended to INSTALLED_APPS.
Expand Down
6 changes: 4 additions & 2 deletions docs/celery.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@

## Background

We want to upgrade Django from the current version to at least 4. But our current approach to running background tasks, namely `django-background-tasks` is no longer supported in Django 4. Hence, we decided to switch to celery for distributed tasks.


## Developer Notes

### configuration

The celery configuration file is `adhocracy-plus/config/celery.py`.

Currently, we make use of the following config parameters:

- `broker_url = "redis://localhost:6379"`
- `result_backend = "redis"`
- `broker_connection_retry_on_startup = True`
Expand All @@ -19,10 +18,13 @@ Currently, we make use of the following config parameters:
The celery app is configured from the django settings file and namespaced variables. The defaults are defined in `config/settings/base.py` but can be overriden by `config/settings/local.py`.

Note that the default settings in`dev.py` enable the "always eager mode" (`CELERY_TASK_ALWAYS_EAGER = True`) in which the django server will run the shared tasks itself. This is to keep the development setup as lightweight as possible. If you want to develop or test using a celery worker make sure that you add the following to your `local.py`:

```
CELERY_TASK_ALWAYS_EAGER = False
```

and install and run the redis server on your system.

### tasks

Celery is set up to autodiscover tasks. To register a task import the shared task decorator from celery and apply it to your task function.
Expand Down
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ whitenoise==6.4.0
xmltodict==0.13.0
zeep==4.2.1
urllib3==2.0.3
redis==5.0.0

# Inherited a4-core requirements
Django==3.2.19
Expand All @@ -27,4 +28,3 @@ jsonfield==3.1.0
python-dateutil==2.8.2
rules==3.3
celery==5.3.1
redis==5.0.0

0 comments on commit 92b0ff1

Please sign in to comment.