Skip to content

Commit

Permalink
Added missing return type hint and updated doc string
Browse files Browse the repository at this point in the history
  • Loading branch information
MyGodItsFull0fStars committed Mar 6, 2024
1 parent fad87d7 commit 754cfc9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions codecarbon/emissions_tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,11 +475,11 @@ def start_task(self, task_name=None) -> None:
)
self._active_task = task_name

def stop_task(self, task_name: str = None) -> float:
def stop_task(self, task_name: str = None) -> EmissionsData:
"""
Stop tracking a dedicated execution task. Delta energy is computed by task, to isolate its contribution to total
emissions.
:return: None
:return: EmissionData for an execution task
"""
task_name = task_name if task_name else self._active_task
self._measure_power_and_energy()
Expand All @@ -495,6 +495,7 @@ def stop_task(self, task_name: str = None) -> float:
self._tasks[task_name].emissions_data = task_emission_data
self._tasks[task_name].is_active = False
self._active_task = None

return task_emission_data

@suppress(Exception)
Expand Down

0 comments on commit 754cfc9

Please sign in to comment.