Skip to main content

Kamikaze

https://badge.fury.io/py/kamikaze.png https://travis-ci.org/brendanmaguire/kamikaze.png?branch=master

A service for placing prioritised packages with expiry times on a queue and having a consumer notified of the packages

How it works

This service monitors a Redis sorted set and calls a consumer function when a new package arrives or the current highest priority package expires. The consumer function can be a regular Python function or an asyncio coroutine.

How to install

pip install kamikaze

The consumer function

The consumer function is the function that is called when a new message comes to the top of the queue. The function should be of the format:

def consumer_function(package, *args):
    """
    Does stuff with packages and optional args passed from the command line
    """

Long running consumer functions

If the consumer function is long running then it should yield control of the loop when possible. Otherwise the kamikaze service will be slow to react to changes in the queue.

Fast running consumer function

If the consumer function is fast then there will be no need to yield control to the main loop until it is complete.

Running the service

Start the service by running the following:

kamikaze service <consumer-function-path> --consumer-function-args

The consumer function should be the full path to the python coroutine. It must be in your $PYTHONPATH.

Give the --help flag for a full list of options.

Tools

Pushing a Package

Use the push command to add a package to the queue:

kamikaze push <payload> <ttl> <priority>

Removing a Package

Use the remove command to remove a package from the queue:

kamikaze remove <payload>

List Packages on Queue

Use the list command to list all packages on the queue:

kamikaze list

Running the examples

Yielding example

An example of a yielding function can be run like so:

kamikaze service example_consumer.consumer.yielding_consumer_func

Blocking example

An example of a blocking function can be run like so:

kamikaze service example_consumer.consumer.blocking_consumer_func

Metadata

Release files for kamikaze 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kamikaze 0.1.1
File Size Uploaded Provenance
kamikaze-0.1.1.tar.gz 9.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for kamikaze 0.1.1
File Interpreter ABI Platform
kamikaze-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 17.8 kB

Release files / kamikaze-0.1.1.tar.gz

Download URL kamikaze-0.1.1.tar.gz
Size 9.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b8d4be4dfb48fcde14a3fe275bfa6324a7e729c76991cf028ef91943ce3e00a2
BLAKE2b-256 checksum
How to use checksums
331c39afb4a7bd73d6d04192a6d6ab892cacec4c09dc2355cd1b6da1700ec910
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / kamikaze-0.1.1-py3-none-any.whl

Download URL kamikaze-0.1.1-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f2c7b73a13cab1fd12c7753bb770c6a3fa0d1c6ebd461000811571ef177bdecc
BLAKE2b-256 checksum
How to use checksums
8c1c91073a49b70f9a50d891572de962a825b54fa7adbee8b103c7ea85229c2d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for kamikaze 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page