Skip to content

Commit

Permalink
Pytype fix.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 722934690
  • Loading branch information
vizier-team authored and copybara-github committed Feb 14, 2025
1 parent f30840c commit 1d4b091
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 4 additions & 2 deletions vizier/_src/pyglove/converters.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,11 +559,13 @@ def to_tuner_trial(self, vizier_trial: vz.Trial) -> pg.tuning.Trial:
vizier_trial.final_measurement
),
status=self._to_tuner_trial_status(vizier_trial.status),
created_time=int(
created_time=int( # pylint: disable=g-long-ternary
vizier_trial.creation_time.replace(
tzinfo=datetime.timezone.utc
).timestamp()
),
)
if vizier_trial.creation_time
else None,
completed_time=int( # pylint: disable=g-long-ternary
vizier_trial.completion_time.replace(
tzinfo=datetime.timezone.utc
Expand Down
6 changes: 5 additions & 1 deletion vizier/_src/pyglove/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ def __init__(
completed_time = (
int(trial.completion_time.timestamp()) if trial.completion_time else 0
)
created_time = (
int(trial.creation_time.timestamp()) if trial.creation_time else 0
)

super().__init__(
dna=pg.DNA(None),
id=trial.id,
Expand All @@ -67,7 +71,7 @@ def __init__(
trial.final_measurement
),
status=_trial_status_legacy_value(trial.status),
created_time=int(trial.creation_time.timestamp()),
created_time=created_time,
completed_time=completed_time,
infeasible=trial.infeasible,
**kwargs,
Expand Down

0 comments on commit 1d4b091

Please sign in to comment.