Skip to main content

Turn is a distributed resource locking queue system using python and redis.

Project description

Turn

Introduction

Turn is a distributed resource locking queue system using python and redis. With it a process thread can request a lock on a shared resource and wait for green light to do its work safely.

Turn comes with a number of tools for inspection of the queues or the pubsub system for one or more resources.

Installation

::

$ pip install turn

Usage

Basic usage goes like this:

import turn
server = turn.Server()

resource = 'my_valuable_resource'
label = 'This shows up in status reports and messages.'

with server.lock(resource=resource, label=label):
    pass  # do your careful work on the resource here

Inspection can be done using the console script:

$ turn status my_valuable_resource
my_valuable_resource                                       5
------------------------------------------------------------
This shows up in status reports and messages.              5
$ turn follow my_valuable_resource
my_valuable_resource: 5 drawn by "This shows up in status reports and messages."
my_valuable_resource: 5 starts
my_valuable_resource: 5 completed by "This shows up in status reports and messages."
my_valuable_resource: 6 can start now

Credits

  • Arjan Verkerk started this library

Changelog of turn

0.1.1 (2015-04-23)

  • U can use pip now.

0.1 (2015-04-23)

  • Initial project structure created with nensskel 1.36.dev0.

  • First working version.

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

turn-0.1.1.tar.gz (18.9 kB view details)

Uploaded Source

File details

Details for the file turn-0.1.1.tar.gz.

File metadata

  • Download URL: turn-0.1.1.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for turn-0.1.1.tar.gz
Algorithm Hash digest
SHA256 89dadf3102d70a01eedb8580f2b821f9e21108a140fecac42e2c8002219cf7b6
MD5 ba2f71c85afbe06bbb92eae05b57ceba
BLAKE2b-256 360f8f3ffb9e48a730a1b7145e1a40873f8b4dc8024c80af8ea61f3289f99a20

See more details on using hashes here.

Supported by

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