Skip to content

Commit

Permalink
fix: convert round_idx metadata to int in Performances (#387)
Browse files Browse the repository at this point in the history
Signed-off-by: ThibaultFy <50656860+ThibaultFy@users.noreply.github.com>
  • Loading branch information
ThibaultFy authored Sep 12, 2023
1 parent 5b49ba8 commit 78127d9
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Changed

### Fixed

- Convert `round_idx` from metadata to `int` when creating `Performances` to fix Pydantic warning ([#387](https://github.com/Substra/substra/pull/387))

## [0.48.0](https://github.com/Substra/substra/releases/tag/0.48.0) - 2023-09-08

### Changed

- Update to pydantic 2.3.0 ([#375](https://github.com/Substra/substra/pull/375))

## [0.47.0](https://github.com/Substra/substra/releases/tag/0.47.0) - 2023-09-07
Expand Down
6 changes: 5 additions & 1 deletion substra/sdk/backends/local/dal.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,11 @@ def get_performances(self, key: str) -> models.Performances:
performances.worker.append(task.worker)
performances.task_key.append(task.key)
performances.task_rank.append(task.rank)
performances.round_idx.append(task.metadata.get("round_idx"))
try:
round_idx = int(task.metadata.get("round_idx"))
except TypeError:
round_idx = None
performances.round_idx.append(round_idx)
performances.identifier.append(output.identifier)
performances.performance.append(output.asset)

Expand Down
6 changes: 5 additions & 1 deletion substra/sdk/backends/remote/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ def get_performances(self, key: str) -> models.Performances:
performances.worker.append(test_task["compute_task"]["worker"])
performances.task_key.append(test_task["compute_task"]["key"])
performances.task_rank.append(test_task["compute_task"]["rank"])
performances.round_idx.append(test_task["compute_task"]["round_idx"])
try:
round_idx = int(test_task["compute_task"]["round_idx"])
except TypeError:
round_idx = None
performances.round_idx.append(round_idx)
performances.identifier.append(test_task["identifier"])
performances.performance.append(test_task["perf"])

Expand Down

0 comments on commit 78127d9

Please sign in to comment.