MCPcopy Create free account
hub / github.com/mlco2/codecarbon / tracker_example

Function tracker_example

examples/multithread.py:8–25  ·  view source on GitHub ↗

This function will do nothing during (occurrence * delay) seconds.

()

Source from the content-addressed store, hash-verified

6
7
8def tracker_example():
9 """
10 This function will do nothing during (occurrence * delay) seconds.
11 """
12 occurrence = random.randint(1, 3) # Run for 1 to 3 seconds
13 tracker = OfflineEmissionsTracker(
14 country_iso_code="FRA",
15 measure_power_secs=30,
16 project_name="ultra_secret",
17 )
18
19 tracker.start()
20 try:
21 delay = 1 # Seconds
22 for _ in range(occurrence):
23 time.sleep(delay)
24 finally:
25 tracker.stop()
26
27
28if __name__ == "__main__":

Callers

nothing calls this directly

Calls 3

startMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…