识别同一队列中的不同座席

问题描述

这就是问题所在:

我有两个代理群体; “蓝色矩形”和“红色矩形”。这两个代理都进入同一个队列。然而,要知道在仲裁时间 T 队列中有多少红色和蓝色矩形有点困难。

是否有一些函数/技术来获取这个?

想要例如在控制台打印:“队列中有 N 个蓝色矩形和 M 个红色矩形。”

解决方法

当然,您可以遍历队列中的所有代理并按其代理类型检查每个代理(假设蓝色和红色代理实际上是不同的代理类型):

from __future__ import print_function
import os
import sys
from time import strftime,sleep
import boto3
from botocore.exceptions import ClientError
from time import strftime
from datetime import datetime
from pytz import timezone
from tzlocal import get_localzone

或者,只需使用队列for (int i=0; i<myQueue.size(); i++) { if (myQueue.get(i) instanceof AgentTypeBlue) { // do whatever you want to count blue agents } else if (myQueue.get(i) instanceof AgentTypeRed) { // do whatever you want to count red agents } } countReds "on enter" and "on exit" code boxes to count whenever a blue or red agent enters & leaves (using a variable countBlue`),如下所示: enter image description here