Example #1
0
#!/usr/bin/python
import json
from dbmq import Database
db = Database()
db.delete('foo')
Example #2
0
#!/usr/bin/python
from dbmq import Database
db = Database()
print db.set('foo', 'bar')
Example #3
0
#!/usr/bin/python
from dbmq import Database

db = Database()

document = {"foo": "bar", "hello": "world"}

db.create('foo', document)
Example #4
0
#!/usr/bin/python
import time
from dbmq import Database
db = Database()
while True:
    print db.pop('foo')
    time.sleep(1)
Example #5
0
#!/usr/bin/python
from dbmq import Database
db = Database()
print db.set('foo','bar')
Example #6
0
#!/usr/bin/python
import json
from dbmq import Database
db = Database()
print(json.dumps(db.read('foo'),indent=2)
Example #7
0
#!/usr/bin/python
from dbmq import Database
db = Database()

document = {
              "foo":"bar",
              "hello":"world"
            }

db.create('foo',document)
Example #8
0
#!/usr/bin/python


## Imports
import time
import threading
from dbmq import Database


## Setup
daemon = Database(daemonize=True,linger=100)
db     = Database(linger=100)


## Test for running workers
def workersAlive(workers):
  still_alive = False
  for i in workers:
    if i.isAlive():
      still_alive = True
  return(still_alive)


## Worker thread
def worker(id):
  while running:
    print('Worker %s is waiting for work'%(str(id)))
    work = db.pop('work')
    if work:
      print('Worker %s got %s'%(id,work))
      while not db.push('done',work):
Example #9
0
#!/usr/bin/python
from dbmq import Database
db = Database()

document = {"foo": "foobar"}

db.update('foo', document)
Example #10
0
#!/usr/bin/python
import time
from dbmq import Database
db = Database()
while True:
    print db.get('foo')
    time.sleep(1)
Example #11
0
#!/usr/bin/python
from dbmq import Database
db = Database()
for i in range(0,9)
  print db.push('foo',i)
Example #12
0
#!/usr/bin/python
from dbmq import Database
db = Database()

document = {
              "foo":"foobar"
            }

db.update('foo',document)
Example #13
0
#!/usr/bin/python
from dbmq import Database
db = Database(daemonize=True)
Example #14
0
#!/usr/bin/python
import time
from dbmq import Database
db = Database()
while True:
  print db.pop('foo')
  time.sleep(1)