Skip to content

Commit

Permalink
fix: try expect on type
Browse files Browse the repository at this point in the history
Signed-off-by: ThibaultFy <[email protected]>
  • Loading branch information
ThibaultFy committed Sep 12, 2023
1 parent 3ff6d92 commit b029e17
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
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(int(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(int(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 b029e17

Please sign in to comment.