A task, used to segregate electrical consumption when executing a treatment.
| 5 | |
| 6 | |
| 7 | class Task: |
| 8 | """ |
| 9 | A task, used to segregate electrical consumption when executing a treatment. |
| 10 | """ |
| 11 | |
| 12 | is_active: bool |
| 13 | emissions_data: EmissionsData |
| 14 | |
| 15 | def __init__(self, task_name): # , task_measure |
| 16 | self.task_id: str = task_name + uuid4().__str__() |
| 17 | self.task_name: str = task_name |
| 18 | self.start_time = time.perf_counter() |
| 19 | self.is_active = True |
| 20 | |
| 21 | def out(self): |
| 22 | return TaskEmissionsData( |
| 23 | task_name=self.task_name, |
| 24 | timestamp=self.emissions_data.timestamp, |
| 25 | project_name=self.emissions_data.project_name, |
| 26 | run_id=self.emissions_data.run_id, |
| 27 | duration=self.emissions_data.duration, |
| 28 | emissions=self.emissions_data.emissions, |
| 29 | emissions_rate=self.emissions_data.emissions_rate, |
| 30 | cpu_power=self.emissions_data.cpu_power, |
| 31 | gpu_power=self.emissions_data.gpu_power, |
| 32 | ram_power=self.emissions_data.ram_power, |
| 33 | cpu_energy=self.emissions_data.cpu_energy, |
| 34 | gpu_energy=self.emissions_data.gpu_energy, |
| 35 | ram_energy=self.emissions_data.ram_energy, |
| 36 | energy_consumed=self.emissions_data.energy_consumed, |
| 37 | water_consumed=self.emissions_data.water_consumed, |
| 38 | country_name=self.emissions_data.country_name, |
| 39 | country_iso_code=self.emissions_data.country_iso_code, |
| 40 | region=self.emissions_data.region, |
| 41 | cloud_provider=self.emissions_data.cloud_provider, |
| 42 | cloud_region=self.emissions_data.cloud_region, |
| 43 | os=self.emissions_data.os, |
| 44 | python_version=self.emissions_data.python_version, |
| 45 | codecarbon_version=self.emissions_data.codecarbon_version, |
| 46 | cpu_count=self.emissions_data.cpu_count, |
| 47 | cpu_model=self.emissions_data.cpu_model, |
| 48 | gpu_count=self.emissions_data.gpu_count, |
| 49 | gpu_model=self.emissions_data.gpu_model, |
| 50 | longitude=self.emissions_data.longitude, |
| 51 | latitude=self.emissions_data.latitude, |
| 52 | ram_total_size=self.emissions_data.ram_total_size, |
| 53 | tracking_mode=self.emissions_data.tracking_mode, |
| 54 | on_cloud=self.emissions_data.on_cloud, |
| 55 | ) |
no outgoing calls
no test coverage detected
searching dependent graphs…