Skip to content

Commit 7e60844

Browse files
mgarrardfacebook-github-bot
authored andcommitted
Add STATUSES_EXPECTING_DATA to trials consts (facebook#2621)
Summary: Pull Request resolved: facebook#2621 We'll want to leverage this in a few places in various generation strategies we are creating. This provides an easy to use constant for which trial statuses are those that we expect to receive data from. Reviewed By: saitcakmak Differential Revision: D60485193 fbshipit-source-id: 81a77047432469bf67c09f1fe867c702291d1c7f
1 parent 6c47000 commit 7e60844

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

ax/core/base_trial.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,7 @@ def is_terminal(self) -> bool:
102102
@property
103103
def expecting_data(self) -> bool:
104104
"""True if trial is expecting data."""
105-
return (
106-
self == TrialStatus.RUNNING
107-
or self == TrialStatus.COMPLETED
108-
or self == TrialStatus.EARLY_STOPPED
109-
)
105+
return self in STATUSES_EXPECTING_DATA
110106

111107
@property
112108
def is_deployed(self) -> bool:
@@ -168,6 +164,12 @@ def __repr__(self) -> str:
168164

169165
NON_ABANDONED_STATUSES: Set[TrialStatus] = set(TrialStatus) - {TrialStatus.ABANDONED}
170166

167+
STATUSES_EXPECTING_DATA: List[TrialStatus] = [
168+
TrialStatus.RUNNING,
169+
TrialStatus.COMPLETED,
170+
TrialStatus.EARLY_STOPPED,
171+
]
172+
171173

172174
# pyre-fixme[24]: Generic type `Callable` expects 2 type parameters.
173175
def immutable_once_run(func: Callable) -> Callable:

0 commit comments

Comments
 (0)