diff --git a/src/orion/client/experiment.py b/src/orion/client/experiment.py index 2370cc022d..b08e16cc66 100644 --- a/src/orion/client/experiment.py +++ b/src/orion/client/experiment.py @@ -15,6 +15,7 @@ import orion.core import orion.core.utils.format_trials as format_trials from orion.core.io.database import DuplicateKeyError +from orion.core.utils import backward from orion.core.utils.exceptions import ( BrokenExperiment, CompletedExperiment, @@ -842,6 +843,7 @@ def _optimize( with self.suggest( pool_size=pool_size, timeout=reservation_timeout ) as trial: + backward.ensure_trial_working_dir(self, trial) kwargs.update(flatten(trial.params)) diff --git a/src/orion/core/utils/backward.py b/src/orion/core/utils/backward.py index b8fda5ce92..2dc5d7ac91 100644 --- a/src/orion/core/utils/backward.py +++ b/src/orion/core/utils/backward.py @@ -184,3 +184,9 @@ def algo_observe(algo, trials, results): trial.results.append(Trial.Result(name=name, type=name, value=trial_result)) algo.observe(trials) + + +def ensure_trial_working_dir(experiment, trial): + """If the trial's exp working dir is not set, set it to current experiment's working dir.""" + if not trial.exp_working_dir: + trial.exp_working_dir = experiment.working_dir