Skip to main content

Elastic queue based on filesystem.

Project description

python FsQueue is a elastic synchronized queue class.

Source code

You can find here https://github.com/masahif/python-FsQueue

Features

The FsQueue module has almost same as python’s queue class.

  • FsQueue is elastic.

  • FsQueue is multi process safe. Multi process can work with FsQueue.

  • FsQueue doesn’t have max size feature so full() always return False.

  • FsQueue might work as FIFO queue.

A quick example

example:

import sys
from multiprocessing import Process
from FsQueue import Queue
from time import sleep

def put(q, num):
    for i in xrange(num):
        print "put:%d" % i
        sys.stdout.flush()
        q.put(i)

def get(q, num):
    for i in xrange(num):
        sys.stdout.flush()
        print "get:%d %d" % (i, q.get())
        q.task_done()

def process_test():
    q = Queue(init=True)
    p0 = Process(target=put, args=(q,1000))
    p0.start()
    p0.join()
    p1 = Process(target=get, args=(q,500))
    p2 = Process(target=get, args=(q,500))
    p1.start()
    p2.start()
    p1.join()
    p2.join()

    if not q.empty():
        print "Queue should be empty."
        raise Exception

if __name__ == '__main__':
    process_test()

Recent Change Log

v1.2

  • A quick example was changed.

v1.1

  • First release

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

FsQueue-1.2.tar.gz (5.1 kB view details)

Uploaded Source

File details

Details for the file FsQueue-1.2.tar.gz.

File metadata

  • Download URL: FsQueue-1.2.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for FsQueue-1.2.tar.gz
Algorithm Hash digest
SHA256 3e4c00d6edfda144ff3015a25b47e5a6cb613d02148cdaf48241f9a26e880615
MD5 9e51c3a6a6aacd8ba6c82362d2acf89d
BLAKE2b-256 774e68438e2fb9521729b86ffd72be71f3e08b1ab4dd89adb40bc9810acff2da

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