Package: datanommer
This is datanommer.  It is comprised of only afedmsgconsumer that stuffs every message in a
sqlalchemy database.There are also a handful of CLI tools to dump information from the database.Build StatusBranchStatusmasterdevelopTry it outUsing a virtualenvUsing a virtual environment is highly recommended, although this is not a must. Using virtualenvwrapper can isolate your development environment. You will be able to work on the latest datanommer from git checkout without messing the installed datanommer copy in your system.Install virtualenvwrapper by:$ sudo yum install python-virtualenvwrapperNote:If you decide not to use python-virtualenvwrapper, you can always use latest update of fedmsg and datanommer in fedora. If you are doing this, simply ignore all mkvirtualenv and workon commands in these instructions. You can install fedmsg withsudo yum install fedmsg, and datanommer withsudo yum install datanommer.Development dependenciesGet:$ sudo yum install python-virtualenv openssl-devel zeromq-devel gccNote:If submitting patches, you should checkContributingfor style guidelines.Set up virtualenvCreate a new, empty virtualenv and install all the dependencies from pypi:$ mkvirtualenv datanommer
(datanommer)$ cdvirtualenvNote:If the mkvirtualenv command is unavailable trysource /usr/bin/virtualenvwrapper.shon Fedora (if you do not run Fedora you might have to adjust the command a little).  You can also add this command to your~/.bashrcfile to have it run automatically for you.Cloning upstream the git repo¶The source code is on github.Get fedmsg:(datanommer)$ git clone https://github.com/ralphbean/fedmsg.gitGet datanommer:(datanommer)$ git clone https://github.com/ralphbean/datanommer.gitSet up fedmsg:(datanommer)$ cd fedmsgFor development, avoid editing master branch. Checkout develop branch:(datanommer)$ git checkout develop
(datanommer)$ python setup.py developSwitch to datanommer:(datanommer)$ cd ../datanommerPlease note that you should set up the three packages in the following sequence: “datanommer.models”, “datanommer.commands” and “datanommer.consumer”. Go to the three subfolders in sequence and type:(datanommer)$ git checkout develop
(datanommer)$ python setup.py developCreate datanommer db:(datanommer)$ datanommer-create-dbTry out datanommerOpen three terminals to try out the commands. In each of them, activate your virtualenv with:$ workon datanommerIn one terminal, type:(datanommer)$ fedmsg-relayIn another, type:(datanommer)$ fedmsg-hubIn a third, emit a message, which gets picked up by the relay, rebroadcasted, consumed by datanommer, and inserted into datanommer.db:(datanommer)$ echo "this is a test" | fedmsg-loggerTry the commands. Was the message stored?:(datanommer)$ datanommer-statsLoggerMessage should have entries.:(datanommer)$ datanommer-dumpInspect the database:(datanommer)$ sqlite3 datanommer.db
> select* from messages;You should see a line similar to:1|1|org.fedoraproject.dev.logger.log|2012-11-30 23:33:12.077429|||{"log": "this is a test"}Migration with AlembicWhen the database models are changed, we use alembic to retain the data. Alembic is located in the models:(datanommer)$ cd datanommer.modelsTo check the current models version:(datanommer)$ alembic currentIf your models are up to date, you should see:INFO  [alembic.migration] Context impl SQLiteImpl.
INFO  [alembic.migration] Will assume transactional DDL.
Current revision for sqlite:///../datanommer.db: 198447250956 -> ae2801c4cd9 (head), add category columnIf you result is:INFO  [alembic.migration] Context impl SQLiteImpl.
INFO  [alembic.migration] Will assume transactional DDL.
Current revision for sqlite:///../datanommer.db: Nonethen migrate to the most recent version with:(datanommer)$ alembic upgrade headYou should see:INFO  [alembic.migration] Context impl SQLiteImpl.
INFO  [alembic.migration] Will assume transactional DDL.
INFO  [alembic.migration] Running upgrade None -> 198447250956
INFO  [alembic.migration] Running upgrade 198447250956 -> ae2801c4cd9