Skip to content

Commit db78982

Browse files
committed
A couple of bug fixes including threading issues
1 parent 230e2f7 commit db78982

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

simvue/api/objects/metrics.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ class Metrics(SimvueObject):
3434

3535
_label: str = "metric"
3636

37-
@override
3837
def __init__(
3938
self,
39+
identifier: str | None = None,
4040
*,
4141
server_url: str | None = None,
4242
server_token: pydantic.SecretStr | None = None,
@@ -56,7 +56,10 @@ def __init__(
5656
any additional arguments to be passed to the object initialiser
5757
"""
5858
super().__init__(
59-
identifier=None, server_url=server_url, server_token=server_token, **kwargs
59+
identifier=identifier,
60+
server_url=server_url,
61+
server_token=server_token,
62+
**kwargs,
6063
)
6164
self._run_id = self._staging.get("run")
6265
self._is_set = True

simvue/client.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -675,18 +675,19 @@ def get_artifacts_as_files(
675675
with ThreadPoolExecutor(
676676
CONCURRENT_DOWNLOADS, thread_name_prefix=f"get_artifacts_run_{run_id}"
677677
) as executor:
678-
futures = [
679-
executor.submit(_download_artifact_to_file, artifact, output_dir)
678+
future_artifact_mapping = {
679+
executor.submit(
680+
_download_artifact_to_file, artifact, output_dir
681+
): artifact
680682
for _, artifact in _artifacts
681-
]
682-
for future, (_, artifact) in zip(
683-
as_completed(futures), _artifacts, strict=True
684-
):
683+
}
684+
for future in as_completed(future_artifact_mapping):
685+
_artifact = future_artifact_mapping[future]
685686
try:
686687
future.result()
687688
except Exception as e:
688689
raise RuntimeError(
689-
f"Download of file {artifact.storage_url} "
690+
f"Download of file {_artifact.storage_url} "
690691
f"failed with exception: {e}"
691692
) from e
692693

0 commit comments

Comments
 (0)