Refine
This commit is contained in:
@@ -1863,7 +1863,7 @@ def query_all_record_by_date(query_date: str, bucket: str="realtime_simulation_r
|
|||||||
return node_records, link_records
|
return node_records, link_records
|
||||||
|
|
||||||
# 2025/03/15 DingZQ
|
# 2025/03/15 DingZQ
|
||||||
def query_all_records_by_date_with_type(query_date: str, query_type: str, bucket: str="realtime_simulation_result", client: InfluxDBClient=client) -> list:
|
def query_all_records_by_date_with_type(query_date: str, query_type: str, bucket: str="realtime_simulation_result") -> list:
|
||||||
"""
|
"""
|
||||||
查询指定日期的所有记录,包括‘node’和‘link’,分别以指定的格式返回
|
查询指定日期的所有记录,包括‘node’和‘link’,分别以指定的格式返回
|
||||||
:param query_date: 输入的日期,格式为‘2025-02-14’
|
:param query_date: 输入的日期,格式为‘2025-02-14’
|
||||||
@@ -1873,13 +1873,10 @@ def query_all_records_by_date_with_type(query_date: str, query_type: str, bucket
|
|||||||
:return: dict: tuple: (node_records, link_records)
|
:return: dict: tuple: (node_records, link_records)
|
||||||
"""
|
"""
|
||||||
# 记录开始时间
|
# 记录开始时间
|
||||||
time_cost_start = time.perf_counter()
|
client = get_new_client()
|
||||||
print('{} -- Hydraulic simulation started.'.format(
|
|
||||||
datetime.now(pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d %H:%M:%S')))
|
|
||||||
|
|
||||||
if client.ping():
|
time_cost_start = time.perf_counter()
|
||||||
pass
|
if not client.ping():
|
||||||
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()
|
query_api = client.query_api()
|
||||||
@@ -1942,11 +1939,9 @@ def query_all_records_by_date_with_type(query_date: str, query_type: str, bucket
|
|||||||
"friction": record["friction"]
|
"friction": record["friction"]
|
||||||
})
|
})
|
||||||
time_cost_end = time.perf_counter()
|
time_cost_end = time.perf_counter()
|
||||||
print('{} -- Hydraulic simulation finished, cost time: {:.2f} s.'.format(
|
|
||||||
datetime.now(pytz.timezone('Asia/Shanghai')).strftime('%Y-%m-%d %H:%M:%S'),
|
|
||||||
time_cost_end - time_cost_start))
|
|
||||||
|
|
||||||
return result_records
|
return result_records
|
||||||
|
|
||||||
# 2025/02/21
|
# 2025/02/21
|
||||||
def query_all_record_by_date_property(query_date: str, type: str, property: str, bucket: str="realtime_simulation_result") -> list:
|
def query_all_record_by_date_property(query_date: str, type: str, property: str, bucket: str="realtime_simulation_result") -> list:
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user