Skip to content

Commit f6e8a6a

Browse files
committed
Bugfix: 0 is now considered a valid step number in log_time_series_metrics
Previously, when log_time_series_metrics is called without a step value it defaults to None. The function internally checked `if not step` and in this case, determined a step number. The problem is that 0 is falsy and therefore the function turns step=0 into step=1 which is a problem if the function is later called with step=1 (in that case the first logged values are overwritten) Checking for `if step is None` fixes the problem.
1 parent 7bf2437 commit f6e8a6a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

google/cloud/aiplatform/metadata/experiment_run_resource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ def log_time_series_metrics(
961961

962962
self._soft_create_time_series(metric_keys=set(metrics.keys()))
963963

964-
if not step:
964+
if step is None:
965965
step = self._largest_step or self._get_latest_time_series_step()
966966
step += 1
967967
self._largest_step = step

0 commit comments

Comments
 (0)