Skip to content

Commit effbd2e

Browse files
authored
Merge pull request #748 from simvue-io/wk9874/2.0.0_rc1
Wk9874/2.0.0 rc1
2 parents 2a946a0 + cc4d70c commit effbd2e

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

simvue/api/objects/artifact/file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def new(
8787
if offline:
8888
return _artifact
8989

90-
with open(file_path, "rb") as out_f:
90+
with open(_file_orig_path, "rb") as out_f:
9191
_artifact._upload(file=out_f)
9292

9393
return _artifact

simvue/api/objects/base.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
except ImportError:
3838
from typing_extensions import Self
3939

40+
# Need to use this inside of Generator typing to fix bug present in Python 3.10 - see issue #745
41+
T = typing.TypeVar("T", bound="SimvueObject")
42+
4043

4144
def staging_check(member_func: typing.Callable) -> typing.Callable:
4245
"""Decorator for checking if requested attribute has uncommitted changes"""
@@ -318,7 +321,7 @@ def get(
318321
count: pydantic.PositiveInt | None = None,
319322
offset: pydantic.NonNegativeInt | None = None,
320323
**kwargs,
321-
) -> typing.Generator[tuple[str, Self | None], None, None]:
324+
) -> typing.Generator[tuple[str, T | None], None, None]:
322325
_class_instance = cls(_read_only=True, _local=True)
323326
if (_data := cls._get_all_objects(count, offset, **kwargs).get("data")) is None:
324327
raise RuntimeError(

simvue/eco.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ def out(
3535
try:
3636
self._simvue_run.update_metadata(
3737
{
38-
"codecarbon": {
38+
"sustainability": {
3939
"country": total.country_name,
4040
"country_iso_code": total.country_iso_code,
4141
"region": total.region,
42-
"version": total.codecarbon_version,
42+
"codecarbon_version": total.codecarbon_version,
4343
}
4444
}
4545
)
@@ -57,10 +57,10 @@ def out(
5757
try:
5858
self._simvue_run.log_metrics(
5959
metrics={
60-
"codecarbon.total.emissions": total.emissions,
61-
"codecarbon.total.energy_consumed": total.energy_consumed,
62-
"codecarbon.delta.emissions": delta.emissions,
63-
"codecarbon.delta.energy_consumed": delta.energy_consumed,
60+
"sustainability.emissions.total": total.emissions,
61+
"sustainability.energy_consumed.total": total.energy_consumed,
62+
"sustainability.emissions.delta": delta.emissions,
63+
"sustainability.energy_consumed.delta": delta.energy_consumed,
6464
},
6565
step=self._metrics_step,
6666
timestamp=simvue_timestamp(_cc_timestamp),

tests/functional/test_run_class.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def test_run_with_emissions() -> None:
5858
_metric_names = [item[0] for item in _run.metrics]
5959
client = sv_cl.Client()
6060
for _metric in ["emissions", "energy_consumed"]:
61-
_total_metric_name = f'codecarbon.total.{_metric}'
62-
_delta_metric_name = f'codecarbon.delta.{_metric}'
61+
_total_metric_name = f'sustainability.{_metric}.total'
62+
_delta_metric_name = f'sustainability.{_metric}.delta'
6363
assert _total_metric_name in _metric_names
6464
assert _delta_metric_name in _metric_names
6565
_metric_values = client.get_metric_values(metric_names=[_total_metric_name, _delta_metric_name], xaxis="time", output_format="dataframe", run_ids=[run_created.id])

0 commit comments

Comments
 (0)