wandb 0.19.6rc4__py3-none-musllinux_1_2_aarch64.whl → 0.19.8__py3-none-musllinux_1_2_aarch64.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 +56 -6
- wandb/apis/public/_generated/__init__.py +21 -0
- wandb/apis/public/_generated/base.py +128 -0
- wandb/apis/public/_generated/enums.py +4 -0
- wandb/apis/public/_generated/input_types.py +4 -0
- wandb/apis/public/_generated/operations.py +15 -0
- wandb/apis/public/_generated/server_features_query.py +27 -0
- wandb/apis/public/_generated/typing_compat.py +14 -0
- wandb/apis/public/api.py +192 -6
- wandb/apis/public/artifacts.py +13 -45
- wandb/apis/public/registries.py +573 -0
- wandb/apis/public/utils.py +36 -0
- wandb/bin/gpu_stats +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/cli/cli.py +11 -20
- wandb/data_types.py +1 -1
- wandb/env.py +10 -0
- wandb/filesync/dir_watcher.py +2 -1
- wandb/proto/v3/wandb_internal_pb2.py +243 -222
- wandb/proto/v3/wandb_server_pb2.py +4 -4
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
- wandb/proto/v4/wandb_internal_pb2.py +226 -222
- wandb/proto/v4/wandb_server_pb2.py +4 -4
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
- wandb/proto/v5/wandb_internal_pb2.py +226 -222
- wandb/proto/v5/wandb_server_pb2.py +4 -4
- wandb/proto/v5/wandb_settings_pb2.py +2 -2
- wandb/proto/v5/wandb_telemetry_pb2.py +10 -10
- wandb/sdk/artifacts/_graphql_fragments.py +126 -0
- wandb/sdk/artifacts/artifact.py +51 -95
- wandb/sdk/backend/backend.py +17 -6
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +14 -6
- wandb/sdk/data_types/helper_types/image_mask.py +12 -6
- wandb/sdk/data_types/saved_model.py +35 -46
- wandb/sdk/data_types/video.py +7 -16
- wandb/sdk/interface/interface.py +87 -49
- wandb/sdk/interface/interface_queue.py +5 -15
- wandb/sdk/interface/interface_relay.py +7 -22
- wandb/sdk/interface/interface_shared.py +65 -136
- wandb/sdk/interface/interface_sock.py +3 -21
- wandb/sdk/interface/router.py +42 -68
- wandb/sdk/interface/router_queue.py +13 -11
- wandb/sdk/interface/router_relay.py +26 -13
- wandb/sdk/interface/router_sock.py +12 -16
- wandb/sdk/internal/handler.py +4 -3
- wandb/sdk/internal/internal_api.py +12 -1
- wandb/sdk/internal/sender.py +3 -19
- wandb/sdk/lib/apikey.py +87 -26
- wandb/sdk/lib/asyncio_compat.py +210 -0
- wandb/sdk/lib/console_capture.py +172 -0
- wandb/sdk/lib/progress.py +78 -16
- wandb/sdk/lib/redirect.py +102 -76
- wandb/sdk/lib/service_connection.py +37 -17
- wandb/sdk/lib/sock_client.py +6 -56
- wandb/sdk/mailbox/__init__.py +23 -0
- wandb/sdk/mailbox/mailbox.py +135 -0
- wandb/sdk/mailbox/mailbox_handle.py +127 -0
- wandb/sdk/mailbox/response_handle.py +167 -0
- wandb/sdk/mailbox/wait_with_progress.py +135 -0
- wandb/sdk/service/server_sock.py +9 -3
- wandb/sdk/service/streams.py +75 -78
- wandb/sdk/verify/verify.py +54 -2
- wandb/sdk/wandb_init.py +72 -75
- wandb/sdk/wandb_login.py +7 -4
- wandb/sdk/wandb_metadata.py +65 -34
- wandb/sdk/wandb_require.py +14 -8
- wandb/sdk/wandb_run.py +90 -97
- wandb/sdk/wandb_settings.py +10 -4
- wandb/sdk/wandb_setup.py +19 -8
- wandb/sdk/wandb_sync.py +2 -10
- wandb/util.py +3 -1
- {wandb-0.19.6rc4.dist-info → wandb-0.19.8.dist-info}/METADATA +2 -2
- {wandb-0.19.6rc4.dist-info → wandb-0.19.8.dist-info}/RECORD +79 -66
- wandb/sdk/interface/message_future.py +0 -27
- wandb/sdk/interface/message_future_poll.py +0 -50
- wandb/sdk/lib/mailbox.py +0 -442
- {wandb-0.19.6rc4.dist-info → wandb-0.19.8.dist-info}/WHEEL +0 -0
- {wandb-0.19.6rc4.dist-info → wandb-0.19.8.dist-info}/entry_points.txt +0 -0
- {wandb-0.19.6rc4.dist-info → wandb-0.19.8.dist-info}/licenses/LICENSE +0 -0
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
|
@@ -35,6 +33,7 @@ from wandb.sdk.artifacts.artifact import Artifact
|
|
35
33
|
from wandb.sdk.artifacts.artifact_manifest import ArtifactManifest
|
36
34
|
from wandb.sdk.artifacts.staging import get_staging_dir
|
37
35
|
from wandb.sdk.lib import json_util as json
|
36
|
+
from wandb.sdk.mailbox import HandleAbandonedError, MailboxHandle
|
38
37
|
from wandb.util import (
|
39
38
|
WandBJSONEncoderOld,
|
40
39
|
get_h5_typename,
|
@@ -46,9 +45,7 @@ from wandb.util import (
|
|
46
45
|
)
|
47
46
|
|
48
47
|
from ..data_types.utils import history_dict_to_json, val_to_json
|
49
|
-
from ..lib.mailbox import MailboxHandle
|
50
48
|
from . import summary_record as sr
|
51
|
-
from .message_future import MessageFuture
|
52
49
|
|
53
50
|
MANIFEST_FILE_SIZE_THRESHOLD = 100_000
|
54
51
|
|
@@ -103,14 +100,14 @@ class InterfaceBase:
|
|
103
100
|
def _publish_header(self, header: pb.HeaderRecord) -> None:
|
104
101
|
raise NotImplementedError
|
105
102
|
|
106
|
-
def deliver_status(self) -> MailboxHandle:
|
103
|
+
def deliver_status(self) -> MailboxHandle[pb.Result]:
|
107
104
|
return self._deliver_status(pb.StatusRequest())
|
108
105
|
|
109
106
|
@abstractmethod
|
110
107
|
def _deliver_status(
|
111
108
|
self,
|
112
109
|
status: pb.StatusRequest,
|
113
|
-
) -> MailboxHandle:
|
110
|
+
) -> MailboxHandle[pb.Result]:
|
114
111
|
raise NotImplementedError
|
115
112
|
|
116
113
|
def _make_config(
|
@@ -436,7 +433,7 @@ class InterfaceBase:
|
|
436
433
|
entity: Optional[str] = None,
|
437
434
|
project: Optional[str] = None,
|
438
435
|
organization: Optional[str] = None,
|
439
|
-
) -> MailboxHandle:
|
436
|
+
) -> MailboxHandle[pb.Result]:
|
440
437
|
link_artifact = pb.LinkArtifactRequest()
|
441
438
|
if artifact.is_draft():
|
442
439
|
link_artifact.client_id = artifact._client_id
|
@@ -453,7 +450,7 @@ class InterfaceBase:
|
|
453
450
|
@abstractmethod
|
454
451
|
def _deliver_link_artifact(
|
455
452
|
self, link_artifact: pb.LinkArtifactRequest
|
456
|
-
) -> MailboxHandle:
|
453
|
+
) -> MailboxHandle[pb.Result]:
|
457
454
|
raise NotImplementedError
|
458
455
|
|
459
456
|
@staticmethod
|
@@ -561,7 +558,7 @@ class InterfaceBase:
|
|
561
558
|
def _publish_use_artifact(self, proto_artifact: pb.UseArtifactRecord) -> None:
|
562
559
|
raise NotImplementedError
|
563
560
|
|
564
|
-
def
|
561
|
+
def deliver_artifact(
|
565
562
|
self,
|
566
563
|
run: "Run",
|
567
564
|
artifact: "Artifact",
|
@@ -571,7 +568,7 @@ class InterfaceBase:
|
|
571
568
|
is_user_created: bool = False,
|
572
569
|
use_after_commit: bool = False,
|
573
570
|
finalize: bool = True,
|
574
|
-
) ->
|
571
|
+
) -> MailboxHandle[pb.Result]:
|
575
572
|
proto_run = self._make_run(run)
|
576
573
|
proto_artifact = self._make_artifact(artifact)
|
577
574
|
proto_artifact.run_id = proto_run.run_id
|
@@ -589,13 +586,14 @@ class InterfaceBase:
|
|
589
586
|
if history_step is not None:
|
590
587
|
log_artifact.history_step = history_step
|
591
588
|
log_artifact.staging_dir = get_staging_dir()
|
592
|
-
resp = self.
|
589
|
+
resp = self._deliver_artifact(log_artifact)
|
593
590
|
return resp
|
594
591
|
|
595
592
|
@abstractmethod
|
596
|
-
def
|
597
|
-
self,
|
598
|
-
|
593
|
+
def _deliver_artifact(
|
594
|
+
self,
|
595
|
+
log_artifact: pb.LogArtifactRequest,
|
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,149 +868,189 @@ 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:
|
877
877
|
# Drop indicates that the internal process has already been shutdown
|
878
878
|
if self._drop:
|
879
879
|
return
|
880
|
-
|
880
|
+
|
881
|
+
handle = self._deliver_shutdown()
|
882
|
+
|
883
|
+
try:
|
884
|
+
handle.wait_or(timeout=30)
|
885
|
+
except TimeoutError:
|
886
|
+
# This can happen if the server fails to respond due to a bug
|
887
|
+
# or due to being very busy.
|
888
|
+
logger.warning("timed out communicating shutdown")
|
889
|
+
except HandleAbandonedError:
|
890
|
+
# This can happen if the connection to the server is closed
|
891
|
+
# before a response is read.
|
892
|
+
logger.warning("handle abandoned while communicating shutdown")
|
881
893
|
|
882
894
|
@abstractmethod
|
883
|
-
def
|
895
|
+
def _deliver_shutdown(self) -> MailboxHandle[pb.Result]:
|
884
896
|
raise NotImplementedError
|
885
897
|
|
886
|
-
def deliver_run(self, run: "Run") -> MailboxHandle:
|
898
|
+
def deliver_run(self, run: "Run") -> MailboxHandle[pb.Result]:
|
887
899
|
run_record = self._make_run(run)
|
888
900
|
return self._deliver_run(run_record)
|
889
901
|
|
890
902
|
def deliver_finish_sync(
|
891
903
|
self,
|
892
|
-
) -> MailboxHandle:
|
904
|
+
) -> MailboxHandle[pb.Result]:
|
893
905
|
sync = pb.SyncFinishRequest()
|
894
906
|
return self._deliver_finish_sync(sync)
|
895
907
|
|
896
908
|
@abstractmethod
|
897
|
-
def _deliver_finish_sync(
|
909
|
+
def _deliver_finish_sync(
|
910
|
+
self, sync: pb.SyncFinishRequest
|
911
|
+
) -> MailboxHandle[pb.Result]:
|
898
912
|
raise NotImplementedError
|
899
913
|
|
900
914
|
@abstractmethod
|
901
|
-
def _deliver_run(self, run: pb.RunRecord) -> MailboxHandle:
|
915
|
+
def _deliver_run(self, run: pb.RunRecord) -> MailboxHandle[pb.Result]:
|
902
916
|
raise NotImplementedError
|
903
917
|
|
904
|
-
def deliver_run_start(self, run: "Run") -> MailboxHandle:
|
918
|
+
def deliver_run_start(self, run: "Run") -> MailboxHandle[pb.Result]:
|
905
919
|
run_start = pb.RunStartRequest(run=self._make_run(run))
|
906
920
|
return self._deliver_run_start(run_start)
|
907
921
|
|
908
922
|
@abstractmethod
|
909
|
-
def _deliver_run_start(
|
923
|
+
def _deliver_run_start(
|
924
|
+
self, run_start: pb.RunStartRequest
|
925
|
+
) -> MailboxHandle[pb.Result]:
|
910
926
|
raise NotImplementedError
|
911
927
|
|
912
|
-
def deliver_attach(self, attach_id: str) -> MailboxHandle:
|
928
|
+
def deliver_attach(self, attach_id: str) -> MailboxHandle[pb.Result]:
|
913
929
|
attach = pb.AttachRequest(attach_id=attach_id)
|
914
930
|
return self._deliver_attach(attach)
|
915
931
|
|
916
932
|
@abstractmethod
|
917
|
-
def _deliver_attach(
|
933
|
+
def _deliver_attach(
|
934
|
+
self,
|
935
|
+
status: pb.AttachRequest,
|
936
|
+
) -> MailboxHandle[pb.Result]:
|
918
937
|
raise NotImplementedError
|
919
938
|
|
920
|
-
def deliver_stop_status(self) -> MailboxHandle:
|
939
|
+
def deliver_stop_status(self) -> MailboxHandle[pb.Result]:
|
921
940
|
status = pb.StopStatusRequest()
|
922
941
|
return self._deliver_stop_status(status)
|
923
942
|
|
924
943
|
@abstractmethod
|
925
|
-
def _deliver_stop_status(
|
944
|
+
def _deliver_stop_status(
|
945
|
+
self,
|
946
|
+
status: pb.StopStatusRequest,
|
947
|
+
) -> MailboxHandle[pb.Result]:
|
926
948
|
raise NotImplementedError
|
927
949
|
|
928
|
-
def deliver_network_status(self) -> MailboxHandle:
|
950
|
+
def deliver_network_status(self) -> MailboxHandle[pb.Result]:
|
929
951
|
status = pb.NetworkStatusRequest()
|
930
952
|
return self._deliver_network_status(status)
|
931
953
|
|
932
954
|
@abstractmethod
|
933
|
-
def _deliver_network_status(
|
955
|
+
def _deliver_network_status(
|
956
|
+
self,
|
957
|
+
status: pb.NetworkStatusRequest,
|
958
|
+
) -> MailboxHandle[pb.Result]:
|
934
959
|
raise NotImplementedError
|
935
960
|
|
936
|
-
def deliver_internal_messages(self) -> MailboxHandle:
|
961
|
+
def deliver_internal_messages(self) -> MailboxHandle[pb.Result]:
|
937
962
|
internal_message = pb.InternalMessagesRequest()
|
938
963
|
return self._deliver_internal_messages(internal_message)
|
939
964
|
|
940
965
|
@abstractmethod
|
941
966
|
def _deliver_internal_messages(
|
942
967
|
self, internal_message: pb.InternalMessagesRequest
|
943
|
-
) -> MailboxHandle:
|
968
|
+
) -> MailboxHandle[pb.Result]:
|
944
969
|
raise NotImplementedError
|
945
970
|
|
946
|
-
def deliver_get_summary(self) -> MailboxHandle:
|
971
|
+
def deliver_get_summary(self) -> MailboxHandle[pb.Result]:
|
947
972
|
get_summary = pb.GetSummaryRequest()
|
948
973
|
return self._deliver_get_summary(get_summary)
|
949
974
|
|
950
975
|
@abstractmethod
|
951
|
-
def _deliver_get_summary(
|
976
|
+
def _deliver_get_summary(
|
977
|
+
self,
|
978
|
+
get_summary: pb.GetSummaryRequest,
|
979
|
+
) -> MailboxHandle[pb.Result]:
|
952
980
|
raise NotImplementedError
|
953
981
|
|
954
|
-
def deliver_get_system_metrics(self) -> MailboxHandle:
|
982
|
+
def deliver_get_system_metrics(self) -> MailboxHandle[pb.Result]:
|
955
983
|
get_system_metrics = pb.GetSystemMetricsRequest()
|
956
984
|
return self._deliver_get_system_metrics(get_system_metrics)
|
957
985
|
|
958
986
|
@abstractmethod
|
959
987
|
def _deliver_get_system_metrics(
|
960
988
|
self, get_summary: pb.GetSystemMetricsRequest
|
961
|
-
) -> MailboxHandle:
|
989
|
+
) -> MailboxHandle[pb.Result]:
|
962
990
|
raise NotImplementedError
|
963
991
|
|
964
|
-
def deliver_get_system_metadata(self) -> MailboxHandle:
|
992
|
+
def deliver_get_system_metadata(self) -> MailboxHandle[pb.Result]:
|
965
993
|
get_system_metadata = pb.GetSystemMetadataRequest()
|
966
994
|
return self._deliver_get_system_metadata(get_system_metadata)
|
967
995
|
|
968
996
|
@abstractmethod
|
969
997
|
def _deliver_get_system_metadata(
|
970
998
|
self, get_system_metadata: pb.GetSystemMetadataRequest
|
971
|
-
) -> MailboxHandle:
|
999
|
+
) -> MailboxHandle[pb.Result]:
|
972
1000
|
raise NotImplementedError
|
973
1001
|
|
974
|
-
def deliver_exit(self, exit_code: Optional[int]) -> MailboxHandle:
|
1002
|
+
def deliver_exit(self, exit_code: Optional[int]) -> MailboxHandle[pb.Result]:
|
975
1003
|
exit_data = self._make_exit(exit_code)
|
976
1004
|
return self._deliver_exit(exit_data)
|
977
1005
|
|
978
1006
|
@abstractmethod
|
979
|
-
def _deliver_exit(
|
1007
|
+
def _deliver_exit(
|
1008
|
+
self,
|
1009
|
+
exit_data: pb.RunExitRecord,
|
1010
|
+
) -> MailboxHandle[pb.Result]:
|
1011
|
+
raise NotImplementedError
|
1012
|
+
|
1013
|
+
@abstractmethod
|
1014
|
+
def deliver_operation_stats(self) -> MailboxHandle[pb.Result]:
|
980
1015
|
raise NotImplementedError
|
981
1016
|
|
982
|
-
def deliver_poll_exit(self) -> MailboxHandle:
|
1017
|
+
def deliver_poll_exit(self) -> MailboxHandle[pb.Result]:
|
983
1018
|
poll_exit = pb.PollExitRequest()
|
984
1019
|
return self._deliver_poll_exit(poll_exit)
|
985
1020
|
|
986
1021
|
@abstractmethod
|
987
|
-
def _deliver_poll_exit(
|
1022
|
+
def _deliver_poll_exit(
|
1023
|
+
self,
|
1024
|
+
poll_exit: pb.PollExitRequest,
|
1025
|
+
) -> MailboxHandle[pb.Result]:
|
988
1026
|
raise NotImplementedError
|
989
1027
|
|
990
|
-
def deliver_finish_without_exit(self) -> MailboxHandle:
|
1028
|
+
def deliver_finish_without_exit(self) -> MailboxHandle[pb.Result]:
|
991
1029
|
run_finish_without_exit = pb.RunFinishWithoutExitRequest()
|
992
1030
|
return self._deliver_finish_without_exit(run_finish_without_exit)
|
993
1031
|
|
994
1032
|
@abstractmethod
|
995
1033
|
def _deliver_finish_without_exit(
|
996
1034
|
self, run_finish_without_exit: pb.RunFinishWithoutExitRequest
|
997
|
-
) -> MailboxHandle:
|
1035
|
+
) -> MailboxHandle[pb.Result]:
|
998
1036
|
raise NotImplementedError
|
999
1037
|
|
1000
|
-
def deliver_request_sampled_history(self) -> MailboxHandle:
|
1038
|
+
def deliver_request_sampled_history(self) -> MailboxHandle[pb.Result]:
|
1001
1039
|
sampled_history = pb.SampledHistoryRequest()
|
1002
1040
|
return self._deliver_request_sampled_history(sampled_history)
|
1003
1041
|
|
1004
1042
|
@abstractmethod
|
1005
1043
|
def _deliver_request_sampled_history(
|
1006
1044
|
self, sampled_history: pb.SampledHistoryRequest
|
1007
|
-
) -> MailboxHandle:
|
1045
|
+
) -> MailboxHandle[pb.Result]:
|
1008
1046
|
raise NotImplementedError
|
1009
1047
|
|
1010
|
-
def deliver_request_run_status(self) -> MailboxHandle:
|
1048
|
+
def deliver_request_run_status(self) -> MailboxHandle[pb.Result]:
|
1011
1049
|
run_status = pb.RunStatusRequest()
|
1012
1050
|
return self._deliver_request_run_status(run_status)
|
1013
1051
|
|
1014
1052
|
@abstractmethod
|
1015
1053
|
def _deliver_request_run_status(
|
1016
1054
|
self, run_status: pb.RunStatusRequest
|
1017
|
-
) -> MailboxHandle:
|
1055
|
+
) -> MailboxHandle[pb.Result]:
|
1018
1056
|
raise NotImplementedError
|
@@ -8,9 +8,9 @@ import logging
|
|
8
8
|
from multiprocessing.process import BaseProcess
|
9
9
|
from typing import TYPE_CHECKING, Optional
|
10
10
|
|
11
|
-
from
|
11
|
+
from wandb.sdk.mailbox import Mailbox
|
12
|
+
|
12
13
|
from .interface_shared import InterfaceShared
|
13
|
-
from .router_queue import MessageQueueRouter
|
14
14
|
|
15
15
|
if TYPE_CHECKING:
|
16
16
|
from queue import Queue
|
@@ -22,30 +22,20 @@ logger = logging.getLogger("wandb")
|
|
22
22
|
|
23
23
|
|
24
24
|
class InterfaceQueue(InterfaceShared):
|
25
|
-
record_q: Optional["Queue[pb.Record]"]
|
26
|
-
result_q: Optional["Queue[pb.Result]"]
|
27
|
-
_mailbox: Optional[Mailbox]
|
28
|
-
|
29
25
|
def __init__(
|
30
26
|
self,
|
31
27
|
record_q: Optional["Queue[pb.Record]"] = None,
|
32
28
|
result_q: Optional["Queue[pb.Result]"] = None,
|
33
29
|
process: Optional[BaseProcess] = None,
|
34
|
-
process_check: bool = True,
|
35
30
|
mailbox: Optional[Mailbox] = None,
|
36
31
|
) -> None:
|
37
32
|
self.record_q = record_q
|
38
33
|
self.result_q = result_q
|
39
|
-
|
40
|
-
|
41
|
-
def _init_router(self) -> None:
|
42
|
-
if self.record_q and self.result_q:
|
43
|
-
self._router = MessageQueueRouter(
|
44
|
-
self.record_q, self.result_q, mailbox=self._mailbox
|
45
|
-
)
|
34
|
+
self._process = process
|
35
|
+
super().__init__(mailbox=mailbox)
|
46
36
|
|
47
37
|
def _publish(self, record: "pb.Record", local: Optional[bool] = None) -> None:
|
48
|
-
if self.
|
38
|
+
if self._process and not self._process.is_alive():
|
49
39
|
raise Exception("The wandb backend process has shutdown")
|
50
40
|
if local:
|
51
41
|
record.control.local = local
|
@@ -1,18 +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
|
9
|
-
from typing import TYPE_CHECKING, Optional
|
9
|
+
from typing import TYPE_CHECKING
|
10
10
|
|
11
11
|
from wandb.proto import wandb_internal_pb2 as pb
|
12
|
+
from wandb.sdk.mailbox import Mailbox
|
12
13
|
|
13
|
-
from ..lib.mailbox import Mailbox
|
14
14
|
from .interface_queue import InterfaceQueue
|
15
|
-
from .router_relay import MessageRelayRouter
|
16
15
|
|
17
16
|
if TYPE_CHECKING:
|
18
17
|
from queue import Queue
|
@@ -23,31 +22,17 @@ logger = logging.getLogger("wandb")
|
|
23
22
|
|
24
23
|
class InterfaceRelay(InterfaceQueue):
|
25
24
|
_mailbox: Mailbox
|
26
|
-
relay_q: Optional["Queue[pb.Result]"]
|
27
25
|
|
28
26
|
def __init__(
|
29
27
|
self,
|
30
28
|
mailbox: Mailbox,
|
31
|
-
record_q:
|
32
|
-
result_q:
|
33
|
-
relay_q:
|
34
|
-
process: Optional[BaseProcess] = None,
|
35
|
-
process_check: bool = True,
|
29
|
+
record_q: Queue[pb.Record],
|
30
|
+
result_q: Queue[pb.Result],
|
31
|
+
relay_q: Queue[pb.Result],
|
36
32
|
) -> None:
|
37
33
|
self.relay_q = relay_q
|
38
34
|
super().__init__(
|
39
35
|
record_q=record_q,
|
40
36
|
result_q=result_q,
|
41
|
-
process=process,
|
42
|
-
process_check=process_check,
|
43
37
|
mailbox=mailbox,
|
44
38
|
)
|
45
|
-
|
46
|
-
def _init_router(self) -> None:
|
47
|
-
if self.record_q and self.result_q and self.relay_q:
|
48
|
-
self._router = MessageRelayRouter(
|
49
|
-
request_queue=self.record_q,
|
50
|
-
response_queue=self.result_q,
|
51
|
-
relay_queue=self.relay_q,
|
52
|
-
mailbox=self._mailbox,
|
53
|
-
)
|