Commit 197d83a2 authored by Allvey's avatar Allvey

日志及异常处理优化

parent 5a5ae936
...@@ -250,12 +250,12 @@ class ExpectedTime(AlgorithmBase): ...@@ -250,12 +250,12 @@ class ExpectedTime(AlgorithmBase):
# get truck located group_excavators id (uuid) from truck trip # get truck located group_excavators id (uuid) from truck trip
if int(trip[1]) < 0 or int(trip[1]) >= len(DeviceMap.excavator_index_to_uuid_dict): if int(trip[1]) < 0 or int(trip[1]) >= len(DeviceMap.excavator_index_to_uuid_dict):
raise CoreException(105, f'车辆 {truck_id} 行程驶往 {int(trip[1])} 号挖机越界') raise Exception(f'车辆 {truck_id} 行程驶往 {int(trip[1])} 号挖机越界')
excavator_id = DeviceMap.excavator_index_to_uuid_dict[int(trip[1])] excavator_id = DeviceMap.excavator_index_to_uuid_dict[int(trip[1])]
# get group_excavators index (int) within group from group's excavator_group_index # get group_excavators index (int) within group from group's excavator_group_index
if excavator_id not in self.group.excavator_uuid_index_dict: if excavator_id not in self.group.excavator_uuid_index_dict:
raise CoreException(106, f'挖机 {excavator_id} 不存在于分组 {self.group.name} excavator_uuid_index_dict') raise Exception(106, f'挖机 {excavator_id} 不存在于分组 {self.group.name} excavator_uuid_index_dict')
excavator_group_index = self.group.excavator_uuid_index_dict[excavator_id] excavator_group_index = self.group.excavator_uuid_index_dict[excavator_id]
# get travelling time (List) to each group_dumps # get travelling time (List) to each group_dumps
...@@ -288,6 +288,7 @@ class ExpectedTime(AlgorithmBase): ...@@ -288,6 +288,7 @@ class ExpectedTime(AlgorithmBase):
except Exception as es: except Exception as es:
self.logger.error("矿卡空载调度异常") self.logger.error("矿卡空载调度异常")
self.logger.error(es) self.logger.error(es)
self.logger.error(es.__traceback__.tb_lineno)
transport_value = np.zeros(group_dynamic_unload_area_num) transport_value = np.zeros(group_dynamic_unload_area_num)
elif task in [3, 4, 5]: elif task in [3, 4, 5]:
...@@ -316,6 +317,8 @@ class ExpectedTime(AlgorithmBase): ...@@ -316,6 +317,8 @@ class ExpectedTime(AlgorithmBase):
group_excavator_avl_time_ls[excavator_index] = excavator_val_time[excavator_id] group_excavator_avl_time_ls[excavator_index] = excavator_val_time[excavator_id]
# get truck located group_dumps id (uuid) from truck trip # get truck located group_dumps id (uuid) from truck trip
if int(trip[1]) < 0 or int(trip[1]) >= len(DeviceMap.dump_index_to_uuid_dict):
raise Exception(f'车辆 {truck_id} 行程驶往 {int(trip[1])} 号卸点越界')
dump_id = DeviceMap.dump_index_to_uuid_dict[int(trip[1])] dump_id = DeviceMap.dump_index_to_uuid_dict[int(trip[1])]
# get unload area id (uuid) from DispatchInfo dump_id to group_unload_areas mapping # get unload area id (uuid) from DispatchInfo dump_id to group_unload_areas mapping
......
This diff is collapsed.
...@@ -294,8 +294,8 @@ def global_period_para_update(): ...@@ -294,8 +294,8 @@ def global_period_para_update():
# 矿卡集合 # 矿卡集合
truck_set = set(update_total_truck()) truck_set = set(update_total_truck())
logger.info("group_trucks") # logger.info("group_trucks")
logger.info(truck_set) # logger.info(truck_set)
# 固定派车矿卡集合 # 固定派车矿卡集合
fixed_truck_set = set(update_fixdisp_truck()) fixed_truck_set = set(update_fixdisp_truck())
......
...@@ -203,13 +203,13 @@ def update_deveices_map(unload_area_uuid_to_index_dict, load_area_uuid_to_index_ ...@@ -203,13 +203,13 @@ def update_deveices_map(unload_area_uuid_to_index_dict, load_area_uuid_to_index_
session_postgre.rollback() session_postgre.rollback()
session_mysql.rollback() session_mysql.rollback()
logger.info("excavator_index_to_load_area_index_dict") # logger.info("excavator_index_to_load_area_index_dict")
logger.info(excavator_index_to_load_area_index_dict) # logger.info(excavator_index_to_load_area_index_dict)
#
logger.info("load_area_uuid_to_index_dict") # logger.info("load_area_uuid_to_index_dict")
logger.info(load_area_uuid_to_index_dict) # logger.info(load_area_uuid_to_index_dict)
logger.info("static_excavator_uuid_to_index_dict") # logger.info("static_excavator_uuid_to_index_dict")
logger.info(excavator_uuid_to_index_dict) # logger.info(excavator_uuid_to_index_dict)
return { return {
"excavator_uuid_to_index_dict": excavator_uuid_to_index_dict, "excavator_uuid_to_index_dict": excavator_uuid_to_index_dict,
...@@ -234,8 +234,8 @@ def build_truck_uuid_index_map(dynamic_truck_set): ...@@ -234,8 +234,8 @@ def build_truck_uuid_index_map(dynamic_truck_set):
truck_index_to_uuid_dict[truck_num] = truck_id truck_index_to_uuid_dict[truck_num] = truck_id
truck_num = truck_num + 1 truck_num = truck_num + 1
logger.info("static_data_process.py-truck_uuid_to_index_dict") # logger.info("static_data_process.py-truck_uuid_to_index_dict")
logger.info(truck_uuid_to_index_dict) # logger.info(truck_uuid_to_index_dict)
return { return {
"truck_uuid_to_index_dict": truck_uuid_to_index_dict, "truck_uuid_to_index_dict": truck_uuid_to_index_dict,
......
...@@ -175,7 +175,7 @@ class DumpInfo(WalkManage): ...@@ -175,7 +175,7 @@ class DumpInfo(WalkManage):
if unload_ability < 200: if unload_ability < 200:
self.dump_strength[dump_index] = 200 self.dump_strength[dump_index] = 200
raise Exception("卸载点卸载能力异常") self.logger.warning("卸载点卸载能力异常 < 200")
else: else:
self.dump_strength[dump_index] = unload_ability # 卸载设备最大卸载能力,单位吨/小时 self.dump_strength[dump_index] = unload_ability # 卸载设备最大卸载能力,单位吨/小时
else: else:
......
...@@ -599,7 +599,7 @@ class TruckInfo(WalkManage): ...@@ -599,7 +599,7 @@ class TruckInfo(WalkManage):
if item.bind_list is not None: if item.bind_list is not None:
for truck_name in json.loads(item.bind_list): for truck_name in json.loads(item.bind_list):
if truck_name not in truck_name_to_uuid_dict: if truck_name not in truck_name_to_uuid_dict:
self.logger.error(f'truck_name_to_uuid_dict (db2) 不存在 {truck_name}') self.logger.warning(f'truck_name_to_uuid_dict (db2) 不存在 {truck_name}')
continue continue
self.truck_excavator_bind[ self.truck_excavator_bind[
truck_name_to_uuid_dict[truck_name] truck_name_to_uuid_dict[truck_name]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment