Written by

Question Phillip Wu · Jan 28, 2025

Python code Production length of queue

Is it possible to get the length of queue for a production using Python code?

I'm using embedded Python at the moment.

I'd like to use the Python external language server later - the Python external server will not start in my environment.

If it is possible to query the production queue length programmically, please advise how?

It would also be nice to show the number of messages processed per second, if IRIS keeps track of this.

Comments

Guillaume Rongier · Jan 29, 2025
import iris

GLOBAL_QUEUE = iris.gref("Ens.Queue")

defget_list_host_queue() -> dict:
    dict_queue = {}
    for composed_key, v in GLOBAL_QUEUE.query():
        host = composed_key[0]
        if host notin dict_queue:
            try:
                dict_queue[host] = v if composed_key[2] == 'count'elseNoneexcept IndexError:
                dict_queue[host] = Nonereturn dict_queue

if __name__ == "__main__":
    print(get_list_host_queue())
    
# {'Ens.Actor': 0, 'Ens.Alarm': 0, 'Ens.ScheduleHandler': 0, 'EnsLib.Testing.Process': 0, 'Python.MyAsyncNGBO': 10, 'Python.MyAsyncNGBP': 0, 'SystemSignal:29404': 0, '_SyncCall:29420': 0}

Try some thing like that

0
Phillip Wu  Jan 29, 2025 to Guillaume Rongier

Super. Thanks.
Works Great!

0