From a5f368f9b6ec392c0d619382f53762425db2d4b3 Mon Sep 17 00:00:00 2001 From: Chansoo Lee Date: Wed, 26 Jul 2023 09:18:55 -0700 Subject: [PATCH] N/A PiperOrigin-RevId: 551226958 --- vizier/_src/pythia/local_policy_supporters.py | 6 ++++++ vizier/_src/pythia/policy.py | 2 +- vizier/_src/pythia/policy_supporter.py | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/vizier/_src/pythia/local_policy_supporters.py b/vizier/_src/pythia/local_policy_supporters.py index 14348ce02..bdf7461e7 100644 --- a/vizier/_src/pythia/local_policy_supporters.py +++ b/vizier/_src/pythia/local_policy_supporters.py @@ -58,6 +58,12 @@ class InRamPolicySupporter(policy_supporter.PolicySupporter): study_guid: str = attr.ib(init=True, kw_only=True, default='', converter=str) _trials: dict[int, vz.Trial] = attr.ib(init=False, factory=dict) + def __str__(self) -> str: + return ( + f'InRamPolicySupporter(study_guid={self.study_guid},' + f' num_trials={len(self.trials)})' + ) + @property def trials(self) -> Sequence[vz.Trial]: return list(self._trials.values()) diff --git a/vizier/_src/pythia/policy.py b/vizier/_src/pythia/policy.py index e8188bf64..e30c348e1 100644 --- a/vizier/_src/pythia/policy.py +++ b/vizier/_src/pythia/policy.py @@ -258,7 +258,7 @@ def early_stop(self, request: EarlyStopRequest) -> EarlyStopDecisions: @property def name(self) -> str: - """Returns the policy name.""" + """Returns the policy name. For monitoring purposes only.""" # Derived classes should override this implementation. return __class__.__name__ diff --git a/vizier/_src/pythia/policy_supporter.py b/vizier/_src/pythia/policy_supporter.py index dd0c3d73b..f1285217e 100644 --- a/vizier/_src/pythia/policy_supporter.py +++ b/vizier/_src/pythia/policy_supporter.py @@ -52,6 +52,8 @@ def GetStudyConfig(self, study_guid: str) -> vz.ProblemStatement: $study_guid refers to a nonexistent or inaccessible study. """ + # TODO: Should take `TrialFilter` as input, instead of + # its fields listed as keyword arguments. @abc.abstractmethod def GetTrials( self,