From cf1dfd396670fabe88ab48c0931938f1cd05a1bd Mon Sep 17 00:00:00 2001 From: Chi Wang Date: Wed, 15 Jun 2022 13:46:52 -0700 Subject: [PATCH] fix resource limit issue (#589) --- flaml/model.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/flaml/model.py b/flaml/model.py index 7564797c3..0bf7669db 100644 --- a/flaml/model.py +++ b/flaml/model.py @@ -56,7 +56,11 @@ def limit_resource(memory_limit, time_limit): if memory_limit > 0: soft, hard = resource.getrlimit(resource.RLIMIT_AS) if soft < 0 and (hard < 0 or memory_limit <= hard) or memory_limit < soft: - resource.setrlimit(resource.RLIMIT_AS, (memory_limit, hard)) + try: + resource.setrlimit(resource.RLIMIT_AS, (int(memory_limit), hard)) + except ValueError: + # According to https://bugs.python.org/issue40518, it's a mac-specific error. + pass main_thread = False if time_limit is not None: try: