Skip to main content

Pymygdala: Archive messaging for Python

Project description

# Pymygdala

A CAPO aware library and suite of CLIs for interacting with RabbitMQ. This work borrows heavily from python-logging-rabbit, which can be found here:

https://github.com/albertomr86/python-logging-rabbitmq/tree/master/python_logging_rabbitmq

## Requirements

This library depends on pycapo and Pika.

## Usage


### Logging API

This is the minimal use case, where Pymygdala gets connection details from CAPO and relies on the defaults where it can.

log = logging.getLogger(__name__)
log.setlevel(logging.DEBUG)
handler = LogHandler(profile='test', application='test-app',
level=logging.INFO)
log.addHandler(handler)
log.error("there are eels in my hovercraft")

### Logging CLI

pym-sendlog, 0.2.0: a command line tool for logging to RabbitMQ.

optional arguments:
-h, --help show this help message and exit
--profile PROFILE CAPO profile name to use, e.g. test, production
--exchange EXCHANGE exchange name to use, e.g. archive.logs
--type EXCHANGE_TYPE exchange type to use, e.g. fanout
--hostname HOSTNAME server name of the RabbitMQ server
--username USERNAME username of the RabbitMQ server
--password PASSWORD password of the RabbitMQ server
--port PORT port number of the RabbitMQ server
--key ROUTING_KEY routing key, e.g. archive.logs

required arguments:
--level LEVEL logging level, e.g. DEBUG, WARN
--message MESSAGE message to log
--app APPLICATION the application name to log as

### DumpLogs CLI

pym-dumplogs, 0.2.0: connect to a RabbitMQ server and dump out logs.

optional arguments:
-h, --help show this help message and exit
--profile PROFILE CAPO profile name to use, e.g. test, production
--exchange EXCHANGE exchange name to use, e.g. archive.logs
--type EXCHANGE_TYPE exchange type to use, e.g. fanout
--hostname HOSTNAME server name of the RabbitMQ server
--username USERNAME username of the RabbitMQ server
--password PASSWORD password of the RabbitMQ server
--port PORT port number of the RabbitMQ server
--outfile OUTFILE write output to file, - for STDOUT

This is the pym-dumplogs epilog.

### Sending an event, API

message = {'eventName': settings['metadata']['workflow'],
'type': settings['metadata']['type'],
'additionalPaths': [],
'metadata': settings['metadata']}
se = SendEvent(**settings)
se.send(json.dumps(message))

### Sending an event, CLI

This is the pym-sendevent description, 0.2.0

optional arguments:
-h, --help show this help message and exit
--profile PROFILE CAPO profile name to use, e.g. test, production
--exchange EXCHANGE exchange name to use, e.g. archive.logs
--type EXCHANGE_TYPE exchange type to use, e.g. fanout
--hostname HOSTNAME server name of the RabbitMQ server
--username USERNAME username of the RabbitMQ server
--password PASSWORD password of the RabbitMQ server
--port PORT port number of the RabbitMQ server
--key ROUTING_KEY routing key, e.g. archive.logs
--metadata METADATA provide a KEY=VALUE pair to be passed to RabbitMQ; can be used multiple times

This is the pym-sendevent epilog.

0.2.2 2017-07-17 Fix to tone down timestamp's fractional seconds to something reasonable
0.2.1 2017-07-10 Quick bugfix on SendNRAOEvent
0.2.0 2017-07-06 Major refactor, added pym-dumplogs, pym-sendlog, pym-sendevent CLI apps, docs and more goodness
0.1.1 2017-06-28 Packaging fixes, first pypi release
0.0.1 2017-01-31 Initial release plus logging

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

pymygdala-0.2.2.tar.gz (1.7 MB view details)

Uploaded Source

Built Distribution

pymygdala-0.2.2-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

Details for the file pymygdala-0.2.2.tar.gz.

File metadata

  • Download URL: pymygdala-0.2.2.tar.gz
  • Upload date:
  • Size: 1.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pymygdala-0.2.2.tar.gz
Algorithm Hash digest
SHA256 d0841896da88ea3fe1e3d329d40e27b656b0b1d39dfafb10cc4a92ba8d6afc8b
MD5 5fa36c8be6581f065219fd5cd67b4739
BLAKE2b-256 14954c4469147d7b6cb0ce8e2c0ab6f620631d04c66e0b9077dafc02bc18dec0

See more details on using hashes here.

File details

Details for the file pymygdala-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for pymygdala-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 31613b79f0cc85ae9609a6923a9ef41925f05f035c646b1532bd8613ec7a4f12
MD5 995c45b55b2fdd50080359d98d3460ae
BLAKE2b-256 dbc164fe2a6f037ba17931c2391facc82945a8021ff27748630874016dae64fe

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