diff --git a/README.md b/README.md index 7248912..c302bbb 100644 --- a/README.md +++ b/README.md @@ -81,18 +81,25 @@ To schedule tasks like takeoff/landing-detection (`logbook.compute`), The following scripts run in the foreground and should be deamonized (eg. use [supervisord](http://supervisord.org/)). -- start aprs client +- Start the aprs client ``` ./manage.py gateway.run ``` -- start task server (make sure redis is up and running) +- Start a task server (make sure redis is up and running) ``` celery -A ogn.collect worker -l info ``` +- Start the task scheduler (make sure a task server is up and running) + + ``` + celery -A ogn.collect beat -l info + ``` + + To load a custom configuration, create a file `myconfig.py` (see [config/default.py](config/default.py)) and set the environment variable `OGN_CONFIG_MODULE` accordingly. @@ -138,7 +145,7 @@ available commands: Only the command `logbook.compute` requires a running task server (celery) at the moment. -### Scheduled tasks +### Available tasks - ogn.collect.database - `import_ddb` - Import registered devices from the ddb - `import_file` - Import registered devices from a local file diff --git a/config/default.py b/config/default.py index d9ce11a..f78c931 100644 --- a/config/default.py +++ b/config/default.py @@ -2,3 +2,15 @@ SQLALCHEMY_DATABASE_URI = 'sqlite:///beacons.db' BROKER_URL = 'redis://localhost:6379/0' CELERY_RESULT_BACKEND = 'redis://localhost:6379/0' + + +from datetime import timedelta + +CELERYBEAT_SCHEDULE = { + 'update-receiver-distance': { + 'task': 'ogn.collect.heatmap.update_beacon_receiver_distance_all', + 'schedule': timedelta(minutes=5), + }, +} + +CELERY_TIMEZONE = 'UTC' diff --git a/ogn/gateway/manage.py b/ogn/gateway/manage.py index 7820edf..b4804da 100644 --- a/ogn/gateway/manage.py +++ b/ogn/gateway/manage.py @@ -2,7 +2,6 @@ import logging from ogn.gateway.client import ognGateway from ogn.commands.dbutils import session -from ogn.collect.heatmap import update_beacon_receiver_distance from manager import Manager @@ -35,8 +34,6 @@ def run(aprs_user='anon-dev', logfile='main.log', loglevel='INFO'): gateway.connect() def process_beacon(beacon): - if isinstance(beacon, ReceiverBeacon): - update_beacon_receiver_distance(beacon.name) session.add(beacon) session.commit()