Skip to content

Commit

Permalink
Do not close the executor after workon #863
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre Delaunay committed Dec 12, 2022
1 parent a994595 commit 1de9135
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
6 changes: 1 addition & 5 deletions src/orion/client/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -812,11 +812,7 @@ def workon(
**kwargs,
)

if self._executor is None or self._executor_owner:
with self.executor:
rval = runner.run()
else:
rval = runner.run()
rval = runner.run()

return rval

Expand Down
16 changes: 16 additions & 0 deletions tests/unittests/client/test_experiment_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -959,3 +959,19 @@ def test_user_executor_is_not_deleted():

future = executor.submit(function, 2, 2)
assert future.get() == 4, "Executor was not closed & can still be used"


def main(*args, **kwargs):
return [dict(name="objective", type="objective", value=101)]


def test_run_experiment_twice():
""""""

with create_experiment(config, base_trial) as (cfg, experiment, client):
client.workon(main, max_trials=10)

client._experiment.max_trials = 20
client._experiment.algorithms.algorithm.max_trials = 20

client.workon(main, max_trials=20)

0 comments on commit 1de9135

Please sign in to comment.