Skip to content

Commit 26ad1f3

Browse files
Copilotbenoit-cty
andcommitted
Fix: Disable scheduler warning in task mode
- Add condition to check if we're in task mode (self._active_task is not None) - Skip scheduler warning when in task mode since scheduler is intentionally stopped - Preserves warning functionality in normal mode when there are actual delays - Tested with task mode examples and integration tests Co-authored-by: benoit-cty <6603048+benoit-cty@users.noreply.github.com>
1 parent 2be9d11 commit 26ad1f3

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

codecarbon/emissions_tracker.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -843,7 +843,7 @@ def _measure_power_and_energy(self) -> None:
843843
raise e
844844

845845
warning_duration = self._measure_power_secs * 3
846-
if last_duration > warning_duration:
846+
if last_duration > warning_duration and self._active_task is None:
847847
warn_msg = (
848848
"Background scheduler didn't run for a long period"
849849
+ " (%ds), results might be inaccurate"

0 commit comments

Comments
 (0)