Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion simvue/api/objects/artifact/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def new(
if offline:
return _artifact

with open(file_path, "rb") as out_f:
with open(_file_orig_path, "rb") as out_f:
_artifact._upload(file=out_f)

return _artifact
5 changes: 4 additions & 1 deletion simvue/api/objects/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@
except ImportError:
from typing_extensions import Self

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


def staging_check(member_func: typing.Callable) -> typing.Callable:
"""Decorator for checking if requested attribute has uncommitted changes"""
Expand Down Expand Up @@ -318,7 +321,7 @@ def get(
count: pydantic.PositiveInt | None = None,
offset: pydantic.NonNegativeInt | None = None,
**kwargs,
) -> typing.Generator[tuple[str, Self | None], None, None]:
) -> typing.Generator[tuple[str, T | None], None, None]:
_class_instance = cls(_read_only=True, _local=True)
if (_data := cls._get_all_objects(count, offset, **kwargs).get("data")) is None:
raise RuntimeError(
Expand Down
12 changes: 6 additions & 6 deletions simvue/eco.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ def out(
try:
self._simvue_run.update_metadata(
{
"codecarbon": {
"sustainability": {
"country": total.country_name,
"country_iso_code": total.country_iso_code,
"region": total.region,
"version": total.codecarbon_version,
"codecarbon_version": total.codecarbon_version,
}
}
)
Expand All @@ -57,10 +57,10 @@ def out(
try:
self._simvue_run.log_metrics(
metrics={
"codecarbon.total.emissions": total.emissions,
"codecarbon.total.energy_consumed": total.energy_consumed,
"codecarbon.delta.emissions": delta.emissions,
"codecarbon.delta.energy_consumed": delta.energy_consumed,
"sustainability.emissions.total": total.emissions,
"sustainability.energy_consumed.total": total.energy_consumed,
"sustainability.emissions.delta": delta.emissions,
"sustainability.energy_consumed.delta": delta.energy_consumed,
},
step=self._metrics_step,
timestamp=simvue_timestamp(_cc_timestamp),
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/test_run_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ def test_run_with_emissions() -> None:
_metric_names = [item[0] for item in _run.metrics]
client = sv_cl.Client()
for _metric in ["emissions", "energy_consumed"]:
_total_metric_name = f'codecarbon.total.{_metric}'
_delta_metric_name = f'codecarbon.delta.{_metric}'
_total_metric_name = f'sustainability.{_metric}.total'
_delta_metric_name = f'sustainability.{_metric}.delta'
assert _total_metric_name in _metric_names
assert _delta_metric_name in _metric_names
_metric_values = client.get_metric_values(metric_names=[_total_metric_name, _delta_metric_name], xaxis="time", output_format="dataframe", run_ids=[run_created.id])
Expand Down