This function will do nothing during (occurrence * delay) seconds.
()
| 6 | |
| 7 | |
| 8 | def 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 | |
| 28 | if __name__ == "__main__": |
nothing calls this directly
no test coverage detected
searching dependent graphs…