kopia lustrzana https://github.com/glidernet/ogn-python
![]() Fix dependencies; add pep8 check; move gateway to a separate file. |
||
---|---|---|
alembic | ||
ogn | ||
tests | ||
.gitignore | ||
.travis.yml | ||
CONTRIBUTORS | ||
LICENSE | ||
README.md | ||
alembic.ini | ||
manage.py | ||
requirements.txt |
README.md
ogn-python
[]
(https://travis-ci.org/glidernet/ogn-python)
[
]
(https://coveralls.io/r/glidernet/ogn-python)
A python module for the Open Glider Network. The submodule 'ogn.gateway' is an aprs client, saving all received beacons into a database with SQLAlchemy. Other submodules process this data.
To schedule tasks like fetching ddb data, Celery with Redis is used.
Installation and Setup
- Install python requirements
pip install -r requirements.txt
- Install redis for asynchronous tasks ('ogn.collect.*')
$ apt-get install redis-server
- Create database
$ ./manage.py db.init
$ alembic stamp head
Running the aprs client and task server
This scripts run in the foreground and should be deamonized (eg. use supervisord).
# start aprs client
$ ./manage.py gateway.run
# start task server (make sure redis is up and running)
$ celery -A ogn.collect worker -l info
manage.py - CLI options
usage: manage.py [<namespace>.]<command> [<args>]
positional arguments:
command the command to run
optional arguments:
-h, --help show this help message and exit
available commands:
[db]
init Initialize the database.
update_ddb_file Update devices with data from local file.
update_ddb_ogn Update devices with data from ogn.
[gateway]
run Run the aprs client.
[logbook]
compute Compute takeoffs and landings.
show Show a logbook for <airport_name> located at given position.
[show.receiver]
hardware_stats Show some statistics of receiver hardware.
list_all Show a list of all receivers.
software_stats Show some statistics of receiver software.
The task server must be running for db.updateddb
.
TODO
- Write celery backend and add task 'fetchddb'
- Rewrite manage.py with https://github.com/Birdback/manage.py or flask-script
- Rename existing cli commands
- Document/Improve cli commands
- Separate settings from module (currently at ogn/command/dbutils.py)
- Enable granular data acquisition (eg. store receiver beacons only)
- Future Database-Migrations: Use Alembic?
- Rename 'Flarm' to 'Device'?
- Rename self.heared_aircraft_IDs (lowercase) in aircraft_beacon
- Rename self.heared_aircraft_IDs
- Fix command/logbook.py (@Meisterschueler?)
- Introduce scheduled tasks with 'celery beat' (eg. updateddb)
Scheduled tasks
- ogn.collect.fetchddb (generate Flarm table)
- ogn.collect.receiver (generate Receiver table)
- ogn.collect.logbook (generate TakeoffLanding table)
How to use virtualenv
$ sudo apt-get install python-virtualenv
$ virtualenv env
$ source env/bin/activate