From 8fb5af16a8bd61da17d677b4db52e46fe50f4e83 Mon Sep 17 00:00:00 2001 From: Ming Li Date: Sun, 25 Jun 2023 09:40:47 +0800 Subject: [PATCH] Made MAX_EVAL_SECS configurable via environment --- tpot/decorators.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tpot/decorators.py b/tpot/decorators.py index 3dac4b3c..d276f0fb 100644 --- a/tpot/decorators.py +++ b/tpot/decorators.py @@ -25,15 +25,16 @@ from __future__ import print_function from functools import wraps +import os import warnings from .export_utils import expr_to_tree, generate_pipeline_code from deap import creator -from stopit import threading_timeoutable, TimeoutException +from stopit import threading_timeoutable NUM_TESTS = 10 -MAX_EVAL_SECS = 10 +MAX_EVAL_SECS = int(os.environ.get('TPOT_MAX_EVAL_SECS') or 10) def _pre_test(func): @@ -79,7 +80,7 @@ def check_pipeline(self, *args, **kwargs): try: expr = func(self, *args, **kwargs) pass_gen = True - except: + except Exception: num_test_expr += 1 pass # mutation operator returns tuple (ind,); crossover operator @@ -116,5 +117,4 @@ def check_pipeline(self, *args, **kwargs): return expr - return check_pipeline