selinon.executor.queue_pool module

Pool of all queues in the system.

class selinon.executor.queue_pool.QueuePool[source]

Bases: object

Pool of all queues in the system.

get_queue(name)[source]

Get queue wrapper by name of the queue that is wrapped, if does not exist, create one lazily.

Parameters:name – a name of the queue
Returns:queue wrapper for the given queue with requested name
is_empty()[source]

Check pool emptiness.

Returns:True if queue pool does not have any messages and no queues (as queues get deleted when empty)
pop()[source]

Pop a record with the smallest time.

Returns:(time, record) tuple - time of record and record itself (see self.push for more info)
push(queue_name, time, record)[source]

Push record with its time to queue with name queue_name.

Parameters:
  • queue_name – a queue name that should keep record
  • time – time of record (when should be record executed)
  • record – record itself (message with additional information such as task name and its parameters)
queue_exists(name)[source]

Check whether a queue with the given name exists.

Parameters:name – name of queue to be checked if exists
Returns:True if such queue exists in queue pool