Skip to content

Commit 55929e1

Browse files
committed
handle Exception in model_path_handler
1 parent 6f9c9ce commit 55929e1

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

graph_net/model_path_handler.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import argparse
2+
import traceback
23
from graph_net.imp_util import load_module
34
import logging
45
import sys
@@ -52,6 +53,12 @@ def handle_model_path_list_in_current_process(handler, args):
5253
except KeyboardInterrupt:
5354
print("KeyboardInterrupt")
5455
return
56+
except Exception as e:
57+
print(f"Handle {model_path} failed: {str(e)}", file=sys.stderr)
58+
print("\n--- Full Traceback ---")
59+
traceback.print_exc()
60+
print("\n--- End of Traceback ---")
61+
return
5562

5663

5764
def handle_model_path_list_in_subprocess(args):
@@ -62,6 +69,12 @@ def handle_model_path_list_in_subprocess(args):
6269
except KeyboardInterrupt:
6370
print("KeyboardInterrupt")
6471
return
72+
except Exception as e:
73+
print(f"Handle {model_path} failed: {str(e)}", file=sys.stderr)
74+
print("\n--- Full Traceback ---")
75+
traceback.print_exc()
76+
print("\n--- End of Traceback ---")
77+
return
6578

6679

6780
def handle_model_path(handler, model_path):

0 commit comments

Comments
 (0)