wandb 0.19.7__py3-none-macosx_11_0_arm64.whl → 0.19.8__py3-none-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wandb/__init__.py +1 -1
- wandb/__init__.pyi +32 -2
- wandb/bin/gpu_stats +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/data_types.py +1 -1
- wandb/filesync/dir_watcher.py +2 -1
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
- wandb/proto/v5/wandb_settings_pb2.py +2 -2
- wandb/proto/v5/wandb_telemetry_pb2.py +10 -10
- wandb/sdk/artifacts/artifact.py +11 -10
- wandb/sdk/backend/backend.py +16 -5
- wandb/sdk/interface/interface.py +65 -43
- wandb/sdk/interface/interface_queue.py +0 -7
- wandb/sdk/interface/interface_relay.py +6 -16
- wandb/sdk/interface/interface_shared.py +47 -40
- wandb/sdk/interface/interface_sock.py +1 -8
- wandb/sdk/interface/router.py +22 -54
- wandb/sdk/interface/router_queue.py +11 -10
- wandb/sdk/interface/router_relay.py +24 -12
- wandb/sdk/interface/router_sock.py +6 -11
- wandb/sdk/internal/sender.py +3 -1
- wandb/sdk/lib/console_capture.py +172 -0
- wandb/sdk/lib/redirect.py +102 -76
- wandb/sdk/lib/service_connection.py +37 -17
- wandb/sdk/lib/sock_client.py +2 -52
- wandb/sdk/mailbox/__init__.py +3 -3
- wandb/sdk/mailbox/mailbox.py +31 -17
- wandb/sdk/mailbox/mailbox_handle.py +127 -0
- wandb/sdk/mailbox/{handles.py → response_handle.py} +34 -66
- wandb/sdk/mailbox/wait_with_progress.py +16 -15
- wandb/sdk/service/server_sock.py +4 -2
- wandb/sdk/service/streams.py +10 -5
- wandb/sdk/wandb_init.py +12 -15
- wandb/sdk/wandb_run.py +8 -10
- wandb/sdk/wandb_settings.py +7 -1
- wandb/sdk/wandb_sync.py +1 -7
- {wandb-0.19.7.dist-info → wandb-0.19.8.dist-info}/METADATA +1 -1
- {wandb-0.19.7.dist-info → wandb-0.19.8.dist-info}/RECORD +44 -44
- wandb/sdk/interface/message_future.py +0 -27
- wandb/sdk/interface/message_future_poll.py +0 -50
- {wandb-0.19.7.dist-info → wandb-0.19.8.dist-info}/WHEEL +0 -0
- {wandb-0.19.7.dist-info → wandb-0.19.8.dist-info}/entry_points.txt +0 -0
- {wandb-0.19.7.dist-info → wandb-0.19.8.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/artifacts/artifact.py
CHANGED
@@ -41,6 +41,7 @@ from wandb.apis.normalize import normalize_exceptions
|
|
41
41
|
from wandb.apis.public import ArtifactCollection, ArtifactFiles, RetryingClient, Run
|
42
42
|
from wandb.data_types import WBValue
|
43
43
|
from wandb.errors.term import termerror, termlog, termwarn
|
44
|
+
from wandb.proto import wandb_internal_pb2 as pb
|
44
45
|
from wandb.sdk.artifacts._graphql_fragments import _gql_artifact_fragment
|
45
46
|
from wandb.sdk.artifacts._validators import (
|
46
47
|
ensure_logged,
|
@@ -73,7 +74,7 @@ from wandb.sdk.lib.deprecate import Deprecated, deprecate
|
|
73
74
|
from wandb.sdk.lib.hashutil import B64MD5, b64_to_hex_id, md5_file_b64
|
74
75
|
from wandb.sdk.lib.paths import FilePathStr, LogicalPath, StrPath, URIStr
|
75
76
|
from wandb.sdk.lib.runid import generate_id
|
76
|
-
from wandb.sdk.mailbox import
|
77
|
+
from wandb.sdk.mailbox import MailboxHandle
|
77
78
|
|
78
79
|
reset_path = util.vendor_setup()
|
79
80
|
|
@@ -117,6 +118,9 @@ class Artifact:
|
|
117
118
|
description as markdown in the W&B App.
|
118
119
|
metadata: Additional information about an artifact. Specify metadata as a
|
119
120
|
dictionary of key-value pairs. You can specify no more than 100 total keys.
|
121
|
+
incremental: Use `Artifact.new_draft()` method instead to modify an
|
122
|
+
existing artifact.
|
123
|
+
use_as: W&B Launch specific parameter. Not recommended for general use.
|
120
124
|
|
121
125
|
Returns:
|
122
126
|
An `Artifact` object.
|
@@ -158,7 +162,7 @@ class Artifact:
|
|
158
162
|
self._tmp_dir: tempfile.TemporaryDirectory | None = None
|
159
163
|
self._added_objs: dict[int, tuple[WBValue, ArtifactManifestEntry]] = {}
|
160
164
|
self._added_local_paths: dict[str, ArtifactManifestEntry] = {}
|
161
|
-
self._save_handle: MailboxHandle | None = None
|
165
|
+
self._save_handle: MailboxHandle[pb.Result] | None = None
|
162
166
|
self._download_roots: set[str] = set()
|
163
167
|
# Set by new_draft(), otherwise the latest artifact will be used as the base.
|
164
168
|
self._base_id: str | None = None
|
@@ -421,7 +425,9 @@ class Artifact:
|
|
421
425
|
def new_draft(self) -> Artifact:
|
422
426
|
"""Create a new draft artifact with the same content as this committed artifact.
|
423
427
|
|
424
|
-
|
428
|
+
Modifying an existing artifact creates a new artifact version known
|
429
|
+
as an "incremental artifact". The artifact returned can be extended or
|
430
|
+
modified and logged as a new version.
|
425
431
|
|
426
432
|
Returns:
|
427
433
|
An `Artifact` object.
|
@@ -956,7 +962,7 @@ class Artifact:
|
|
956
962
|
|
957
963
|
def _set_save_handle(
|
958
964
|
self,
|
959
|
-
save_handle: MailboxHandle,
|
965
|
+
save_handle: MailboxHandle[pb.Result],
|
960
966
|
client: RetryingClient,
|
961
967
|
) -> None:
|
962
968
|
self._save_handle = save_handle
|
@@ -1828,12 +1834,7 @@ class Artifact:
|
|
1828
1834
|
service = wl.ensure_service()
|
1829
1835
|
service.inform_init(settings=settings, run_id=stream_id)
|
1830
1836
|
|
1831
|
-
|
1832
|
-
backend = Backend(
|
1833
|
-
settings=wl.settings,
|
1834
|
-
service=service,
|
1835
|
-
mailbox=mailbox,
|
1836
|
-
)
|
1837
|
+
backend = Backend(settings=wl.settings, service=service)
|
1837
1838
|
backend.ensure_launched()
|
1838
1839
|
|
1839
1840
|
assert backend.interface
|
wandb/sdk/backend/backend.py
CHANGED
@@ -16,6 +16,7 @@ from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Union
|
|
16
16
|
import wandb
|
17
17
|
from wandb.sdk.interface.interface import InterfaceBase
|
18
18
|
from wandb.sdk.interface.interface_queue import InterfaceQueue
|
19
|
+
from wandb.sdk.interface.router_queue import MessageQueueRouter
|
19
20
|
from wandb.sdk.internal.internal import wandb_internal
|
20
21
|
from wandb.sdk.internal.settings_static import SettingsStatic
|
21
22
|
from wandb.sdk.mailbox import Mailbox
|
@@ -49,17 +50,18 @@ class BackendThread(threading.Thread):
|
|
49
50
|
class Backend:
|
50
51
|
# multiprocessing context or module
|
51
52
|
_multiprocessing: multiprocessing.context.BaseContext
|
53
|
+
|
52
54
|
interface: Optional[InterfaceBase]
|
55
|
+
_router: Optional[MessageQueueRouter]
|
56
|
+
|
53
57
|
_internal_pid: Optional[int]
|
54
58
|
wandb_process: Optional[multiprocessing.process.BaseProcess]
|
55
59
|
_settings: Settings
|
56
60
|
record_q: Optional["RecordQueue"]
|
57
61
|
result_q: Optional["ResultQueue"]
|
58
|
-
_mailbox: Mailbox
|
59
62
|
|
60
63
|
def __init__(
|
61
64
|
self,
|
62
|
-
mailbox: Mailbox,
|
63
65
|
settings: Settings,
|
64
66
|
log_level: Optional[int] = None,
|
65
67
|
service: "Optional[service_connection.ServiceConnection]" = None,
|
@@ -68,12 +70,14 @@ class Backend:
|
|
68
70
|
self.record_q = None
|
69
71
|
self.result_q = None
|
70
72
|
self.wandb_process = None
|
73
|
+
|
71
74
|
self.interface = None
|
75
|
+
self._router = None
|
76
|
+
|
72
77
|
self._internal_pid = None
|
73
78
|
self._settings = settings
|
74
79
|
self._log_level = log_level
|
75
80
|
self._service = service
|
76
|
-
self._mailbox = mailbox
|
77
81
|
|
78
82
|
self._multiprocessing = multiprocessing # type: ignore
|
79
83
|
self._multiprocessing_setup()
|
@@ -136,7 +140,6 @@ class Backend:
|
|
136
140
|
if self._service:
|
137
141
|
assert self._settings.run_id
|
138
142
|
self.interface = self._service.make_interface(
|
139
|
-
self._mailbox,
|
140
143
|
stream_id=self._settings.run_id,
|
141
144
|
)
|
142
145
|
return
|
@@ -190,11 +193,17 @@ class Backend:
|
|
190
193
|
|
191
194
|
self._module_main_uninstall()
|
192
195
|
|
196
|
+
mailbox = Mailbox()
|
193
197
|
self.interface = InterfaceQueue(
|
194
198
|
process=self.wandb_process,
|
195
199
|
record_q=self.record_q, # type: ignore
|
196
200
|
result_q=self.result_q, # type: ignore
|
197
|
-
mailbox=
|
201
|
+
mailbox=mailbox,
|
202
|
+
)
|
203
|
+
self._router = MessageQueueRouter(
|
204
|
+
request_queue=self.record_q, # type: ignore
|
205
|
+
response_queue=self.result_q, # type: ignore
|
206
|
+
mailbox=mailbox,
|
198
207
|
)
|
199
208
|
|
200
209
|
def server_status(self) -> None:
|
@@ -207,6 +216,8 @@ class Backend:
|
|
207
216
|
self._done = True
|
208
217
|
if self.interface:
|
209
218
|
self.interface.join()
|
219
|
+
if self._router:
|
220
|
+
self._router.join()
|
210
221
|
if self.wandb_process:
|
211
222
|
self.wandb_process.join()
|
212
223
|
|
wandb/sdk/interface/interface.py
CHANGED
@@ -4,8 +4,6 @@ InterfaceBase: The abstract class
|
|
4
4
|
InterfaceShared: Common routines for socket and queue based implementations
|
5
5
|
InterfaceQueue: Use multiprocessing queues to send and receive messages
|
6
6
|
InterfaceSock: Use socket to send and receive messages
|
7
|
-
InterfaceRelay: Responses are routed to a relay queue (not matching uuids)
|
8
|
-
|
9
7
|
"""
|
10
8
|
|
11
9
|
import gzip
|
@@ -102,14 +100,14 @@ class InterfaceBase:
|
|
102
100
|
def _publish_header(self, header: pb.HeaderRecord) -> None:
|
103
101
|
raise NotImplementedError
|
104
102
|
|
105
|
-
def deliver_status(self) -> MailboxHandle:
|
103
|
+
def deliver_status(self) -> MailboxHandle[pb.Result]:
|
106
104
|
return self._deliver_status(pb.StatusRequest())
|
107
105
|
|
108
106
|
@abstractmethod
|
109
107
|
def _deliver_status(
|
110
108
|
self,
|
111
109
|
status: pb.StatusRequest,
|
112
|
-
) -> MailboxHandle:
|
110
|
+
) -> MailboxHandle[pb.Result]:
|
113
111
|
raise NotImplementedError
|
114
112
|
|
115
113
|
def _make_config(
|
@@ -435,7 +433,7 @@ class InterfaceBase:
|
|
435
433
|
entity: Optional[str] = None,
|
436
434
|
project: Optional[str] = None,
|
437
435
|
organization: Optional[str] = None,
|
438
|
-
) -> MailboxHandle:
|
436
|
+
) -> MailboxHandle[pb.Result]:
|
439
437
|
link_artifact = pb.LinkArtifactRequest()
|
440
438
|
if artifact.is_draft():
|
441
439
|
link_artifact.client_id = artifact._client_id
|
@@ -452,7 +450,7 @@ class InterfaceBase:
|
|
452
450
|
@abstractmethod
|
453
451
|
def _deliver_link_artifact(
|
454
452
|
self, link_artifact: pb.LinkArtifactRequest
|
455
|
-
) -> MailboxHandle:
|
453
|
+
) -> MailboxHandle[pb.Result]:
|
456
454
|
raise NotImplementedError
|
457
455
|
|
458
456
|
@staticmethod
|
@@ -570,7 +568,7 @@ class InterfaceBase:
|
|
570
568
|
is_user_created: bool = False,
|
571
569
|
use_after_commit: bool = False,
|
572
570
|
finalize: bool = True,
|
573
|
-
) -> MailboxHandle:
|
571
|
+
) -> MailboxHandle[pb.Result]:
|
574
572
|
proto_run = self._make_run(run)
|
575
573
|
proto_artifact = self._make_artifact(artifact)
|
576
574
|
proto_artifact.run_id = proto_run.run_id
|
@@ -595,7 +593,7 @@ class InterfaceBase:
|
|
595
593
|
def _deliver_artifact(
|
596
594
|
self,
|
597
595
|
log_artifact: pb.LogArtifactRequest,
|
598
|
-
) -> MailboxHandle:
|
596
|
+
) -> MailboxHandle[pb.Result]:
|
599
597
|
raise NotImplementedError
|
600
598
|
|
601
599
|
def deliver_download_artifact(
|
@@ -605,7 +603,7 @@ class InterfaceBase:
|
|
605
603
|
allow_missing_references: bool,
|
606
604
|
skip_cache: bool,
|
607
605
|
path_prefix: Optional[str],
|
608
|
-
) -> MailboxHandle:
|
606
|
+
) -> MailboxHandle[pb.Result]:
|
609
607
|
download_artifact = pb.DownloadArtifactRequest()
|
610
608
|
download_artifact.artifact_id = artifact_id
|
611
609
|
download_artifact.download_root = download_root
|
@@ -618,7 +616,7 @@ class InterfaceBase:
|
|
618
616
|
@abstractmethod
|
619
617
|
def _deliver_download_artifact(
|
620
618
|
self, download_artifact: pb.DownloadArtifactRequest
|
621
|
-
) -> MailboxHandle:
|
619
|
+
) -> MailboxHandle[pb.Result]:
|
622
620
|
raise NotImplementedError
|
623
621
|
|
624
622
|
def publish_artifact(
|
@@ -870,7 +868,9 @@ class InterfaceBase:
|
|
870
868
|
return self._publish_job_input(request)
|
871
869
|
|
872
870
|
@abstractmethod
|
873
|
-
def _publish_job_input(
|
871
|
+
def _publish_job_input(
|
872
|
+
self, request: pb.JobInputRequest
|
873
|
+
) -> MailboxHandle[pb.Result]:
|
874
874
|
raise NotImplementedError
|
875
875
|
|
876
876
|
def join(self) -> None:
|
@@ -892,143 +892,165 @@ class InterfaceBase:
|
|
892
892
|
logger.warning("handle abandoned while communicating shutdown")
|
893
893
|
|
894
894
|
@abstractmethod
|
895
|
-
def _deliver_shutdown(self) -> MailboxHandle:
|
895
|
+
def _deliver_shutdown(self) -> MailboxHandle[pb.Result]:
|
896
896
|
raise NotImplementedError
|
897
897
|
|
898
|
-
def deliver_run(self, run: "Run") -> MailboxHandle:
|
898
|
+
def deliver_run(self, run: "Run") -> MailboxHandle[pb.Result]:
|
899
899
|
run_record = self._make_run(run)
|
900
900
|
return self._deliver_run(run_record)
|
901
901
|
|
902
902
|
def deliver_finish_sync(
|
903
903
|
self,
|
904
|
-
) -> MailboxHandle:
|
904
|
+
) -> MailboxHandle[pb.Result]:
|
905
905
|
sync = pb.SyncFinishRequest()
|
906
906
|
return self._deliver_finish_sync(sync)
|
907
907
|
|
908
908
|
@abstractmethod
|
909
|
-
def _deliver_finish_sync(
|
909
|
+
def _deliver_finish_sync(
|
910
|
+
self, sync: pb.SyncFinishRequest
|
911
|
+
) -> MailboxHandle[pb.Result]:
|
910
912
|
raise NotImplementedError
|
911
913
|
|
912
914
|
@abstractmethod
|
913
|
-
def _deliver_run(self, run: pb.RunRecord) -> MailboxHandle:
|
915
|
+
def _deliver_run(self, run: pb.RunRecord) -> MailboxHandle[pb.Result]:
|
914
916
|
raise NotImplementedError
|
915
917
|
|
916
|
-
def deliver_run_start(self, run: "Run") -> MailboxHandle:
|
918
|
+
def deliver_run_start(self, run: "Run") -> MailboxHandle[pb.Result]:
|
917
919
|
run_start = pb.RunStartRequest(run=self._make_run(run))
|
918
920
|
return self._deliver_run_start(run_start)
|
919
921
|
|
920
922
|
@abstractmethod
|
921
|
-
def _deliver_run_start(
|
923
|
+
def _deliver_run_start(
|
924
|
+
self, run_start: pb.RunStartRequest
|
925
|
+
) -> MailboxHandle[pb.Result]:
|
922
926
|
raise NotImplementedError
|
923
927
|
|
924
|
-
def deliver_attach(self, attach_id: str) -> MailboxHandle:
|
928
|
+
def deliver_attach(self, attach_id: str) -> MailboxHandle[pb.Result]:
|
925
929
|
attach = pb.AttachRequest(attach_id=attach_id)
|
926
930
|
return self._deliver_attach(attach)
|
927
931
|
|
928
932
|
@abstractmethod
|
929
|
-
def _deliver_attach(
|
933
|
+
def _deliver_attach(
|
934
|
+
self,
|
935
|
+
status: pb.AttachRequest,
|
936
|
+
) -> MailboxHandle[pb.Result]:
|
930
937
|
raise NotImplementedError
|
931
938
|
|
932
|
-
def deliver_stop_status(self) -> MailboxHandle:
|
939
|
+
def deliver_stop_status(self) -> MailboxHandle[pb.Result]:
|
933
940
|
status = pb.StopStatusRequest()
|
934
941
|
return self._deliver_stop_status(status)
|
935
942
|
|
936
943
|
@abstractmethod
|
937
|
-
def _deliver_stop_status(
|
944
|
+
def _deliver_stop_status(
|
945
|
+
self,
|
946
|
+
status: pb.StopStatusRequest,
|
947
|
+
) -> MailboxHandle[pb.Result]:
|
938
948
|
raise NotImplementedError
|
939
949
|
|
940
|
-
def deliver_network_status(self) -> MailboxHandle:
|
950
|
+
def deliver_network_status(self) -> MailboxHandle[pb.Result]:
|
941
951
|
status = pb.NetworkStatusRequest()
|
942
952
|
return self._deliver_network_status(status)
|
943
953
|
|
944
954
|
@abstractmethod
|
945
|
-
def _deliver_network_status(
|
955
|
+
def _deliver_network_status(
|
956
|
+
self,
|
957
|
+
status: pb.NetworkStatusRequest,
|
958
|
+
) -> MailboxHandle[pb.Result]:
|
946
959
|
raise NotImplementedError
|
947
960
|
|
948
|
-
def deliver_internal_messages(self) -> MailboxHandle:
|
961
|
+
def deliver_internal_messages(self) -> MailboxHandle[pb.Result]:
|
949
962
|
internal_message = pb.InternalMessagesRequest()
|
950
963
|
return self._deliver_internal_messages(internal_message)
|
951
964
|
|
952
965
|
@abstractmethod
|
953
966
|
def _deliver_internal_messages(
|
954
967
|
self, internal_message: pb.InternalMessagesRequest
|
955
|
-
) -> MailboxHandle:
|
968
|
+
) -> MailboxHandle[pb.Result]:
|
956
969
|
raise NotImplementedError
|
957
970
|
|
958
|
-
def deliver_get_summary(self) -> MailboxHandle:
|
971
|
+
def deliver_get_summary(self) -> MailboxHandle[pb.Result]:
|
959
972
|
get_summary = pb.GetSummaryRequest()
|
960
973
|
return self._deliver_get_summary(get_summary)
|
961
974
|
|
962
975
|
@abstractmethod
|
963
|
-
def _deliver_get_summary(
|
976
|
+
def _deliver_get_summary(
|
977
|
+
self,
|
978
|
+
get_summary: pb.GetSummaryRequest,
|
979
|
+
) -> MailboxHandle[pb.Result]:
|
964
980
|
raise NotImplementedError
|
965
981
|
|
966
|
-
def deliver_get_system_metrics(self) -> MailboxHandle:
|
982
|
+
def deliver_get_system_metrics(self) -> MailboxHandle[pb.Result]:
|
967
983
|
get_system_metrics = pb.GetSystemMetricsRequest()
|
968
984
|
return self._deliver_get_system_metrics(get_system_metrics)
|
969
985
|
|
970
986
|
@abstractmethod
|
971
987
|
def _deliver_get_system_metrics(
|
972
988
|
self, get_summary: pb.GetSystemMetricsRequest
|
973
|
-
) -> MailboxHandle:
|
989
|
+
) -> MailboxHandle[pb.Result]:
|
974
990
|
raise NotImplementedError
|
975
991
|
|
976
|
-
def deliver_get_system_metadata(self) -> MailboxHandle:
|
992
|
+
def deliver_get_system_metadata(self) -> MailboxHandle[pb.Result]:
|
977
993
|
get_system_metadata = pb.GetSystemMetadataRequest()
|
978
994
|
return self._deliver_get_system_metadata(get_system_metadata)
|
979
995
|
|
980
996
|
@abstractmethod
|
981
997
|
def _deliver_get_system_metadata(
|
982
998
|
self, get_system_metadata: pb.GetSystemMetadataRequest
|
983
|
-
) -> MailboxHandle:
|
999
|
+
) -> MailboxHandle[pb.Result]:
|
984
1000
|
raise NotImplementedError
|
985
1001
|
|
986
|
-
def deliver_exit(self, exit_code: Optional[int]) -> MailboxHandle:
|
1002
|
+
def deliver_exit(self, exit_code: Optional[int]) -> MailboxHandle[pb.Result]:
|
987
1003
|
exit_data = self._make_exit(exit_code)
|
988
1004
|
return self._deliver_exit(exit_data)
|
989
1005
|
|
990
1006
|
@abstractmethod
|
991
|
-
def _deliver_exit(
|
1007
|
+
def _deliver_exit(
|
1008
|
+
self,
|
1009
|
+
exit_data: pb.RunExitRecord,
|
1010
|
+
) -> MailboxHandle[pb.Result]:
|
992
1011
|
raise NotImplementedError
|
993
1012
|
|
994
1013
|
@abstractmethod
|
995
|
-
def deliver_operation_stats(self) -> MailboxHandle:
|
1014
|
+
def deliver_operation_stats(self) -> MailboxHandle[pb.Result]:
|
996
1015
|
raise NotImplementedError
|
997
1016
|
|
998
|
-
def deliver_poll_exit(self) -> MailboxHandle:
|
1017
|
+
def deliver_poll_exit(self) -> MailboxHandle[pb.Result]:
|
999
1018
|
poll_exit = pb.PollExitRequest()
|
1000
1019
|
return self._deliver_poll_exit(poll_exit)
|
1001
1020
|
|
1002
1021
|
@abstractmethod
|
1003
|
-
def _deliver_poll_exit(
|
1022
|
+
def _deliver_poll_exit(
|
1023
|
+
self,
|
1024
|
+
poll_exit: pb.PollExitRequest,
|
1025
|
+
) -> MailboxHandle[pb.Result]:
|
1004
1026
|
raise NotImplementedError
|
1005
1027
|
|
1006
|
-
def deliver_finish_without_exit(self) -> MailboxHandle:
|
1028
|
+
def deliver_finish_without_exit(self) -> MailboxHandle[pb.Result]:
|
1007
1029
|
run_finish_without_exit = pb.RunFinishWithoutExitRequest()
|
1008
1030
|
return self._deliver_finish_without_exit(run_finish_without_exit)
|
1009
1031
|
|
1010
1032
|
@abstractmethod
|
1011
1033
|
def _deliver_finish_without_exit(
|
1012
1034
|
self, run_finish_without_exit: pb.RunFinishWithoutExitRequest
|
1013
|
-
) -> MailboxHandle:
|
1035
|
+
) -> MailboxHandle[pb.Result]:
|
1014
1036
|
raise NotImplementedError
|
1015
1037
|
|
1016
|
-
def deliver_request_sampled_history(self) -> MailboxHandle:
|
1038
|
+
def deliver_request_sampled_history(self) -> MailboxHandle[pb.Result]:
|
1017
1039
|
sampled_history = pb.SampledHistoryRequest()
|
1018
1040
|
return self._deliver_request_sampled_history(sampled_history)
|
1019
1041
|
|
1020
1042
|
@abstractmethod
|
1021
1043
|
def _deliver_request_sampled_history(
|
1022
1044
|
self, sampled_history: pb.SampledHistoryRequest
|
1023
|
-
) -> MailboxHandle:
|
1045
|
+
) -> MailboxHandle[pb.Result]:
|
1024
1046
|
raise NotImplementedError
|
1025
1047
|
|
1026
|
-
def deliver_request_run_status(self) -> MailboxHandle:
|
1048
|
+
def deliver_request_run_status(self) -> MailboxHandle[pb.Result]:
|
1027
1049
|
run_status = pb.RunStatusRequest()
|
1028
1050
|
return self._deliver_request_run_status(run_status)
|
1029
1051
|
|
1030
1052
|
@abstractmethod
|
1031
1053
|
def _deliver_request_run_status(
|
1032
1054
|
self, run_status: pb.RunStatusRequest
|
1033
|
-
) -> MailboxHandle:
|
1055
|
+
) -> MailboxHandle[pb.Result]:
|
1034
1056
|
raise NotImplementedError
|
@@ -11,7 +11,6 @@ from typing import TYPE_CHECKING, Optional
|
|
11
11
|
from wandb.sdk.mailbox import Mailbox
|
12
12
|
|
13
13
|
from .interface_shared import InterfaceShared
|
14
|
-
from .router_queue import MessageQueueRouter
|
15
14
|
|
16
15
|
if TYPE_CHECKING:
|
17
16
|
from queue import Queue
|
@@ -35,12 +34,6 @@ class InterfaceQueue(InterfaceShared):
|
|
35
34
|
self._process = process
|
36
35
|
super().__init__(mailbox=mailbox)
|
37
36
|
|
38
|
-
def _init_router(self) -> None:
|
39
|
-
if self.record_q and self.result_q:
|
40
|
-
self._router = MessageQueueRouter(
|
41
|
-
self.record_q, self.result_q, mailbox=self._mailbox
|
42
|
-
)
|
43
|
-
|
44
37
|
def _publish(self, record: "pb.Record", local: Optional[bool] = None) -> None:
|
45
38
|
if self._process and not self._process.is_alive():
|
46
39
|
raise Exception("The wandb backend process has shutdown")
|
@@ -1,17 +1,17 @@
|
|
1
1
|
"""InterfaceRelay - Derived from InterfaceQueue using RelayRouter to preserve uuid req/resp.
|
2
2
|
|
3
3
|
See interface.py for how interface classes relate to each other.
|
4
|
-
|
5
4
|
"""
|
6
5
|
|
6
|
+
from __future__ import annotations
|
7
|
+
|
7
8
|
import logging
|
8
|
-
from typing import TYPE_CHECKING
|
9
|
+
from typing import TYPE_CHECKING
|
9
10
|
|
10
11
|
from wandb.proto import wandb_internal_pb2 as pb
|
11
12
|
from wandb.sdk.mailbox import Mailbox
|
12
13
|
|
13
14
|
from .interface_queue import InterfaceQueue
|
14
|
-
from .router_relay import MessageRelayRouter
|
15
15
|
|
16
16
|
if TYPE_CHECKING:
|
17
17
|
from queue import Queue
|
@@ -22,14 +22,13 @@ logger = logging.getLogger("wandb")
|
|
22
22
|
|
23
23
|
class InterfaceRelay(InterfaceQueue):
|
24
24
|
_mailbox: Mailbox
|
25
|
-
relay_q: Optional["Queue[pb.Result]"]
|
26
25
|
|
27
26
|
def __init__(
|
28
27
|
self,
|
29
28
|
mailbox: Mailbox,
|
30
|
-
record_q:
|
31
|
-
result_q:
|
32
|
-
relay_q:
|
29
|
+
record_q: Queue[pb.Record],
|
30
|
+
result_q: Queue[pb.Result],
|
31
|
+
relay_q: Queue[pb.Result],
|
33
32
|
) -> None:
|
34
33
|
self.relay_q = relay_q
|
35
34
|
super().__init__(
|
@@ -37,12 +36,3 @@ class InterfaceRelay(InterfaceQueue):
|
|
37
36
|
result_q=result_q,
|
38
37
|
mailbox=mailbox,
|
39
38
|
)
|
40
|
-
|
41
|
-
def _init_router(self) -> None:
|
42
|
-
if self.record_q and self.result_q and self.relay_q:
|
43
|
-
self._router = MessageRelayRouter(
|
44
|
-
request_queue=self.record_q,
|
45
|
-
response_queue=self.result_q,
|
46
|
-
relay_queue=self.relay_q,
|
47
|
-
mailbox=self._mailbox,
|
48
|
-
)
|