Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: MySQL can round microseconds into the future causing scheduler to skip trials #775

Merged
merged 7 commits into from
Jul 10, 2024
4 changes: 3 additions & 1 deletion mlos_bench/mlos_bench/storage/sql/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,9 @@ def _get_config_id(self, conn: Connection, tunables: TunableGroups) -> int:

def new_trial(self, tunables: TunableGroups, ts_start: Optional[datetime] = None,
config: Optional[Dict[str, Any]] = None) -> Storage.Trial:
ts_start = utcify_timestamp(ts_start or datetime.now(UTC), origin="local")
# MySQL can round microseconds into the future causing scheduler to skip trials.
# Truncate microseconds to avoid this issue.
ts_start = utcify_timestamp(ts_start or datetime.now(UTC), origin="local").replace(microsecond=0)
motus marked this conversation as resolved.
Show resolved Hide resolved
_LOG.debug("Create trial: %s:%d @ %s", self._experiment_id, self._trial_id, ts_start)
with self._engine.begin() as conn:
try:
Expand Down
Loading