Refine
This commit is contained in:
@@ -4,6 +4,8 @@ import pytz
|
||||
from typing import List, Dict, Union, Optional
|
||||
import csv
|
||||
|
||||
# get_data 是用来获取 历史数据,也就是非实时数据的接口
|
||||
# get_realtime 是用来获取 实时数据
|
||||
|
||||
def convert_timestamp_to_beijing_time(timestamp: Union[int, float]) -> datetime:
|
||||
# 将毫秒级时间戳转换为秒级时间戳
|
||||
|
||||
@@ -2087,11 +2087,9 @@ def store_scheme_simulation_result_to_influxdb(node_result_list: List[Dict[str,
|
||||
:param client: (InfluxDBClient): 已初始化的 InfluxDBClient 实例。
|
||||
:return:
|
||||
"""
|
||||
if client.ping():
|
||||
pass
|
||||
else:
|
||||
print("{} -- Failed to connect to InfluxDB.".format(
|
||||
datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
|
||||
if not client.ping():
|
||||
print("{} -- Failed to connect to InfluxDB.".format(datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
|
||||
|
||||
try:
|
||||
write_options = WriteOptions(
|
||||
jitter_interval=200, # 添加抖动以避免同时写入
|
||||
@@ -2377,8 +2375,7 @@ def query_scheme_all_record_by_time(scheme_Type: str, scheme_Name: str, query_ti
|
||||
if client.ping():
|
||||
pass
|
||||
else:
|
||||
print("{} -- Failed to connect to InfluxDB.".format(
|
||||
datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
|
||||
print("{} -- Failed to connect to InfluxDB.".format(datetime.now().strftime('%Y-%m-%d %H:%M:%S')))
|
||||
query_api = client.query_api()
|
||||
# 将北京时间转换为 UTC 时间
|
||||
beijing_time = datetime.fromisoformat(query_time)
|
||||
|
||||
Reference in New Issue
Block a user