diff --git a/codecarbon/_version.py b/codecarbon/_version.py index 528787cfc..055276878 100644 --- a/codecarbon/_version.py +++ b/codecarbon/_version.py @@ -1 +1 @@ -__version__ = "3.0.0" +__version__ = "3.0.1" diff --git a/codecarbon/emissions_tracker.py b/codecarbon/emissions_tracker.py index 24ee26c4f..9b4294d73 100644 --- a/codecarbon/emissions_tracker.py +++ b/codecarbon/emissions_tracker.py @@ -123,14 +123,18 @@ def _set_from_conf( # no value provided in the constructor for `name`: check in the conf # (using the provided default value) value = self._external_conf.get(name, default) - - # parse to `return_type` if needed - if return_type is not None: + if value is not None and return_type is not None: if return_type is bool: value = str(value).lower() == "true" else: assert callable(return_type) - value = return_type(value) + try: + value = return_type(value) + except (ValueError, TypeError): + logger.error( + f"CONFIG - Value for '{name}' must be of type '{return_type.__name__}'. Got '{value}' instead. It will be ignored." + ) + value = None # Check conf if name == "output_dir": if not os.path.exists(value): @@ -280,10 +284,10 @@ def __init__( self._set_from_conf(tracking_mode, "tracking_mode", "machine") self._set_from_conf(on_csv_write, "on_csv_write", "append") self._set_from_conf(logger_preamble, "logger_preamble", "") - self._set_from_conf(force_cpu_power, "force_cpu_power") - self._set_from_conf(force_ram_power, "force_ram_power") + self._set_from_conf(force_cpu_power, "force_cpu_power", None, float) + self._set_from_conf(force_ram_power, "force_ram_power", None, float) self._set_from_conf(pue, "pue", 1.0, float) - self._set_from_conf(force_mode_cpu_load, "force_mode_cpu_load", False) + self._set_from_conf(force_mode_cpu_load, "force_mode_cpu_load", False, bool) self._set_from_conf( experiment_id, "experiment_id", "5b0fa12a-3dd7-45bb-9766-cc326314d9f1" ) diff --git a/docs/.buildinfo b/docs/.buildinfo index 3e62a9af1..037f452e7 100644 --- a/docs/.buildinfo +++ b/docs/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file records the configuration used when building these files. When it is not found, a full rebuild will be done. -config: d75eb8ce15708524ae1fb27acec993bc +config: efdde624c3e18e32d8a147d48b8c5ee5 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js index e1ef608cd..12d3d03c1 100644 --- a/docs/_static/documentation_options.js +++ b/docs/_static/documentation_options.js @@ -1,5 +1,5 @@ const DOCUMENTATION_OPTIONS = { - VERSION: '3.0.0', + VERSION: '3.0.1', LANGUAGE: 'en', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/advanced_installation.html b/docs/advanced_installation.html index 2491f629d..9f2d6749f 100644 --- a/docs/advanced_installation.html +++ b/docs/advanced_installation.html @@ -6,14 +6,14 @@ - Advanced Installation — CodeCarbon 3.0.0 documentation + Advanced Installation — CodeCarbon 3.0.1 documentation - + diff --git a/docs/api.html b/docs/api.html index 80938dd25..7358b97ee 100644 --- a/docs/api.html +++ b/docs/api.html @@ -6,14 +6,14 @@ - CodeCarbon API — CodeCarbon 3.0.0 documentation + CodeCarbon API — CodeCarbon 3.0.1 documentation - + diff --git a/docs/comet.html b/docs/comet.html index a725d9343..380475ad8 100644 --- a/docs/comet.html +++ b/docs/comet.html @@ -6,14 +6,14 @@ - Comet Integration — CodeCarbon 3.0.0 documentation + Comet Integration — CodeCarbon 3.0.1 documentation - + diff --git a/docs/edit/conf.py b/docs/edit/conf.py index 4b90c69bb..6573a0f7b 100644 --- a/docs/edit/conf.py +++ b/docs/edit/conf.py @@ -24,7 +24,7 @@ # The full version, including alpha/beta/rc tags -release = "3.0.0" +release = "3.0.1" # -- General configuration --------------------------------------------------- diff --git a/docs/examples.html b/docs/examples.html index 5dbf40b7a..b0c3fc04f 100644 --- a/docs/examples.html +++ b/docs/examples.html @@ -6,14 +6,14 @@ - Examples — CodeCarbon 3.0.0 documentation + Examples — CodeCarbon 3.0.1 documentation - + diff --git a/docs/faq.html b/docs/faq.html index 8625f26d5..8d52c7d53 100644 --- a/docs/faq.html +++ b/docs/faq.html @@ -6,14 +6,14 @@ - Frequently Asked Questions — CodeCarbon 3.0.0 documentation + Frequently Asked Questions — CodeCarbon 3.0.1 documentation - + diff --git a/docs/genindex.html b/docs/genindex.html index 8c6669582..fee038726 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -5,14 +5,14 @@ - Index — CodeCarbon 3.0.0 documentation + Index — CodeCarbon 3.0.1 documentation - + diff --git a/docs/index.html b/docs/index.html index 935908a5e..a062a98b7 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,14 +6,14 @@ - CodeCarbon — CodeCarbon 3.0.0 documentation + CodeCarbon — CodeCarbon 3.0.1 documentation - + diff --git a/docs/installation.html b/docs/installation.html index 9a594eb16..e1dc5438b 100644 --- a/docs/installation.html +++ b/docs/installation.html @@ -6,14 +6,14 @@ - Installing CodeCarbon — CodeCarbon 3.0.0 documentation + Installing CodeCarbon — CodeCarbon 3.0.1 documentation - + diff --git a/docs/methodology.html b/docs/methodology.html index 9de2d3e9f..baefde0f2 100644 --- a/docs/methodology.html +++ b/docs/methodology.html @@ -6,14 +6,14 @@ - Methodology — CodeCarbon 3.0.0 documentation + Methodology — CodeCarbon 3.0.1 documentation - + diff --git a/docs/model_examples.html b/docs/model_examples.html index 9e2effa65..baccfc99a 100644 --- a/docs/model_examples.html +++ b/docs/model_examples.html @@ -6,14 +6,14 @@ - Model Comparisons — CodeCarbon 3.0.0 documentation + Model Comparisons — CodeCarbon 3.0.1 documentation - + diff --git a/docs/motivation.html b/docs/motivation.html index 8c51900a7..69bdb0aa2 100644 --- a/docs/motivation.html +++ b/docs/motivation.html @@ -6,14 +6,14 @@ - Motivation — CodeCarbon 3.0.0 documentation + Motivation — CodeCarbon 3.0.1 documentation - + diff --git a/docs/output.html b/docs/output.html index 4ae15590c..b8425b11a 100644 --- a/docs/output.html +++ b/docs/output.html @@ -6,14 +6,14 @@ - Output — CodeCarbon 3.0.0 documentation + Output — CodeCarbon 3.0.1 documentation - + diff --git a/docs/parameters.html b/docs/parameters.html index 5ce83f16c..e24c8b4cd 100644 --- a/docs/parameters.html +++ b/docs/parameters.html @@ -6,14 +6,14 @@ - Parameters — CodeCarbon 3.0.0 documentation + Parameters — CodeCarbon 3.0.1 documentation - + diff --git a/docs/search.html b/docs/search.html index 8bb47dba5..9876f0197 100644 --- a/docs/search.html +++ b/docs/search.html @@ -5,7 +5,7 @@ - Search — CodeCarbon 3.0.0 documentation + Search — CodeCarbon 3.0.1 documentation @@ -13,7 +13,7 @@ - + diff --git a/docs/test_on_scaleway.html b/docs/test_on_scaleway.html index 44e82f1ef..bcf846af4 100644 --- a/docs/test_on_scaleway.html +++ b/docs/test_on_scaleway.html @@ -6,14 +6,14 @@ - Test of CodeCarbon on Scaleway hardware — CodeCarbon 3.0.0 documentation + Test of CodeCarbon on Scaleway hardware — CodeCarbon 3.0.1 documentation - + diff --git a/docs/to_logger.html b/docs/to_logger.html index ebffb96ce..587a24096 100644 --- a/docs/to_logger.html +++ b/docs/to_logger.html @@ -6,14 +6,14 @@ - Collecting emissions to a logger — CodeCarbon 3.0.0 documentation + Collecting emissions to a logger — CodeCarbon 3.0.1 documentation - + diff --git a/docs/usage.html b/docs/usage.html index 9196e11d0..273e9be82 100644 --- a/docs/usage.html +++ b/docs/usage.html @@ -6,14 +6,14 @@ - Quickstart — CodeCarbon 3.0.0 documentation + Quickstart — CodeCarbon 3.0.1 documentation - + diff --git a/docs/visualize.html b/docs/visualize.html index 509d0fe0f..318be847b 100644 --- a/docs/visualize.html +++ b/docs/visualize.html @@ -6,14 +6,14 @@ - Visualize — CodeCarbon 3.0.0 documentation + Visualize — CodeCarbon 3.0.1 documentation - + diff --git a/pyproject.toml b/pyproject.toml index bff8f1051..e8748261f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -186,7 +186,7 @@ include = [ ] [tool.bumpver] -current_version = "3.0.0" +current_version = "3.0.1" version_pattern = "MAJOR.MINOR.PATCH[_TAGNUM]" [tool.bumpver.file_patterns] diff --git a/tests/test_config.py b/tests/test_config.py index 14f2fae73..3721a6e4d 100644 --- a/tests/test_config.py +++ b/tests/test_config.py @@ -163,6 +163,8 @@ def test_full_hierarchy(self): """\ [codecarbon] measure_power_secs=10 + force_cpu_power=toto + force_ram_power=50.5 output_dir=ERROR:not overwritten save_to_file=ERROR:not overwritten """ @@ -184,6 +186,8 @@ def test_full_hierarchy(self): project_name="test-project", co2_signal_api_token="signal-token" ) self.assertEqual(tracker._measure_power_secs, 10) + self.assertEqual(tracker._force_cpu_power, None) + self.assertEqual(tracker._force_ram_power, 50.5) self.assertEqual(tracker._output_dir, "/success/overwritten") self.assertEqual(tracker._emissions_endpoint, "http://testhost:2000") self.assertEqual(tracker._gpu_ids, [0, 1])