gpt4 book ai didi

queue - NiFi如何清除所有队列

转载 作者:行者123 更新时间:2023-12-05 09:17:17 25 4
gpt4 key购买 nike

我目前使用的是 NiFi 1.5.0(但与之前的版本相同),我想知道是否有一种方法可以同时清除所有队列?

当处理器数量增加时,重置所有内容可能会很长。

(我已经知道如何清除单个队列: How to clear NiFi queues? )

我正在寻找使用 UI 或 API 的解决方案

提前致谢!

最佳答案

我还没有时间彻底测试它,但它应该可以工作:

# In your linux shell - NiPyAPI is a Python2/3 SDK for the NiFi API
pip install nipyapi
python
# In Python
from nipyapi import config, canvas, nifi
# Get a flat list of all process groups
pgs = canvas.list_all_process_groups()
# get a flat list of all connections in all process groups
cons = []
for pg in pgs: cons += nifi.ProcessgroupsApi().get_connections(pg.id).connections
# Issue a drop order for every connection in every process group
for con in cons: nifi.FlowfilequeuesApi().create_drop_request(con.id)

编辑:我继续实现它,因为它看起来很有用: https://github.com/Chaffelson/nipyapi/issues/45

import nipyapi
pg = nipyapi.canvas.get_process_group('MyProcessGroup')
nipyapi.canvas.purge_process_group(pg, stop=True)

停止选项将在清除进程组之前对其进行取消调度,只是为了更加方便

关于queue - NiFi如何清除所有队列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48710410/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com