autogluon / autogluon/autogluon

Replace `time.time` with `time.monotonic`

Open
#4,342 0 comments 0 reactions 0 assignees View on GitHub
enhancement priority: 1
Dominant language
Python
Stars
10.7k
Forks
1.2k
Avg merge
21h 29m
Merged PRs (30d)
57

Description

We should replace all usage of `time.time()` with `time.monotonic()`.

`time.time()` is influenced by the system clock. This means if the system clock is changed during fit, then AutoGluon could incorrectly run for longer or shorter times than intended.

`time.monotonic()` does not care about the system clock, and should be more trustworthy.

https://docs.python.org/3/library/time.html#time.time
https://docs.python.org/3/library/time.html#time.monotonic

Kudos to @eddiebergman for making us aware of this.

Contributor guide

Open the contributing guide

Research direction

Search the repository for every use of time.time() and inspect the timing paths around fit. Confirm each elapsed-time calculation uses a clock unaffected by system-clock changes, then run the tests covering the affected components and verify fitting durations remain correct.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.