python - 使用 write_points 调用 Python influxdb-python,是否有任何可重试的错误?
问题描述
在我的客户端应用程序中使用 influxdb-python 5.3.1 和 influxdb 服务器版本 1.6.4,当我使用 write_points 调用写入数据时,是否有任何可重试的异常?例如:
influx_conn = influxdb.InfluxDBClient(host='my_influxdb_server', username='mylogin', password=mypassword)
influx_monitored_data_points=[]
thing_being_monitored="xyzzy"
# Load up influx_monitored_data_points with data points for thing_being_monitored
try:
influx_conn.write_points(influx_monitored_data_points)
except:
print(f"Error writing monitoring data for {thing_being_monitored} to InfluxDB 'my_influxdb_server'")
raise # re-raise the error to print out all the gory details
我是否应该添加任何“except specific_exception :”子句来捕获并重试现有连接上的 write_points?
是否有其他错误表明我应该关闭连接并在重新打开之前等待,然后再次使用相同的数据重试 write_points?
此外,对于我不重试的错误,我可以假设 raise 将始终存在于程序中,还是应该在 raise 之后添加和显式 sys.exit() 调用?
我是 Python 新手,请谅解。提前致谢
解决方案
推荐阅读
- apache-kafka - service.properties中的Kafka“num.partitions”设置不生效
- c# - 如何分解字符串的一部分并将其添加到 C# 中的列表中
- c# - 具有多个术语的 Elasticsearch Nest 过滤器查询
- r - 当我从 Github 安装我的包时,为什么我的 R 函数没有加载?
- signalr - SignalR - 向特定用户发送推送通知
- java - 使用迭代器时出现 ConcurrentModificationException
- javascript - 在同一个 Promise 对象中调用 then 方法会导致 Promise 永远挂起
- gcc - 为自定义 RISC-V imafd SOC 移植 linux
- javascript - 反应如何只运行一次功能,在页面进入或刷新后
- javascript - React-Native FlatList 产生一个 SyntaxError