ogn-python/README.md

112 wiersze
3.3 KiB
Markdown
Czysty Zwykły widok Historia

2015-11-15 07:56:36 +00:00
# ogn-python
2015-10-24 21:13:21 +00:00
[![Build Status](https://travis-ci.org/glidernet/ogn-python.svg?branch=master)]
(https://travis-ci.org/glidernet/ogn-python)
[![Coverage Status](https://img.shields.io/coveralls/glidernet/ogn-python.svg)]
(https://coveralls.io/r/glidernet/ogn-python)
2015-11-15 08:26:09 +00:00
A python module for the [Open Glider Network](http://wiki.glidernet.org/).
The submodule 'ogn.gateway' is an aprs client, saving all received beacons
into a database with [SQLAlchemy](http://www.sqlalchemy.org/).
Other submodules process this data.
To schedule tasks like fetching ddb data,
[Celery](http://www.celeryproject.org/) with [Redis](http://www.redis.io/) is used.
## Installation and Setup
1. Install python requirements
```
pip install -r requirements.txt
```
2015-11-15 08:26:09 +00:00
2. Install redis for asynchronous tasks ('ogn.collect.\*')
```
apt-get install redis-server
```
2015-11-15 08:26:09 +00:00
3. Create database
```
./manage.py db.init
alembic stamp head
```
2015-11-15 08:26:09 +00:00
## Running the aprs client and task server
This scripts run in the foreground and should be deamonized
(eg. use [supervisord](http://supervisord.org/)).
```
# 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]
import_ddb Import registered devices from the DDB.
import_file Import registered devices from local file.
2015-11-15 08:26:09 +00:00
init Initialize the database.
2015-11-15 08:26:09 +00:00
[gateway]
run Run the aprs client.
2015-11-15 08:26:09 +00:00
[logbook]
2015-11-26 07:35:41 +00:00
compute Compute takeoffs and landings.
2015-11-15 08:26:09 +00:00
show Show a logbook for <airport_name> located at given position.
[show.devices]
stats Show some stats on registered devices.
2015-11-15 08:26:09 +00:00
[show.receiver]
hardware_stats Show some statistics of receiver hardware.
2015-11-15 11:13:56 +00:00
list_all Show a list of all receivers.
software_stats Show some statistics of receiver software.
2015-11-15 08:26:09 +00:00
```
Only the command `logbook.compute` requires a running task server (celery) at the moment.
2015-11-15 08:26:09 +00:00
## TODO
- [x] Write celery backend and add task 'fetchddb'
- [x] Rewrite manage.py with <https://github.com/Birdback/manage.py> or flask-script
- [x] Rename existing cli commands
- [x] Document/Improve cli commands
- [ ] Separate settings from module (currently at ogn/command/dbutils.py)
- [ ] Enable granular data acquisition (eg. store receiver beacons only)
2015-11-26 07:35:41 +00:00
- [x] Future Database-Migrations: Use Alembic?
- [x] Rename 'Flarm' to 'Device'?
2015-11-27 20:29:00 +00:00
- [x] Rename self.heared\_aircraft\_IDs (lowercase) in aircraft\_beacon
- [x] Rename self.heared\_aircraft\_IDs
2015-11-26 07:35:41 +00:00
- [x] Fix command/logbook.py (@Meisterschueler?)
2015-11-15 08:26:09 +00:00
- [ ] Introduce scheduled tasks with 'celery beat' (eg. updateddb)
### Scheduled tasks
- ogn.collect.database
- import_ddb - Import registered devices from the ddb
- import_file - Import registered devices from a local file
- ogn.collect.receiver
- populate - generate Receiver table (not implemented)
- ogn.collect.logbook
- compute - generate TakeoffLanding table
2015-11-15 08:26:09 +00:00
## How to use virtualenv
```
$ sudo apt-get install python-virtualenv
$ virtualenv env
$ source env/bin/activate