salt.queues.pgjsonb_queue module

New in version 2016.3.0.

This is a queue with postgres as the backend. It uses the jsonb store to store information for queues.

depends

python-psycopg2

To enable this queue, the following needs to be configured in your master config. These are the defaults:

queue.pgjsonb.host: 'salt'
queue.pgjsonb.user: 'salt'
queue.pgjsonb.password: 'salt'
queue.pgjsonb.dbname: 'salt'
queue.pgjsonb.port: 5432

Use the following Pg database schema:

CREATE DATABASE  salt WITH ENCODING 'utf-8';

--
-- Table structure for table `salt`
--
DROP TABLE IF EXISTS salt;
CREATE OR REPLACE TABLE salt(
   id SERIAL PRIMARY KEY,
   data jsonb NOT NULL
);
salt-run queue.insert test '{"name": "redis", "host": "172.16.0.8", "port": 6379}' backend=pgjsonb
salt-run queue.process_queue test all backend=pgjsonb
salt.queues.pgjsonb_queue.delete(queue, items)

Delete an item or items from a queue

salt.queues.pgjsonb_queue.handle_queue_creation(queue)
salt.queues.pgjsonb_queue.insert(queue, items)

Add an item or items to a queue

salt.queues.pgjsonb_queue.list_items(queue)

List contents of a queue

salt.queues.pgjsonb_queue.list_length(queue)

Provide the number of items in a queue

salt.queues.pgjsonb_queue.list_queues()

Return a list of Salt Queues on the Salt Master

salt.queues.pgjsonb_queue.pop(queue, quantity=1, is_runner=False)

Pop one or more or all items from the queue return them.