Skip to content

Commit e8419c3

Browse files
Matyrobenoit-cty
authored andcommitted
Run Precommit hooks
1 parent 11b9515 commit e8419c3

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

codecarbon/emissions_tracker.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,10 +691,10 @@ def stop(self) -> Optional[float]:
691691

692692
self.final_emissions_data = emissions_data
693693
self.final_emissions = emissions_data.emissions
694-
694+
695695
for handler in self._output_handlers:
696696
handler.exit()
697-
697+
698698
return emissions_data.emissions
699699

700700
def _persist_data(

codecarbon/output_methods/base_output.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ def live_out(self, total: EmissionsData, delta: EmissionsData):
2222

2323
def task_out(self, data: List[TaskEmissionsData], experiment_name: str):
2424
pass
25-
25+
2626
def exit(self):
2727
pass

codecarbon/output_methods/metrics/prometheus.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
delete_from_gateway,
99
push_to_gateway,
1010
)
11-
1211
from prometheus_client.exposition import basic_auth_handler
1312

1413
from codecarbon.external.logger import logger
@@ -66,7 +65,8 @@ def generate_gauge(metric_doc: MetricDocumentation):
6665
labelnames,
6766
registry=registry,
6867
)
69-
68+
69+
7070
def generate_counter(metric_doc: MetricDocumentation):
7171
return Counter(
7272
metric_doc.name,
@@ -97,7 +97,7 @@ class PrometheusOutput(BaseOutput):
9797
def __init__(self, prometheus_url: str, jobname: str = "codecarbon"):
9898
self.prometheus_url = prometheus_url
9999
self.jobname = jobname
100-
100+
101101
def exit(self):
102102
# Cleanup metrics from pushgateway on shutdown, prometheus should already have read them
103103
# Otherwise they will persist with their last values
@@ -147,8 +147,7 @@ def add_emission(self, carbon_emission: dict):
147147
(energy_consumed_gauge, "energy_consumed"),
148148
]:
149149
gauge.labels(**labels).set(carbon_emission[emission_name])
150-
151-
150+
152151
# Update the total energy consumed counter
153152
# This is separate from the total values given to self.out(...)
154153
energy_consumed_total.labels(**labels).inc(carbon_emission["energy_consumed"])

0 commit comments

Comments
 (0)