Carbon Facts

Carbon facts prototype

class qarnot.carbon_facts.CarbonFacts(energy_consumption: float = 0, energy_it: float = 0, energy_reuse: float = 0, carbon_footprint: float = 0, equivalent_dc_name: str = '', equivalent_dc_carbon_footprint: float = 0, saved_carbon_footprint_compute: float = 0, saved_carbon_footprint_heat: float = 0, saved_carbon_footprint_compute_heat: float = 0, saved_carbon_footprint_percent: float = 0, PUE: float = 0, ERE: float = 0, ERF: float = 0, WUE: float = 0)[source]

Bases: object

Carbon facts details of a computed element

__init__(energy_consumption: float = 0, energy_it: float = 0, energy_reuse: float = 0, carbon_footprint: float = 0, equivalent_dc_name: str = '', equivalent_dc_carbon_footprint: float = 0, saved_carbon_footprint_compute: float = 0, saved_carbon_footprint_heat: float = 0, saved_carbon_footprint_compute_heat: float = 0, saved_carbon_footprint_percent: float = 0, PUE: float = 0, ERE: float = 0, ERF: float = 0, WUE: float = 0)[source]

The CarbonFacts constructor

Parameters:
  • energy_consumption (float) – the total energy consumed, in W.h

  • energy_it (float) – the energy consumed by IT, in W.h

  • energy_reuse (float) – the reuse heat, in W.h

  • carbon_footprint (float) – the actual carbon footprint of the computation, in gCO2eq

  • equivalent_dc_name (str) – the name of the equivalent datacenter used for comparison

  • equivalent_dc_carbon_footprint (float) – the carbon footprint the computation would generate in an equivalent DC, in gCO2eq

  • saved_carbon_footprint_compute (float) – the carbon footprint saved by the computation part by using Qarnot instead of the equivalent DC, in gCO2eq

  • saved_carbon_footprint_heat (float) – the carbon footprint saved by the heating part by using Qarnot instead of the equivalent DC, in gCO2eq

  • saved_carbon_footprint_compute_heat (float) – the total carbon footprint saved by using Qarnot instead of the equivalent DC, gCO2eq

  • saved_carbon_footprint_percent (float) – the percentage of carbon footprint saved by using Qarnot instead of the equivalent DC, in %

  • PUE (float) – the energy efficiency of the computation site

  • ERE (float) – the energy reuse ratio of the computation site

  • ERF (float) – the heat reuse ratio of the computation site

  • WUE (float) – the water consumption of the computation site, in L/kWh

classmethod from_json(json: Dict[str, Any])[source]

Create a CarbonFacts from a json representation

Parameters:

json (Dict[str, float]) – the json to use to create the SecretsAccessRights object.

Returns:

The created CarbonFacts.

to_json() object[source]

Get a dict ready to be json packed.

Returns:

the json elements of the class.

Return type:

dict

class qarnot.carbon_facts.CarbonClient(connection, datacenter_name: str | None = None)[source]

Bases: object

Client used to interact with the Qarnot carbon API.

__init__(connection, datacenter_name: str | None = None)[source]

The CarbonClient constructor.

Parameters:
  • connection (qarnot.connection.Connection) – the cluster from where carbon facts are retrieved.

  • datacenter_name (str) – the name of the datacenter used as reference to compare carbon facts.

get_pool_carbon_facts(pool_id: str) CarbonFacts[source]

Retrieves the carbon facts of the pool pool_id and parses it to a CarbonFacts object.

Parameters:

pool_id (str) – the uuid of the pool

Return type:

CarbonFacts

Raises:
get_task_carbon_facts(task_id: str) CarbonFacts[source]

Retrieves the carbon facts of the task task_id and parses it to a CarbonFacts object.

Parameters:

task_id (str) – the uuid of the task

Return type:

CarbonFacts

Raises: