File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change 82
82
logger .info ('init gp_learner' )
83
83
84
84
85
+ class GPLearnerException (Exception ):
86
+ pass
87
+
88
+
89
+ class GPLearnerAbortException (GPLearnerException ):
90
+ """Exception base class to be raised to abort whole GP Learner."""
91
+ pass
92
+
93
+
94
+ class GPLearnerTestPatternFoundException (GPLearnerAbortException ):
95
+ """Exception to be thrown when a test pattern is found.
96
+
97
+ This exception is used in eval mode to enable early termination as soon as
98
+ a test pattern (to be searched) ends up in the results of one generation.
99
+ Early termination here allows not wasting additional time for the full
100
+ run to complete. It skips out of the code immediately, re-raising the
101
+ exception for external (eval) handling.
102
+ """
103
+ pass
104
+
105
+
85
106
def f_measure (precision , recall , beta = config .F_MEASURE_BETA ):
86
107
"""Calculates the f1-measure from precision and recall."""
87
108
if precision + recall <= 0 :
@@ -1178,6 +1199,11 @@ def find_graph_pattern_coverage(
1178
1199
)
1179
1200
break
1180
1201
run += 1
1202
+ except GPLearnerAbortException as e :
1203
+ # this exception is only raised to intentionally abort the whole
1204
+ # learning process. Don't run auto-retry.
1205
+ logger .info ('gp learner was aborted intentionally: %r' , e )
1206
+ raise
1181
1207
except Exception as e :
1182
1208
error_count += 1
1183
1209
logger .error ('uncaught exception in run %d' % run )
You can’t perform that action at this time.
0 commit comments