Skip to content

Commit

Permalink
Implement ChainRunner (#1869)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #1869

Implements ChainRunner, which takes List[ChainRunnerStage] and runs the stages in sequence for each trial.

High-level logic is as follows:
* `ChainRunner.run` kicks off the first ChainRunnerStage in the list and records that stage's name in the trial's run_metadata.
* `ChainRunner.poll_trial_status` polls the current stage's runner's status. If this is `TrialStatus.COMPLETED` and there are more stages left in the chain, ChainRunner kicks off the next stage in the chain, updating the run_metadata in the process.

In the future this should be implemented such that this state management happens in the calling context (e.g., Scheduler, AxClient).

Reviewed By: lena-kashtelyan

Differential Revision: D47484883

fbshipit-source-id: 8959a7f340b4ea525070a5323a79dda9ec4b5329
  • Loading branch information
Bernie Beckerman authored and facebook-github-bot committed Oct 31, 2023
1 parent dc40a80 commit 2e71d92
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ax/runners/synthetic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.

from typing import Any, Dict, Iterable, Optional, Set
from typing import Any, Dict, Iterable, List, Optional, Set

from ax.core.base_trial import BaseTrial, TrialStatus
from ax.core.runner import Runner
Expand Down Expand Up @@ -36,3 +36,6 @@ def poll_trial_status(
self, trials: Iterable[BaseTrial]
) -> Dict[TrialStatus, Set[int]]:
return {TrialStatus.COMPLETED: {t.index for t in trials}}

def run_metadata_report_keys(self) -> List[str]:
return ["name"]

0 comments on commit 2e71d92

Please sign in to comment.