wandb 0.18.1__py3-none-macosx_11_0_arm64.whl → 0.18.3__py3-none-macosx_11_0_arm64.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. wandb/__init__.py +3 -3
  2. wandb/__init__.pyi +67 -12
  3. wandb/apis/internal.py +3 -0
  4. wandb/apis/public/api.py +128 -2
  5. wandb/apis/public/artifacts.py +11 -7
  6. wandb/apis/public/jobs.py +8 -0
  7. wandb/apis/public/runs.py +16 -5
  8. wandb/bin/apple_gpu_stats +0 -0
  9. wandb/bin/wandb-core +0 -0
  10. wandb/cli/cli.py +0 -3
  11. wandb/errors/__init__.py +11 -40
  12. wandb/errors/errors.py +37 -0
  13. wandb/errors/warnings.py +2 -0
  14. wandb/integration/tensorboard/log.py +1 -1
  15. wandb/old/core.py +2 -80
  16. wandb/plot/bar.py +7 -4
  17. wandb/plot/confusion_matrix.py +5 -4
  18. wandb/plot/histogram.py +7 -4
  19. wandb/plot/line.py +7 -4
  20. wandb/proto/v3/wandb_internal_pb2.py +31 -21
  21. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  22. wandb/proto/v4/wandb_internal_pb2.py +23 -21
  23. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  24. wandb/proto/v5/wandb_internal_pb2.py +23 -21
  25. wandb/proto/v5/wandb_settings_pb2.py +2 -2
  26. wandb/sdk/artifacts/_validators.py +48 -3
  27. wandb/sdk/artifacts/artifact.py +160 -186
  28. wandb/sdk/artifacts/artifact_file_cache.py +13 -11
  29. wandb/sdk/artifacts/artifact_instance_cache.py +4 -2
  30. wandb/sdk/artifacts/artifact_manifest.py +13 -11
  31. wandb/sdk/artifacts/artifact_manifest_entry.py +24 -22
  32. wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +9 -7
  33. wandb/sdk/artifacts/artifact_saver.py +27 -25
  34. wandb/sdk/artifacts/exceptions.py +26 -25
  35. wandb/sdk/artifacts/storage_handler.py +11 -9
  36. wandb/sdk/artifacts/storage_handlers/azure_handler.py +16 -14
  37. wandb/sdk/artifacts/storage_handlers/gcs_handler.py +15 -13
  38. wandb/sdk/artifacts/storage_handlers/http_handler.py +15 -14
  39. wandb/sdk/artifacts/storage_handlers/local_file_handler.py +10 -8
  40. wandb/sdk/artifacts/storage_handlers/multi_handler.py +14 -12
  41. wandb/sdk/artifacts/storage_handlers/s3_handler.py +19 -19
  42. wandb/sdk/artifacts/storage_handlers/tracking_handler.py +10 -8
  43. wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +12 -10
  44. wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +9 -7
  45. wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +31 -29
  46. wandb/sdk/artifacts/storage_policy.py +20 -20
  47. wandb/sdk/backend/backend.py +8 -26
  48. wandb/sdk/data_types/base_types/wb_value.py +1 -3
  49. wandb/sdk/data_types/video.py +2 -2
  50. wandb/sdk/interface/interface.py +0 -24
  51. wandb/sdk/interface/interface_shared.py +0 -12
  52. wandb/sdk/internal/handler.py +0 -10
  53. wandb/sdk/internal/internal_api.py +71 -0
  54. wandb/sdk/internal/sender.py +0 -43
  55. wandb/sdk/internal/tb_watcher.py +1 -1
  56. wandb/sdk/lib/_settings_toposort_generated.py +1 -0
  57. wandb/sdk/lib/hashutil.py +34 -12
  58. wandb/sdk/lib/service_connection.py +216 -0
  59. wandb/sdk/lib/service_token.py +94 -0
  60. wandb/sdk/lib/sock_client.py +7 -3
  61. wandb/sdk/service/server.py +2 -5
  62. wandb/sdk/service/service.py +0 -22
  63. wandb/sdk/wandb_init.py +33 -22
  64. wandb/sdk/wandb_run.py +45 -33
  65. wandb/sdk/wandb_settings.py +2 -0
  66. wandb/sdk/wandb_setup.py +25 -16
  67. wandb/sdk/wandb_sync.py +9 -3
  68. wandb/sdk/wandb_watch.py +31 -15
  69. wandb/util.py +8 -1
  70. {wandb-0.18.1.dist-info → wandb-0.18.3.dist-info}/METADATA +3 -2
  71. {wandb-0.18.1.dist-info → wandb-0.18.3.dist-info}/RECORD +75 -75
  72. wandb/sdk/internal/update.py +0 -113
  73. wandb/sdk/service/service_base.py +0 -50
  74. wandb/sdk/service/service_sock.py +0 -70
  75. wandb/sdk/wandb_manager.py +0 -232
  76. /wandb/{sdk/lib → plot}/viz.py +0 -0
  77. {wandb-0.18.1.dist-info → wandb-0.18.3.dist-info}/WHEEL +0 -0
  78. {wandb-0.18.1.dist-info → wandb-0.18.3.dist-info}/entry_points.txt +0 -0
  79. {wandb-0.18.1.dist-info → wandb-0.18.3.dist-info}/licenses/LICENSE +0 -0
@@ -1,10 +1,12 @@
1
1
  """WandB storage policy."""
2
2
 
3
+ from __future__ import annotations
4
+
3
5
  import hashlib
4
6
  import math
5
7
  import os
6
8
  import shutil
7
- from typing import TYPE_CHECKING, Any, Dict, List, Optional, Sequence, Union
9
+ from typing import TYPE_CHECKING, Any, Sequence
8
10
  from urllib.parse import quote
9
11
 
10
12
  import requests
@@ -64,15 +66,15 @@ class WandbStoragePolicy(StoragePolicy):
64
66
 
65
67
  @classmethod
66
68
  def from_config(
67
- cls, config: Dict, api: Optional[InternalApi] = None
68
- ) -> "WandbStoragePolicy":
69
+ cls, config: dict, api: InternalApi | None = None
70
+ ) -> WandbStoragePolicy:
69
71
  return cls(config=config, api=api)
70
72
 
71
73
  def __init__(
72
74
  self,
73
- config: Optional[Dict] = None,
74
- cache: Optional[ArtifactFileCache] = None,
75
- api: Optional[InternalApi] = None,
75
+ config: dict | None = None,
76
+ cache: ArtifactFileCache | None = None,
77
+ api: InternalApi | None = None,
76
78
  ) -> None:
77
79
  self._cache = cache or get_artifact_file_cache()
78
80
  self._config = config or {}
@@ -109,14 +111,14 @@ class WandbStoragePolicy(StoragePolicy):
109
111
  default_handler=TrackingHandler(),
110
112
  )
111
113
 
112
- def config(self) -> Dict:
114
+ def config(self) -> dict:
113
115
  return self._config
114
116
 
115
117
  def load_file(
116
118
  self,
117
- artifact: "Artifact",
118
- manifest_entry: "ArtifactManifestEntry",
119
- dest_path: Optional[str] = None,
119
+ artifact: Artifact,
120
+ manifest_entry: ArtifactManifestEntry,
121
+ dest_path: str | None = None,
120
122
  ) -> FilePathStr:
121
123
  if dest_path is not None:
122
124
  self._cache._override_cache_path = dest_path
@@ -159,22 +161,22 @@ class WandbStoragePolicy(StoragePolicy):
159
161
 
160
162
  def store_reference(
161
163
  self,
162
- artifact: "Artifact",
163
- path: Union[URIStr, FilePathStr],
164
- name: Optional[str] = None,
164
+ artifact: Artifact,
165
+ path: URIStr | FilePathStr,
166
+ name: str | None = None,
165
167
  checksum: bool = True,
166
- max_objects: Optional[int] = None,
167
- ) -> Sequence["ArtifactManifestEntry"]:
168
+ max_objects: int | None = None,
169
+ ) -> Sequence[ArtifactManifestEntry]:
168
170
  return self._handler.store_path(
169
171
  artifact, path, name=name, checksum=checksum, max_objects=max_objects
170
172
  )
171
173
 
172
174
  def load_reference(
173
175
  self,
174
- manifest_entry: "ArtifactManifestEntry",
176
+ manifest_entry: ArtifactManifestEntry,
175
177
  local: bool = False,
176
- dest_path: Optional[str] = None,
177
- ) -> Union[FilePathStr, URIStr]:
178
+ dest_path: str | None = None,
179
+ ) -> FilePathStr | URIStr:
178
180
  assert manifest_entry.ref is not None
179
181
  used_handler = self._handler._get_handler(manifest_entry.ref)
180
182
  if hasattr(used_handler, "_cache") and (dest_path is not None):
@@ -185,7 +187,7 @@ class WandbStoragePolicy(StoragePolicy):
185
187
  self,
186
188
  api: InternalApi,
187
189
  entity_name: str,
188
- manifest_entry: "ArtifactManifestEntry",
190
+ manifest_entry: ArtifactManifestEntry,
189
191
  ) -> str:
190
192
  storage_layout = self._config.get("storageLayout", StorageLayout.V1)
191
193
  storage_region = self._config.get("storageRegion", "default")
@@ -214,10 +216,10 @@ class WandbStoragePolicy(StoragePolicy):
214
216
  self,
215
217
  file_path: str,
216
218
  chunk_size: int,
217
- hex_digests: Dict[int, str],
218
- multipart_urls: Dict[int, str],
219
- extra_headers: Dict[str, str],
220
- ) -> List[Dict[str, Any]]:
219
+ hex_digests: dict[int, str],
220
+ multipart_urls: dict[int, str],
221
+ extra_headers: dict[str, str],
222
+ ) -> list[dict[str, Any]]:
221
223
  etags = []
222
224
  part_number = 1
223
225
 
@@ -247,8 +249,8 @@ class WandbStoragePolicy(StoragePolicy):
247
249
  self,
248
250
  upload_url: str,
249
251
  file_path: str,
250
- extra_headers: Dict[str, Any],
251
- progress_callback: Optional["progress.ProgressFn"] = None,
252
+ extra_headers: dict[str, Any],
253
+ progress_callback: progress.ProgressFn | None = None,
252
254
  ) -> None:
253
255
  """Upload a file to the artifact store and write to cache."""
254
256
  with open(file_path, "rb") as file:
@@ -272,9 +274,9 @@ class WandbStoragePolicy(StoragePolicy):
272
274
  self,
273
275
  artifact_id: str,
274
276
  artifact_manifest_id: str,
275
- entry: "ArtifactManifestEntry",
276
- preparer: "StepPrepare",
277
- progress_callback: Optional["progress.ProgressFn"] = None,
277
+ entry: ArtifactManifestEntry,
278
+ preparer: StepPrepare,
279
+ progress_callback: progress.ProgressFn | None = None,
278
280
  ) -> bool:
279
281
  """Upload a file to the artifact store.
280
282
 
@@ -352,7 +354,7 @@ class WandbStoragePolicy(StoragePolicy):
352
354
 
353
355
  return False
354
356
 
355
- def _write_cache(self, entry: "ArtifactManifestEntry") -> None:
357
+ def _write_cache(self, entry: ArtifactManifestEntry) -> None:
356
358
  if entry.local_path is None:
357
359
  return
358
360
 
@@ -1,6 +1,8 @@
1
1
  """Storage policy."""
2
2
 
3
- from typing import TYPE_CHECKING, Dict, Optional, Sequence, Type, Union
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING, Sequence
4
6
 
5
7
  from wandb.sdk.internal.internal_api import Api as InternalApi
6
8
  from wandb.sdk.lib.paths import FilePathStr, URIStr
@@ -14,7 +16,7 @@ if TYPE_CHECKING:
14
16
 
15
17
  class StoragePolicy:
16
18
  @classmethod
17
- def lookup_by_name(cls, name: str) -> Type["StoragePolicy"]:
19
+ def lookup_by_name(cls, name: str) -> type[StoragePolicy]:
18
20
  import wandb.sdk.artifacts.storage_policies # noqa: F401
19
21
 
20
22
  for sub in cls.__subclasses__():
@@ -27,19 +29,17 @@ class StoragePolicy:
27
29
  raise NotImplementedError
28
30
 
29
31
  @classmethod
30
- def from_config(
31
- cls, config: Dict, api: Optional[InternalApi] = None
32
- ) -> "StoragePolicy":
32
+ def from_config(cls, config: dict, api: InternalApi | None = None) -> StoragePolicy:
33
33
  raise NotImplementedError
34
34
 
35
- def config(self) -> Dict:
35
+ def config(self) -> dict:
36
36
  raise NotImplementedError
37
37
 
38
38
  def load_file(
39
39
  self,
40
- artifact: "Artifact",
41
- manifest_entry: "ArtifactManifestEntry",
42
- dest_path: Optional[str] = None,
40
+ artifact: Artifact,
41
+ manifest_entry: ArtifactManifestEntry,
42
+ dest_path: str | None = None,
43
43
  ) -> FilePathStr:
44
44
  raise NotImplementedError
45
45
 
@@ -47,26 +47,26 @@ class StoragePolicy:
47
47
  self,
48
48
  artifact_id: str,
49
49
  artifact_manifest_id: str,
50
- entry: "ArtifactManifestEntry",
51
- preparer: "StepPrepare",
52
- progress_callback: Optional["ProgressFn"] = None,
50
+ entry: ArtifactManifestEntry,
51
+ preparer: StepPrepare,
52
+ progress_callback: ProgressFn | None = None,
53
53
  ) -> bool:
54
54
  raise NotImplementedError
55
55
 
56
56
  def store_reference(
57
57
  self,
58
- artifact: "Artifact",
59
- path: Union[URIStr, FilePathStr],
60
- name: Optional[str] = None,
58
+ artifact: Artifact,
59
+ path: URIStr | FilePathStr,
60
+ name: str | None = None,
61
61
  checksum: bool = True,
62
- max_objects: Optional[int] = None,
63
- ) -> Sequence["ArtifactManifestEntry"]:
62
+ max_objects: int | None = None,
63
+ ) -> Sequence[ArtifactManifestEntry]:
64
64
  raise NotImplementedError
65
65
 
66
66
  def load_reference(
67
67
  self,
68
- manifest_entry: "ArtifactManifestEntry",
68
+ manifest_entry: ArtifactManifestEntry,
69
69
  local: bool = False,
70
- dest_path: Optional[str] = None,
71
- ) -> Union[FilePathStr, URIStr]:
70
+ dest_path: str | None = None,
71
+ ) -> FilePathStr | URIStr:
72
72
  raise NotImplementedError
@@ -11,7 +11,7 @@ import os
11
11
  import queue
12
12
  import sys
13
13
  import threading
14
- from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Union, cast
14
+ from typing import TYPE_CHECKING, Any, Callable, Dict, Optional, Union
15
15
 
16
16
  import wandb
17
17
  from wandb.sdk.interface.interface import InterfaceBase
@@ -19,17 +19,16 @@ from wandb.sdk.interface.interface_queue import InterfaceQueue
19
19
  from wandb.sdk.internal.internal import wandb_internal
20
20
  from wandb.sdk.internal.settings_static import SettingsStatic
21
21
  from wandb.sdk.lib.mailbox import Mailbox
22
- from wandb.sdk.wandb_manager import _Manager
23
22
  from wandb.sdk.wandb_settings import Settings
24
23
 
25
24
  if TYPE_CHECKING:
26
25
  from wandb.proto.wandb_internal_pb2 import Record, Result
26
+ from wandb.sdk.lib import service_connection
27
27
 
28
- from ..service.service_sock import ServiceSockInterface
29
28
  from ..wandb_run import Run
30
29
 
31
- RecordQueue = Union[queue.Queue[Record], multiprocessing.Queue[Record]]
32
- ResultQueue = Union[queue.Queue[Result], multiprocessing.Queue[Result]]
30
+ RecordQueue = Union["queue.Queue[Record]", multiprocessing.Queue[Record]]
31
+ ResultQueue = Union["queue.Queue[Result]", multiprocessing.Queue[Result]]
33
32
 
34
33
  logger = logging.getLogger("wandb")
35
34
 
@@ -65,7 +64,7 @@ class Backend:
65
64
  mailbox: Mailbox,
66
65
  settings: Optional[Settings] = None,
67
66
  log_level: Optional[int] = None,
68
- manager: Optional[_Manager] = None,
67
+ service: "Optional[service_connection.ServiceConnection]" = None,
69
68
  ) -> None:
70
69
  self._done = False
71
70
  self.record_q = None
@@ -75,7 +74,7 @@ class Backend:
75
74
  self._internal_pid = None
76
75
  self._settings = settings
77
76
  self._log_level = log_level
78
- self._manager = manager
77
+ self._service = service
79
78
  self._mailbox = mailbox
80
79
 
81
80
  self._multiprocessing = multiprocessing # type: ignore
@@ -139,27 +138,10 @@ class Backend:
139
138
  if self._save_mod_path:
140
139
  main_module.__file__ = self._save_mod_path
141
140
 
142
- def _ensure_launched_manager(self) -> None:
143
- assert self._manager
144
- svc = self._manager._get_service()
145
- assert svc
146
- svc_iface = svc.service_interface
147
-
148
- svc_transport = svc_iface.get_transport()
149
- if svc_transport == "tcp":
150
- from ..interface.interface_sock import InterfaceSock
151
-
152
- svc_iface_sock = cast("ServiceSockInterface", svc_iface)
153
- sock_client = svc_iface_sock._get_sock_client()
154
- sock_interface = InterfaceSock(sock_client, mailbox=self._mailbox)
155
- self.interface = sock_interface
156
- else:
157
- raise AssertionError(f"Unsupported service transport: {svc_transport}")
158
-
159
141
  def ensure_launched(self) -> None:
160
142
  """Launch backend worker if not running."""
161
- if self._manager:
162
- self._ensure_launched_manager()
143
+ if self._service:
144
+ self.interface = self._service.make_interface(self._mailbox)
163
145
  return
164
146
 
165
147
  assert self._settings
@@ -88,9 +88,7 @@ class WBValue:
88
88
  raise NotImplementedError
89
89
 
90
90
  @classmethod
91
- def from_json(
92
- cls: Type["WBValue"], json_obj: dict, source_artifact: "Artifact"
93
- ) -> "WBValue":
91
+ def from_json(cls, json_obj: dict, source_artifact: "Artifact") -> "WBValue":
94
92
  """Deserialize a `json_obj` into it's class representation.
95
93
 
96
94
  If additional resources were stored in the `run_or_artifact` artifact during the
@@ -34,7 +34,7 @@ def write_gif_with_image_io(
34
34
  ) -> None:
35
35
  imageio = util.get_module(
36
36
  "imageio",
37
- required='wandb.Video requires imageio when passing raw data. Install with "pip install imageio"',
37
+ required='wandb.Video requires imageio when passing raw data. Install with "pip install wandb[media]"',
38
38
  )
39
39
 
40
40
  writer = imageio.save(filename, fps=clip.fps, quantizer=0, palettesize=256, loop=0)
@@ -130,7 +130,7 @@ class Video(BatchableMedia):
130
130
  def encode(self) -> None:
131
131
  mpy = util.get_module(
132
132
  "moviepy.editor",
133
- required='wandb.Video requires moviepy and imageio when passing raw data. Install with "pip install moviepy imageio"',
133
+ required='wandb.Video requires moviepy when passing raw data. Install with "pip install wandb[media]"',
134
134
  )
135
135
  tensor = self._prepare_video(self.data)
136
136
  _, self._height, self._width, self._channels = tensor.shape # type: ignore
@@ -891,20 +891,6 @@ class InterfaceBase:
891
891
  def _deliver_attach(self, status: pb.AttachRequest) -> MailboxHandle:
892
892
  raise NotImplementedError
893
893
 
894
- def deliver_check_version(
895
- self, current_version: Optional[str] = None
896
- ) -> MailboxHandle:
897
- check_version = pb.CheckVersionRequest()
898
- if current_version:
899
- check_version.current_version = current_version
900
- return self._deliver_check_version(check_version)
901
-
902
- @abstractmethod
903
- def _deliver_check_version(
904
- self, check_version: pb.CheckVersionRequest
905
- ) -> MailboxHandle:
906
- raise NotImplementedError
907
-
908
894
  def deliver_stop_status(self) -> MailboxHandle:
909
895
  status = pb.StopStatusRequest()
910
896
  return self._deliver_stop_status(status)
@@ -965,16 +951,6 @@ class InterfaceBase:
965
951
  def _deliver_poll_exit(self, poll_exit: pb.PollExitRequest) -> MailboxHandle:
966
952
  raise NotImplementedError
967
953
 
968
- def deliver_request_server_info(self) -> MailboxHandle:
969
- server_info = pb.ServerInfoRequest()
970
- return self._deliver_request_server_info(server_info)
971
-
972
- @abstractmethod
973
- def _deliver_request_server_info(
974
- self, server_info: pb.ServerInfoRequest
975
- ) -> MailboxHandle:
976
- raise NotImplementedError
977
-
978
954
  def deliver_request_sampled_history(self) -> MailboxHandle:
979
955
  sampled_history = pb.SampledHistoryRequest()
980
956
  return self._deliver_request_sampled_history(sampled_history)
@@ -490,12 +490,6 @@ class InterfaceShared(InterfaceBase):
490
490
  record = self._make_request(attach=attach)
491
491
  return self._deliver_record(record)
492
492
 
493
- def _deliver_check_version(
494
- self, check_version: pb.CheckVersionRequest
495
- ) -> MailboxHandle:
496
- record = self._make_request(check_version=check_version)
497
- return self._deliver_record(record)
498
-
499
493
  def _deliver_network_status(
500
494
  self, network_status: pb.NetworkStatusRequest
501
495
  ) -> MailboxHandle:
@@ -508,12 +502,6 @@ class InterfaceShared(InterfaceBase):
508
502
  record = self._make_request(internal_messages=internal_message)
509
503
  return self._deliver_record(record)
510
504
 
511
- def _deliver_request_server_info(
512
- self, server_info: pb.ServerInfoRequest
513
- ) -> MailboxHandle:
514
- record = self._make_request(server_info=server_info)
515
- return self._deliver_record(record)
516
-
517
505
  def _deliver_request_sampled_history(
518
506
  self, sampled_history: pb.SampledHistoryRequest
519
507
  ) -> MailboxHandle:
@@ -659,13 +659,6 @@ class HandleManager:
659
659
  def handle_footer(self, record: Record) -> None:
660
660
  self._dispatch_record(record)
661
661
 
662
- def handle_request_check_version(self, record: Record) -> None:
663
- if self._settings._offline:
664
- result = proto_util._result_from_record(record)
665
- self._respond_result(result)
666
- else:
667
- self._dispatch_record(record)
668
-
669
662
  def handle_request_attach(self, record: Record) -> None:
670
663
  result = proto_util._result_from_record(record)
671
664
  attach_id = record.request.attach.attach_id
@@ -862,9 +855,6 @@ class HandleManager:
862
855
  result.response.sampled_history_response.item.append(item)
863
856
  self._respond_result(result)
864
857
 
865
- def handle_request_server_info(self, record: Record) -> None:
866
- self._dispatch_record(record, always_send=True)
867
-
868
858
  def handle_request_keepalive(self, record: Record) -> None:
869
859
  """Handle a keepalive request.
870
860
 
@@ -53,6 +53,8 @@ from .progress import Progress
53
53
 
54
54
  logger = logging.getLogger(__name__)
55
55
 
56
+ LAUNCH_DEFAULT_PROJECT = "model-registry"
57
+
56
58
  if TYPE_CHECKING:
57
59
  if sys.version_info >= (3, 8):
58
60
  from typing import Literal, TypedDict
@@ -674,6 +676,11 @@ class Api:
674
676
  self.server_create_run_queue_supports_priority,
675
677
  )
676
678
 
679
+ @normalize_exceptions
680
+ def upsert_run_queue_introspection(self) -> bool:
681
+ _, _, mutations = self.server_info_introspection()
682
+ return "upsertRunQueue" in mutations
683
+
677
684
  @normalize_exceptions
678
685
  def push_to_run_queue_introspection(self) -> Tuple[bool, bool]:
679
686
  query_string = """
@@ -1580,6 +1587,70 @@ class Api:
1580
1587
  ]
1581
1588
  return result
1582
1589
 
1590
+ @normalize_exceptions
1591
+ def upsert_run_queue(
1592
+ self,
1593
+ queue_name: str,
1594
+ entity: str,
1595
+ resource_type: str,
1596
+ resource_config: dict,
1597
+ project: str = LAUNCH_DEFAULT_PROJECT,
1598
+ prioritization_mode: Optional[str] = None,
1599
+ template_variables: Optional[dict] = None,
1600
+ external_links: Optional[dict] = None,
1601
+ ) -> Optional[Dict[str, Any]]:
1602
+ if not self.upsert_run_queue_introspection():
1603
+ raise UnsupportedError(
1604
+ "upserting run queues is not supported by this version of "
1605
+ "wandb server. Consider updating to the latest version."
1606
+ )
1607
+ query = gql(
1608
+ """
1609
+ mutation upsertRunQueue(
1610
+ $entityName: String!
1611
+ $projectName: String!
1612
+ $queueName: String!
1613
+ $resourceType: String!
1614
+ $resourceConfig: JSONString!
1615
+ $templateVariables: JSONString
1616
+ $prioritizationMode: RunQueuePrioritizationMode
1617
+ $externalLinks: JSONString
1618
+ $clientMutationId: String
1619
+ ) {
1620
+ upsertRunQueue(
1621
+ input: {
1622
+ entityName: $entityName
1623
+ projectName: $projectName
1624
+ queueName: $queueName
1625
+ resourceType: $resourceType
1626
+ resourceConfig: $resourceConfig
1627
+ templateVariables: $templateVariables
1628
+ prioritizationMode: $prioritizationMode
1629
+ externalLinks: $externalLinks
1630
+ clientMutationId: $clientMutationId
1631
+ }
1632
+ ) {
1633
+ success
1634
+ configSchemaValidationErrors
1635
+ }
1636
+ }
1637
+ """
1638
+ )
1639
+ variable_values = {
1640
+ "entityName": entity,
1641
+ "projectName": project,
1642
+ "queueName": queue_name,
1643
+ "resourceType": resource_type,
1644
+ "resourceConfig": json.dumps(resource_config),
1645
+ "templateVariables": (
1646
+ json.dumps(template_variables) if template_variables else None
1647
+ ),
1648
+ "prioritizationMode": prioritization_mode,
1649
+ "externalLinks": json.dumps(external_links) if external_links else None,
1650
+ }
1651
+ result: Dict[str, Any] = self.gql(query, variable_values)
1652
+ return result["upsertRunQueue"]
1653
+
1583
1654
  @normalize_exceptions
1584
1655
  def push_to_run_queue_by_name(
1585
1656
  self,
@@ -42,7 +42,6 @@ from wandb.sdk.internal import (
42
42
  file_stream,
43
43
  internal_api,
44
44
  sender_config,
45
- update,
46
45
  )
47
46
  from wandb.sdk.internal.file_pusher import FilePusher
48
47
  from wandb.sdk.internal.job_builder import JobBuilder
@@ -51,7 +50,6 @@ from wandb.sdk.lib import (
51
50
  config_util,
52
51
  filenames,
53
52
  filesystem,
54
- printer,
55
53
  proto_util,
56
54
  redirect,
57
55
  telemetry,
@@ -483,25 +481,6 @@ class SendManager:
483
481
  # make sure that we always update writer for every sended read request
484
482
  self._maybe_report_status(always=True)
485
483
 
486
- def send_request_check_version(self, record: "Record") -> None:
487
- assert record.control.req_resp or record.control.mailbox_slot
488
- result = proto_util._result_from_record(record)
489
- current_version = (
490
- record.request.check_version.current_version or wandb.__version__
491
- )
492
- messages = update.check_available(current_version)
493
- if messages:
494
- upgrade_message = messages.get("upgrade_message")
495
- if upgrade_message:
496
- result.response.check_version_response.upgrade_message = upgrade_message
497
- yank_message = messages.get("yank_message")
498
- if yank_message:
499
- result.response.check_version_response.yank_message = yank_message
500
- delete_message = messages.get("delete_message")
501
- if delete_message:
502
- result.response.check_version_response.delete_message = delete_message
503
- self._respond_result(result)
504
-
505
484
  def send_request_stop_status(self, record: "Record") -> None:
506
485
  result = proto_util._result_from_record(record)
507
486
  status_resp = result.response.stop_status_response
@@ -724,28 +703,6 @@ class SendManager:
724
703
 
725
704
  self._respond_result(result)
726
705
 
727
- def send_request_server_info(self, record: "Record") -> None:
728
- assert record.control.req_resp or record.control.mailbox_slot
729
- result = proto_util._result_from_record(record)
730
-
731
- result.response.server_info_response.local_info.CopyFrom(self.get_local_info())
732
- for message in self._server_messages:
733
- # guard against the case the message level returns malformed from server
734
- message_level = str(message.get("messageLevel"))
735
- message_level_sanitized = int(
736
- printer.INFO if not message_level.isdigit() else message_level
737
- )
738
- result.response.server_info_response.server_messages.item.append(
739
- wandb_internal_pb2.ServerMessage(
740
- utf_text=message.get("utfText", ""),
741
- plain_text=message.get("plainText", ""),
742
- html_text=message.get("htmlText", ""),
743
- type=message.get("messageType", ""),
744
- level=message_level_sanitized,
745
- )
746
- )
747
- self._respond_result(result)
748
-
749
706
  def _setup_resume(
750
707
  self, run: "RunRecord"
751
708
  ) -> Optional["wandb_internal_pb2.ErrorInfo"]:
@@ -12,9 +12,9 @@ from typing import TYPE_CHECKING, Any, Dict, List, Optional
12
12
 
13
13
  import wandb
14
14
  from wandb import util
15
+ from wandb.plot.viz import CustomChart
15
16
  from wandb.sdk.interface.interface import GlobStr
16
17
  from wandb.sdk.lib import filesystem
17
- from wandb.sdk.lib.viz import CustomChart
18
18
 
19
19
  from . import run as internal_run
20
20
 
@@ -27,6 +27,7 @@ _Setting = Literal[
27
27
  "_executable",
28
28
  "_extra_http_headers",
29
29
  "_file_stream_max_bytes",
30
+ "_file_stream_transmit_interval",
30
31
  "_file_stream_retry_max",
31
32
  "_file_stream_retry_wait_min_seconds",
32
33
  "_file_stream_retry_wait_max_seconds",