Fix celery task runner and task import
parent
78128d4282
commit
04f3cb3045
1
.env
1
.env
|
@ -1,3 +1,4 @@
|
|||
DATABASE_URL="postgresql://localhost"
|
||||
REDIS_URL=redis://localhost:6379
|
||||
CELERY_TASK_SERIALIZER=json
|
||||
DEBUG=True
|
||||
|
|
2
Procfile
2
Procfile
|
@ -1,3 +1,3 @@
|
|||
release: ./release-tasks.sh
|
||||
web: gunicorn app.core:app -w 4 --preload
|
||||
worker: celery -A app.celery_builder.celery worker
|
||||
worker: celery -A app.celery_builder.task_builder worker
|
||||
|
|
|
@ -7,3 +7,4 @@ app.config.from_object('config')
|
|||
app.config.from_pyfile('config.py', silent=True)
|
||||
app.config['MQTT_CLIENT_ID'] = 'final-iot-backend-server-worker'
|
||||
task_builder = make_celery(app)
|
||||
task_builder.autodiscover_tasks(['app.devices'])
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import sys
|
||||
from app.celery_builder import task_builder
|
||||
from .blueprint import devices_bp
|
||||
from flask import current_app as app
|
||||
|
||||
|
||||
@task_builder.task()
|
||||
def send_config(device_id, config):
|
||||
from flask_mqtt import Mqtt, MQTT_ERR_SUCCESS
|
||||
mqtt = Mqtt(devices_bp)
|
||||
mqtt = Mqtt(app)
|
||||
|
||||
@mqtt.on_log()
|
||||
def handle_logging(client, userdata, level, buf):
|
||||
|
|
Loading…
Reference in New Issue