Skip to main content

MBQ Atomiq

Project description

https://img.shields.io/pypi/v/mbq.atomiq.svg https://img.shields.io/pypi/l/mbq.atomiq.svg https://img.shields.io/pypi/pyversions/mbq.atomiq.svg https://img.shields.io/travis/managedbyq/mbq.atomiq/master.svg

Installation

$ pip install mbq.atomiq

Getting started

  1. Add mbq.atomiq to INSTALLED_APPS in your django application’s settings

  2. Add ATOMIQ specific settings to that same settings file. Those are used for metrics.

ATOMIQ = {
    'env': CURRENT_ENV,
    'service': YOUR_SERICE_NAME,
}
  1. Set up consumers for each queue type that your app needs. mbq.atomiq provides a handy management command for that:

python -m manage atomic_run_consumer --queue sns

python -m manage atomic_run_consumer --queue sqs

python -m manage atomic_run_consumer --queue celery --celery-app path.to.celery.app

notice that celery consumer requires an additional arg celery-app. This should be a module path to the file that instantializes celery app like so:

celery_app = Celery(NAME)

To make sure we’re not holding on to successfully executed or deleted tasks we also have a clean up management command, that by default will clean up all processed tasks that are older than 30 days. That default can be overriden.

python -m manage atomic_cleanup_old_tasks

or

python -m manage atomic_cleanup_old_tasks --days N

or

python -m manage atomic_cleanup_old_tasks --minutes N
  1. Use it!

import mbq.atomiq

mbq.atomiq.sns_publish(topic_arn, message)

mbq.atomiq.sqs_publish(queue_url, message)

mbq.atomiq.celery_publish(celery_task, *task_args, **task_kwargs)

Monitoring

<https://app.datadoghq.com/dash/895710/atomiq>

Testing

Tests are automatically in Travis CI https://travis-ci.org/managedbyq/mbq.atomiq but you can also run tests locally using docker-compose. We now use tox for local testing across multiple python environments. Before this use pyenv to install the following python interpreters: cpython{2.7, 3.5, 3.6} and pypy3

$ docker-compose up py36|py27|py37|pypy3

Shipping a New Release

  1. Bump the version in __version__.py

  2. Go to Releases in GitHub and “Draft a New Release”

  3. After creating a new release, Travis CI will pick up the new release and ship it to PyPi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mbq.atomiq-0.0.3.tar.gz (15.1 kB view details)

Uploaded Source

File details

Details for the file mbq.atomiq-0.0.3.tar.gz.

File metadata

  • Download URL: mbq.atomiq-0.0.3.tar.gz
  • Upload date:
  • Size: 15.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.6.3

File hashes

Hashes for mbq.atomiq-0.0.3.tar.gz
Algorithm Hash digest
SHA256 d7b791b025da551fb9713d0d6e744a44bcc6a709f7f1b26554e9deed6a08302b
MD5 afe2b9c2778d55a0604b6eed11f870cd
BLAKE2b-256 7bea6ccf40536a97a51a55cb5916b1ab8ff34d3c1480c08348e67e984ad43ac8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page