mirror of
https://github.com/microsoft/autogen.git
synced 2025-10-29 17:00:56 +00:00
fix resource limit issue (#589)
This commit is contained in:
parent
79a24d06a9
commit
cf1dfd3966
@ -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:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user