Skip to content

Commit 66fc079

Browse files
authored
Fixing bug related to resource limitation
1 parent a93c1e0 commit 66fc079

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

autoPyTorch/core/worker_no_timelimit.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,14 @@ def compute(self, config, budget, working_directory, config_id, **kwargs):
5656
if self.guarantee_limits and self.budget_type == 'time':
5757
import pynisher
5858

59-
limit_train = pynisher.enforce_limits(wall_time_in_s=int(budget * 4))(self.optimize_pipeline)
60-
result, randomstate = limit_train(config, budget, config_id, random.getstate())
59+
limit_train = pynisher.enforce_limits(mem_in_mb=self.pipeline_config['memory_limit_mb'], wall_time_in_s=int(budget * 4))(self.optimize_pipeline)
60+
result = limit_train(config, budget, config_id, start_time)
6161

62+
if (limit_train.exit_status == pynisher.TimeoutException):
63+
raise Exception("Time limit reached. Took " + str((time.time()-start_time)) + " seconds with budget " + str(budget))
6264
if (limit_train.exit_status == pynisher.MemorylimitException):
63-
raise Exception("Memory limit reached. Took " + str((time.time()-start_time)) + " seconds with budget " + str(budget))
65+
result = {"loss": 100000, "info":{}}
66+
return result
6467
elif (limit_train.exit_status != 0):
6568
self.autonet_logger.info('Exception occurred using config:\n' + str(config))
6669
raise Exception("Exception in train pipeline. Took " + str((time.time()-start_time)) + " seconds with budget " + str(budget))

0 commit comments

Comments
 (0)