當前位置: 首頁>>代碼示例>>Python>>正文


Python ProcessContext.get_queue方法代碼示例

本文整理匯總了Python中system.process_context.ProcessContext.get_queue方法的典型用法代碼示例。如果您正苦於以下問題:Python ProcessContext.get_queue方法的具體用法?Python ProcessContext.get_queue怎麽用?Python ProcessContext.get_queue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在system.process_context.ProcessContext的用法示例。


在下文中一共展示了ProcessContext.get_queue方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: purge_mq_queue

# 需要導入模塊: from system.process_context import ProcessContext [as 別名]
# 或者: from system.process_context.ProcessContext import get_queue [as 別名]
from system.process_context import ProcessContext
from tests.base_fixtures import get_field_starting_with

def purge_mq_queue(mq_queue_name):
    conn = Connection()
    chan = conn.connection.channel()
    try:
        n = chan.queue_purge(mq_queue_name)
        print "Purged %s messages from %s queue" % (n, mq_queue_name)
    except Exception:
        print "Unable to purge %s" % mq_queue_name

    chan.close()
    conn.close()

if __name__ == '__main__':
    if len(sys.argv) < 2:
        print "Usage 1 - to purge specific queue:\n\tpython purge_queue.py queue_name\n"
        print "Usage 2 - to purge all Synergy queues:\n\tpython purge_queue.py all\n"
        sys.exit(0)

    if sys.argv[1] == 'all':
        processes = get_field_starting_with('PROCESS_', process_context)
        for process_name in processes:
            mq_queue_name = ProcessContext.get_queue(process_name)
            purge_mq_queue(mq_queue_name)
    else:
        mq_queue_name = sys.argv[1]
        purge_mq_queue(mq_queue_name)

開發者ID:strategist922,項目名稱:scheduler,代碼行數:31,代碼來源:purge_queue.py

示例2: __init__

# 需要導入模塊: from system.process_context import ProcessContext [as 別名]
# 或者: from system.process_context.ProcessContext import get_queue [as 別名]
 def __init__(self, process_name):
     self.routing_key = ProcessContext.get_routing(process_name)
     self.exchange = ProcessContext.get_exchange(process_name)
     self.queue = ProcessContext.get_queue(process_name)
開發者ID:strategist922,項目名稱:scheduler,代碼行數:6,代碼來源:flopsy.py


注:本文中的system.process_context.ProcessContext.get_queue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。