Source code:Lib/queue.py
- Search for 'printers and scanners' in the search box on the taskbar, then select it from the results. Select your printer and then select Open queue.
- A queue is (1) a line of people waiting for something, and (2) a hair braid worn down the back of the neck. As a verb, queue means get in line or place in line. Both these homophones are often used with up—cue up meaning prepare something to start on cue, and queue up meaning get in line.
- ‘The scripts, which control the call flow, will queue the call to a list of queues at the same time.’ ‘The wait queue is a list of processes blocking on the semaphore.’ ‘The Replay queue unloading controller releases the commands for both queues hoping that they will be executed successfully.’.
The queue
module implements multi-producer, multi-consumer queues.It is especially useful in threaded programming when information must beexchanged safely between multiple threads. The Queue
class in thismodule implements all the required locking semantics.
The module implements three types of queue, which differ only in the order inwhich the entries are retrieved. In a FIFOqueue, the first tasks added are the first retrieved. In aLIFO queue, the most recently added entry isthe first retrieved (operating like a stack). With a priority queue,the entries are kept sorted (using the heapq
module) and thelowest valued entry is retrieved first.
Queue it's a cloud-based system that allows business to handle customer queues smartly and speedily. With queue you can estimate how much time your clients will have to wait before receive service. Queue app allows business to handle customer queues smartly and speedily. Allow your customers to take turn remotely using their phones.
Internally, those three types of queues use locks to temporarily blockcompeting threads; however, they are not designed to handle reentrancywithin a thread.
In addition, the module implements a “simple”FIFO queue type, SimpleQueue
, whosespecific implementation provides additional guaranteesin exchange for the smaller functionality.
The queue
module defines the following classes and exceptions:
queue.
Queue
(maxsize=0)¶Constructor for a FIFO queue. maxsize isan integer that sets the upperboundlimit on the number of items that can be placed in the queue. Insertion willblock once this size has been reached, until queue items are consumed. Ifmaxsize is less than or equal to zero, the queue size is infinite.
queue.
LifoQueue
(maxsize=0)¶Constructor for a LIFO queue. maxsize isan integer that sets the upperboundlimit on the number of items that can be placed in the queue. Insertion willblock once this size has been reached, until queue items are consumed. Ifmaxsize is less than or equal to zero, the queue size is infinite.
queue.
PriorityQueue
(maxsize=0)¶Constructor for a priority queue. maxsize is an integer that sets the upperboundlimit on the number of items that can be placed in the queue. Insertion willblock once this size has been reached, until queue items are consumed. Ifmaxsize is less than or equal to zero, the queue size is infinite.
The lowest valued entries are retrieved first (the lowest valued entry is theone returned by sorted(list(entries))[0]
). A typical pattern for entriesis a tuple in the form: (priority_number,data)
.
If the data elements are not comparable, the data can be wrapped in a classthat ignores the data item and only compares the priority number:
queue.
SimpleQueue
¶Constructor for an unbounded FIFO queue.Simple queues lack advanced functionality such as task tracking.
New in version 3.7.
queue.
Empty
¶Exception raised when non-blocking get()
(orget_nowait()
) is calledon a Queue
object which is empty.
queue.
Full
¶Exception raised when non-blocking put()
(orput_nowait()
) is calledon a Queue
object which is full.
Queue Objects¶
Queue objects (Queue
, LifoQueue
, or PriorityQueue
)provide the public methods described below.
Queue.
qsize
()¶Return the approximate size of the queue. Note, qsize() > 0 doesn’tguarantee that a subsequent get() will not block, nor will qsize() < maxsizeguarantee that put() will not block.
Queue.
empty
()¶Return True
if the queue is empty, False
otherwise. If empty()returns True
it doesn’t guarantee that a subsequent call to put()will not block. Similarly, if empty() returns False
it doesn’tguarantee that a subsequent call to get() will not block.
Queue.
full
()¶Return True
if the queue is full, False
otherwise. If full()returns True
it doesn’t guarantee that a subsequent call to get()will not block. Similarly, if full() returns False
it doesn’tguarantee that a subsequent call to put() will not block.
Queue.
put
(item, block=True, timeout=None)¶Put item into the queue. If optional args block is true and timeout isNone
(the default), block if necessary until a free slot is available. Iftimeout is a positive number, it blocks at most timeout seconds and raisesthe Full
exception if no free slot was available within that time.Otherwise (block is false), put an item on the queue if a free slot isimmediately available, else raise the Full
exception (timeout isignored in that case).
Queue.
put_nowait
(item)¶Equivalent to put(item,False)
.
Queue.
get
(block=True, timeout=None)¶Remove and return an item from the queue. If optional args block is true andtimeout is None
(the default), block if necessary until an item is available.If timeout is a positive number, it blocks at most timeout seconds andraises the Empty
exception if no item was available within that time.Otherwise (block is false), return an item if one is immediately available,else raise the Empty
exception (timeout is ignored in that case).
Prior to 3.0 on POSIX systems, and for all versions on Windows, ifblock is true and timeout is None
, this operation goes intoan uninterruptible wait on an underlying lock. This means that no exceptionscan occur, and in particular a SIGINT will not trigger a KeyboardInterrupt
.
Queue Crossword
Queue.
get_nowait
()¶Equivalent to get(False)
.
Two methods are offered to support tracking whether enqueued tasks have beenfully processed by daemon consumer threads.
Queue.
task_done
()¶Indicate that a formerly enqueued task is complete. Used by queue consumerthreads. For each get()
used to fetch a task, a subsequent call totask_done()
tells the queue that the processing on the task is complete.
If a join()
is currently blocking, it will resume when all items have beenprocessed (meaning that a task_done()
call was received for every itemthat had been put()
into the queue).
Raises a ValueError
if called more times than there were items placed inthe queue.
Queue.
join
()¶Blocks until all items in the queue have been gotten and processed.
The count of unfinished tasks goes up whenever an item is added to the queue.The count goes down whenever a consumer thread calls task_done()
toindicate that the item was retrieved and all work on it is complete. When thecount of unfinished tasks drops to zero, join()
unblocks.
Example of how to wait for enqueued tasks to be completed:
SimpleQueue Objects¶
SimpleQueue
objects provide the public methods described below.
SimpleQueue.
qsize
()¶Return the approximate size of the queue. Note, qsize() > 0 doesn’tguarantee that a subsequent get() will not block.
SimpleQueue.
empty
()¶Return True
if the queue is empty, False
otherwise. If empty()returns False
it doesn’t guarantee that a subsequent call to get()will not block.
SimpleQueue.
put
(item, block=True, timeout=None)¶Put item into the queue. The method never blocks and always succeeds(except for potential low-level errors such as failure to allocate memory).The optional args block and timeout are ignored and only providedfor compatibility with Queue.put()
.
CPython implementation detail: This method has a C implementation which is reentrant. That is, aput()
or get()
call can be interrupted by another put()
call in the same thread without deadlocking or corrupting internalstate inside the queue. This makes it appropriate for use indestructors such as __del__
methods or weakref
callbacks.
SimpleQueue.
put_nowait
(item)¶Equivalent to put(item)
, provided for compatibility withQueue.put_nowait()
.
SimpleQueue.
get
(block=True, timeout=None)¶Remove and return an item from the queue. If optional args block is true andtimeout is None
(the default), block if necessary until an item is available.If timeout is a positive number, it blocks at most timeout seconds andraises the Empty
exception if no item was available within that time.Otherwise (block is false), return an item if one is immediately available,else raise the Empty
exception (timeout is ignored in that case).
SimpleQueue.
get_nowait
()¶Equivalent to get(False)
.
See also
multiprocessing.Queue
A queue class for use in a multi-processing (rather than multi-threading)context.
collections.deque
is an alternative implementation of unboundedqueues with fast atomic append()
andpopleft()
operations that do not require lockingand also support indexing.
Note
Effective November 2020:
- Common Data Service has been renamed to Microsoft Dataverse. Learn more
- Some terminology in Microsoft Dataverse has been updated. For example, entity is now table and field is now column. Learn more
This article will be updated soon to reflect the latest terminology.
Queues are instrumental in organizing, prioritizing, and monitoring the progress of your work. As a central location for work management, queues assist you in processing cases, responding to service calls, or sending out product information to prospective customers. Programmatically, a queue is a collection of queue items. A queue item serves as a container for an entity record, such as a task, an email, or a case that needs processing. See Queue Entity
Note
For information about working with queues using the UI, see Queues overview.
The following information pertains to queues:
All customizable entities can be enabled for queues.
Queues may be public or private. Private queue items are only visible to the members of the queue.
A private queue is automatically created for each new user or team.
A queue can contain multiple entity types, such as tasks, emails, or cases.
A queue contains information about the user who is working on a particular queue item. This helps you manage your resources more efficiently and helps to prevent duplication of work.
Queues can be enabled for workflows and audit. This helps improve productivity and track the entity and attribute data changes for future analysis and reporting.
Members capabilities
Queues are categorized into public or private queues. Private queues have individual users as members to make controlling access to queues easier. If you add a team to a private queue, all the members of that team become members of the private queue.
Public and private queues
The QueueViewType attribute is a picklist that defines whether a queue is public or private.
All user queues are private queues for the user: Only the user will be able to see queue items in their private queue.
Team queues are marked as private with members: the team owner and all team members will be able to see the queue in the application.
All other queues are public. Everyone with read privileges for the queue entity will be able to see these queues.
Attributes used to manage queues
Use the following attributes to manage queues.
SchemaName | DisplayName | Type | Description |
---|---|---|---|
NumberOfItems | Queue Items | Integer | Number of Queue items associated with the queue. |
NumberOfMembers | No. of Members | Integer | Number of Members associated with the queue. |
QueueViewType | Type | Picklist | Select whether the queue is public or private. A public queue can be viewed by all. A private queue can be viewed only by the members added to the queue. |
Queued Definition
Restrictions on deleting queues
A queue cannot be deleted if the following are true:
Queue
When the queue has queue items.
When any routing rule uses the queue.
Enable entities for queues
To enable a customizable entity (EntityMetadata.IsCustomizable = true
) for queues, use the UpdateEntityRequest message to set the IsValidForQueue attribute to true
. The queue entity and the queue item entity are customizable entities, but they cannot be enabled for queues.
The following list contains default queue-enabled entities in Microsoft Dataverse:
Appointment
Campaignactivity
CampaignResponse
Email
Fax
Incident
Letter
PhoneCall
RecurringAppointmentMaster
ServiceAppointment
SocialActivity
Task
Inherit privileges and provide limited access to a queue
A queue and a queue item have a parental relationship in which operations on the parent queue record are propagated to the child queue item records.
Note
Queue Data Structure
In this particular parental relationship, only the Delete action is cascaded from the parent queue entity to the child queue item entity. Other actions, such as Assign, Merge or Share are not cascaded.
The privileges on a queue item are inherited from the privileges on a queue.
Office 2016 free download for mac. If you have
prvReadQueue
privilege, you also have read privilege on a queue item entity.If you have
prvAppendToQueue
privilege, you also have create, update, and delete privileges on a queue item entity.Often, you must limit access to the queue when permitting access to the queue items. As a queue owner with full access to the queue, you might want to share a queue with a team that will have only limited access to the queue. For example, if the support team is given read and append to privileges on a queue, team members cannot make any changes to the queue, such as changing queue name or queue owner. However, they can create, retrieve, update, and delete queue items.
Actions on queues and queue items
You can perform a variety of actions on queues and queue items, if you have appropriate privileges on the queue entity and the queue item entity.
Actions on queues
Perform the following actions on the queues:
Customize queues and queue items by adding custom attributes.
Add an entity record to a queue.
Note
An entity record cannot be added in multiple queues. An exception is an email entity record with the status “Received”.
Add entity records of different entity types in the same queue.
Change an ownership of a queue by assigning it to another user or team.
Add principals to a private queue using the AddPrincipalToQueueRequest.
Clean up the history for a queue by deleting inactive queue items in the queue, such as completed or canceled phone calls.
Retrieve all the queues that a user has access to using the RetrieveUserQueuesRequest
Make a queue the default queue for a user by setting the
SystemUser.QueueId
attribute to the ID of the queue. The same queue can be specified as a default queue for different users.Create a workflow that operates on all private queues. For example, whenever a user creates a task, the workflow adds the task to the default queue of the user. You can also create a workflow that operates only on a particular queue.
Configure an email for incoming messages, if you want incoming email messages to be delivered to a queue.
Actions on queue items
Perform the following actions on the queue items:
Assign a queue item to a user using the PickFromQueueRequest.
Move a queue item from a source queue to a destination queue by using the AddToQueueRequest message. A queue item can be moved from one queue to another until it is deactivated by using the SetStateRequest message.
Note
A queue item is automatically deactivated if the state of the record in the queue item changed from Active to Inactive. This applies to queue-enabled entities that have Active and Inactive states. To determine if an entity is queue-enabled and if an entity record can be in an Active or Inactive state, see entity metadata information.
Release a queue item back to the queue using the ReleaseToQueueRequest.
Delete a queue item from a queue by using the DeleteRequest message. When you delete a queue item, a referenced entity record is not deleted. However, when you delete an entity record, all queue items that reference this entity record are deleted.
See also
Queue Entity
QueueItem Entity
AddToQueueRequest
Queueing Definition
Note
Can you tell us about your documentation language preferences? Take a short survey.
Queue Delay
The survey will take about seven minutes. No personal data is collected (privacy statement).