wandb 0.21.1__py3-none-win_amd64.whl → 0.21.3__py3-none-win_amd64.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 +1 -1
- wandb/apis/public/api.py +1 -2
- wandb/apis/public/artifacts.py +3 -5
- wandb/apis/public/registries/_utils.py +14 -16
- wandb/apis/public/registries/registries_search.py +176 -289
- wandb/apis/public/reports.py +13 -10
- wandb/automations/_generated/delete_automation.py +1 -3
- wandb/automations/_generated/enums.py +13 -11
- wandb/bin/gpu_stats.exe +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/cli/cli.py +47 -2
- wandb/integration/metaflow/data_pandas.py +2 -2
- wandb/integration/metaflow/data_pytorch.py +75 -0
- wandb/integration/metaflow/data_sklearn.py +76 -0
- wandb/integration/metaflow/metaflow.py +16 -87
- wandb/integration/weave/__init__.py +6 -0
- wandb/integration/weave/interface.py +49 -0
- wandb/integration/weave/weave.py +63 -0
- wandb/proto/v3/wandb_internal_pb2.py +3 -2
- wandb/proto/v4/wandb_internal_pb2.py +2 -2
- wandb/proto/v5/wandb_internal_pb2.py +2 -2
- wandb/proto/v6/wandb_internal_pb2.py +2 -2
- wandb/sdk/artifacts/_factories.py +17 -0
- wandb/sdk/artifacts/_generated/__init__.py +221 -13
- wandb/sdk/artifacts/_generated/artifact_by_id.py +17 -0
- wandb/sdk/artifacts/_generated/artifact_by_name.py +22 -0
- wandb/sdk/artifacts/_generated/artifact_collection_membership_file_urls.py +43 -0
- wandb/sdk/artifacts/_generated/artifact_created_by.py +47 -0
- wandb/sdk/artifacts/_generated/artifact_file_urls.py +22 -0
- wandb/sdk/artifacts/_generated/artifact_type.py +31 -0
- wandb/sdk/artifacts/_generated/artifact_used_by.py +43 -0
- wandb/sdk/artifacts/_generated/artifact_via_membership_by_name.py +26 -0
- wandb/sdk/artifacts/_generated/delete_artifact.py +28 -0
- wandb/sdk/artifacts/_generated/enums.py +5 -0
- wandb/sdk/artifacts/_generated/fetch_artifact_manifest.py +38 -0
- wandb/sdk/artifacts/_generated/fetch_registries.py +32 -0
- wandb/sdk/artifacts/_generated/fragments.py +279 -41
- wandb/sdk/artifacts/_generated/link_artifact.py +6 -0
- wandb/sdk/artifacts/_generated/operations.py +654 -51
- wandb/sdk/artifacts/_generated/registry_collections.py +34 -0
- wandb/sdk/artifacts/_generated/registry_versions.py +34 -0
- wandb/sdk/artifacts/_generated/unlink_artifact.py +25 -0
- wandb/sdk/artifacts/_graphql_fragments.py +3 -86
- wandb/sdk/artifacts/_validators.py +6 -4
- wandb/sdk/artifacts/artifact.py +410 -547
- wandb/sdk/artifacts/artifact_file_cache.py +11 -7
- wandb/sdk/artifacts/artifact_manifest.py +10 -9
- wandb/sdk/artifacts/artifact_manifest_entry.py +15 -18
- wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +5 -3
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +1 -1
- wandb/sdk/artifacts/storage_handlers/http_handler.py +1 -1
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +1 -1
- wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +1 -1
- wandb/sdk/data_types/video.py +2 -2
- wandb/sdk/interface/interface_queue.py +1 -4
- wandb/sdk/interface/interface_shared.py +26 -37
- wandb/sdk/interface/interface_sock.py +24 -14
- wandb/sdk/internal/settings_static.py +2 -3
- wandb/sdk/launch/create_job.py +12 -1
- wandb/sdk/launch/inputs/internal.py +25 -24
- wandb/sdk/launch/inputs/schema.py +31 -1
- wandb/sdk/launch/runner/kubernetes_runner.py +24 -29
- wandb/sdk/lib/asyncio_compat.py +16 -16
- wandb/sdk/lib/asyncio_manager.py +252 -0
- wandb/sdk/lib/hashutil.py +13 -4
- wandb/sdk/lib/paths.py +23 -21
- wandb/sdk/lib/printer.py +2 -2
- wandb/sdk/lib/printer_asyncio.py +3 -1
- wandb/sdk/lib/retry.py +185 -78
- wandb/sdk/lib/service/service_client.py +106 -0
- wandb/sdk/lib/service/service_connection.py +20 -26
- wandb/sdk/lib/service/service_token.py +30 -13
- wandb/sdk/mailbox/mailbox.py +13 -5
- wandb/sdk/mailbox/mailbox_handle.py +22 -13
- wandb/sdk/mailbox/response_handle.py +42 -106
- wandb/sdk/mailbox/wait_with_progress.py +7 -42
- wandb/sdk/wandb_init.py +11 -25
- wandb/sdk/wandb_login.py +1 -1
- wandb/sdk/wandb_run.py +92 -56
- wandb/sdk/wandb_settings.py +45 -32
- wandb/sdk/wandb_setup.py +176 -96
- wandb/util.py +1 -1
- {wandb-0.21.1.dist-info → wandb-0.21.3.dist-info}/METADATA +2 -2
- {wandb-0.21.1.dist-info → wandb-0.21.3.dist-info}/RECORD +88 -72
- wandb/sdk/interface/interface_relay.py +0 -38
- wandb/sdk/interface/router.py +0 -89
- wandb/sdk/interface/router_queue.py +0 -43
- wandb/sdk/interface/router_relay.py +0 -50
- wandb/sdk/interface/router_sock.py +0 -32
- wandb/sdk/lib/sock_client.py +0 -232
- {wandb-0.21.1.dist-info → wandb-0.21.3.dist-info}/WHEEL +0 -0
- {wandb-0.21.1.dist-info → wandb-0.21.3.dist-info}/entry_points.txt +0 -0
- {wandb-0.21.1.dist-info → wandb-0.21.3.dist-info}/licenses/LICENSE +0 -0
@@ -1,32 +0,0 @@
|
|
1
|
-
"""Router - handle message router (sock).
|
2
|
-
|
3
|
-
Router to manage responses from a socket client.
|
4
|
-
|
5
|
-
"""
|
6
|
-
|
7
|
-
from __future__ import annotations
|
8
|
-
|
9
|
-
from wandb.proto import wandb_internal_pb2 as pb
|
10
|
-
from wandb.proto import wandb_server_pb2 as spb
|
11
|
-
from wandb.sdk.lib.sock_client import SockClient, SockClientClosedError
|
12
|
-
from wandb.sdk.mailbox import Mailbox
|
13
|
-
|
14
|
-
from .router import MessageRouter, MessageRouterClosedError
|
15
|
-
|
16
|
-
|
17
|
-
class MessageSockRouter(MessageRouter):
|
18
|
-
_sock_client: SockClient
|
19
|
-
_mailbox: Mailbox
|
20
|
-
|
21
|
-
def __init__(self, sock_client: SockClient, mailbox: Mailbox) -> None:
|
22
|
-
self._sock_client = sock_client
|
23
|
-
super().__init__(mailbox=mailbox)
|
24
|
-
|
25
|
-
def _read_message(self) -> spb.ServerResponse | None:
|
26
|
-
try:
|
27
|
-
return self._sock_client.read_server_response(timeout=1)
|
28
|
-
except SockClientClosedError as e:
|
29
|
-
raise MessageRouterClosedError from e
|
30
|
-
|
31
|
-
def _send_message(self, record: pb.Record) -> None:
|
32
|
-
self._sock_client.send_record_communicate(record)
|
wandb/sdk/lib/sock_client.py
DELETED
@@ -1,232 +0,0 @@
|
|
1
|
-
import socket
|
2
|
-
import struct
|
3
|
-
import threading
|
4
|
-
import time
|
5
|
-
import uuid
|
6
|
-
from typing import TYPE_CHECKING, Any, List, Optional
|
7
|
-
|
8
|
-
from wandb.proto import wandb_server_pb2 as spb
|
9
|
-
|
10
|
-
if TYPE_CHECKING:
|
11
|
-
from wandb.proto import wandb_internal_pb2 as pb
|
12
|
-
|
13
|
-
|
14
|
-
class SockClientClosedError(Exception):
|
15
|
-
"""Raised on operations on a closed socket."""
|
16
|
-
|
17
|
-
|
18
|
-
class SockClientTimeoutError(Exception):
|
19
|
-
"""Raised if the server didn't respond before the timeout."""
|
20
|
-
|
21
|
-
|
22
|
-
class SockBuffer:
|
23
|
-
_buf_list: List[bytes]
|
24
|
-
_buf_lengths: List[int]
|
25
|
-
_buf_total: int
|
26
|
-
|
27
|
-
def __init__(self) -> None:
|
28
|
-
self._buf_list = []
|
29
|
-
self._buf_lengths = []
|
30
|
-
self._buf_total = 0
|
31
|
-
|
32
|
-
@property
|
33
|
-
def length(self) -> int:
|
34
|
-
return self._buf_total
|
35
|
-
|
36
|
-
def _get(self, start: int, end: int, peek: bool = False) -> bytes:
|
37
|
-
index: Optional[int] = None
|
38
|
-
buffers = []
|
39
|
-
need = end
|
40
|
-
|
41
|
-
# compute buffers needed
|
42
|
-
for i, (buf_len, buf_data) in enumerate(zip(self._buf_lengths, self._buf_list)):
|
43
|
-
buffers.append(buf_data[:need] if need < buf_len else buf_data)
|
44
|
-
if need <= buf_len:
|
45
|
-
index = i
|
46
|
-
break
|
47
|
-
need -= buf_len
|
48
|
-
|
49
|
-
# buffer not large enough, caller should have made sure there was enough data
|
50
|
-
if index is None:
|
51
|
-
raise IndexError("SockBuffer index out of range")
|
52
|
-
|
53
|
-
# advance buffer internals if we are not peeking into the data
|
54
|
-
if not peek:
|
55
|
-
self._buf_total -= end
|
56
|
-
if need < buf_len:
|
57
|
-
# update partially used buffer list
|
58
|
-
self._buf_list = self._buf_list[index:]
|
59
|
-
self._buf_lengths = self._buf_lengths[index:]
|
60
|
-
self._buf_list[0] = self._buf_list[0][need:]
|
61
|
-
self._buf_lengths[0] -= need
|
62
|
-
else:
|
63
|
-
# update fully used buffer list
|
64
|
-
self._buf_list = self._buf_list[index + 1 :]
|
65
|
-
self._buf_lengths = self._buf_lengths[index + 1 :]
|
66
|
-
|
67
|
-
return b"".join(buffers)[start:end]
|
68
|
-
|
69
|
-
def get(self, start: int, end: int) -> bytes:
|
70
|
-
return self._get(start, end)
|
71
|
-
|
72
|
-
def peek(self, start: int, end: int) -> bytes:
|
73
|
-
return self._get(start, end, peek=True)
|
74
|
-
|
75
|
-
def put(self, data: bytes, data_len: int) -> None:
|
76
|
-
self._buf_list.append(data)
|
77
|
-
self._buf_lengths.append(data_len)
|
78
|
-
self._buf_total += data_len
|
79
|
-
|
80
|
-
|
81
|
-
class SockClient:
|
82
|
-
# current header is magic byte "W" followed by 4 byte length of the message
|
83
|
-
HEADLEN = 1 + 4
|
84
|
-
|
85
|
-
def __init__(self, sock: socket.socket) -> None:
|
86
|
-
"""Create a SockClient.
|
87
|
-
|
88
|
-
Args:
|
89
|
-
sock: A connected socket.
|
90
|
-
"""
|
91
|
-
self._sock = sock
|
92
|
-
|
93
|
-
# TODO: use safe uuid's (python3.7+) or emulate this
|
94
|
-
self._sockid = uuid.uuid4().hex
|
95
|
-
self._retry_delay = 0.1
|
96
|
-
self._lock = threading.Lock()
|
97
|
-
self._bufsize = 4096
|
98
|
-
self._buffer = SockBuffer()
|
99
|
-
|
100
|
-
self._detect_bufsize()
|
101
|
-
|
102
|
-
def _detect_bufsize(self) -> None:
|
103
|
-
sndbuf_size = self._sock.getsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF)
|
104
|
-
rcvbuf_size = self._sock.getsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF)
|
105
|
-
self._bufsize = min(sndbuf_size, rcvbuf_size, 65536)
|
106
|
-
|
107
|
-
def close(self) -> None:
|
108
|
-
self._sock.close()
|
109
|
-
|
110
|
-
def shutdown(self, val: int) -> None:
|
111
|
-
self._sock.shutdown(val)
|
112
|
-
|
113
|
-
def _sendall_with_error_handle(self, data: bytes) -> None:
|
114
|
-
# This is a helper function for sending data in a retry fashion.
|
115
|
-
# Similar to the sendall() function in the socket module, but with
|
116
|
-
# an error handling in case of timeout.
|
117
|
-
total_sent = 0
|
118
|
-
total_data = len(data)
|
119
|
-
while total_sent < total_data:
|
120
|
-
start_time = time.monotonic()
|
121
|
-
try:
|
122
|
-
sent = self._sock.send(data)
|
123
|
-
# sent equal to 0 indicates a closed socket
|
124
|
-
if sent == 0:
|
125
|
-
raise SockClientClosedError("socket connection broken")
|
126
|
-
total_sent += sent
|
127
|
-
# truncate our data to save memory
|
128
|
-
data = data[sent:]
|
129
|
-
# we handle the timeout case for the cases when timeout is set
|
130
|
-
# on a system level by another application
|
131
|
-
except socket.timeout:
|
132
|
-
# adding sleep to avoid tight loop
|
133
|
-
delta_time = time.monotonic() - start_time
|
134
|
-
if delta_time < self._retry_delay:
|
135
|
-
time.sleep(self._retry_delay - delta_time)
|
136
|
-
|
137
|
-
def _send_message(self, msg: Any) -> None:
|
138
|
-
raw_size = msg.ByteSize()
|
139
|
-
data = msg.SerializeToString()
|
140
|
-
assert len(data) == raw_size, "invalid serialization"
|
141
|
-
header = struct.pack("<BI", ord("W"), raw_size)
|
142
|
-
with self._lock:
|
143
|
-
self._sendall_with_error_handle(header + data)
|
144
|
-
|
145
|
-
def send_server_request(self, msg: spb.ServerRequest) -> None:
|
146
|
-
self._send_message(msg)
|
147
|
-
|
148
|
-
def send_server_response(self, msg: spb.ServerResponse) -> None:
|
149
|
-
try:
|
150
|
-
self._send_message(msg)
|
151
|
-
except BrokenPipeError:
|
152
|
-
# TODO(jhr): user thread might no longer be around to receive responses to
|
153
|
-
# things like network status poll loop, there might be a better way to quiesce
|
154
|
-
pass
|
155
|
-
|
156
|
-
def send_record_communicate(self, record: "pb.Record") -> None:
|
157
|
-
server_req = spb.ServerRequest()
|
158
|
-
server_req.request_id = record.control.mailbox_slot
|
159
|
-
server_req.record_communicate.CopyFrom(record)
|
160
|
-
self.send_server_request(server_req)
|
161
|
-
|
162
|
-
def send_record_publish(self, record: "pb.Record") -> None:
|
163
|
-
server_req = spb.ServerRequest()
|
164
|
-
server_req.request_id = record.control.mailbox_slot
|
165
|
-
server_req.record_publish.CopyFrom(record)
|
166
|
-
self.send_server_request(server_req)
|
167
|
-
|
168
|
-
def _extract_packet_bytes(self) -> Optional[bytes]:
|
169
|
-
# Do we have enough data to read the header?
|
170
|
-
start_offset = self.HEADLEN
|
171
|
-
if self._buffer.length >= start_offset:
|
172
|
-
header = self._buffer.peek(0, start_offset)
|
173
|
-
fields = struct.unpack("<BI", header)
|
174
|
-
magic, dlength = fields
|
175
|
-
assert magic == ord("W")
|
176
|
-
# Do we have enough data to read the full record?
|
177
|
-
end_offset = self.HEADLEN + dlength
|
178
|
-
if self._buffer.length >= end_offset:
|
179
|
-
rec_data = self._buffer.get(start_offset, end_offset)
|
180
|
-
return rec_data
|
181
|
-
return None
|
182
|
-
|
183
|
-
def _read_packet_bytes(self, timeout: Optional[int] = None) -> Optional[bytes]:
|
184
|
-
"""Read full message from socket.
|
185
|
-
|
186
|
-
Args:
|
187
|
-
timeout: number of seconds to wait on socket data.
|
188
|
-
|
189
|
-
Raises:
|
190
|
-
SockClientClosedError: socket has been closed.
|
191
|
-
"""
|
192
|
-
while True:
|
193
|
-
rec = self._extract_packet_bytes()
|
194
|
-
if rec:
|
195
|
-
return rec
|
196
|
-
|
197
|
-
if timeout:
|
198
|
-
self._sock.settimeout(timeout)
|
199
|
-
try:
|
200
|
-
data = self._sock.recv(self._bufsize)
|
201
|
-
except socket.timeout:
|
202
|
-
break
|
203
|
-
except OSError as e:
|
204
|
-
raise SockClientClosedError from e
|
205
|
-
finally:
|
206
|
-
if timeout:
|
207
|
-
self._sock.settimeout(None)
|
208
|
-
data_len = len(data)
|
209
|
-
if data_len == 0:
|
210
|
-
# socket.recv() will return 0 bytes if socket was shutdown
|
211
|
-
# caller will handle this condition like other connection problems
|
212
|
-
raise SockClientClosedError
|
213
|
-
self._buffer.put(data, data_len)
|
214
|
-
return None
|
215
|
-
|
216
|
-
def read_server_request(self) -> Optional[spb.ServerRequest]:
|
217
|
-
data = self._read_packet_bytes()
|
218
|
-
if not data:
|
219
|
-
return None
|
220
|
-
rec = spb.ServerRequest()
|
221
|
-
rec.ParseFromString(data)
|
222
|
-
return rec
|
223
|
-
|
224
|
-
def read_server_response(
|
225
|
-
self, timeout: Optional[int] = None
|
226
|
-
) -> Optional[spb.ServerResponse]:
|
227
|
-
data = self._read_packet_bytes(timeout=timeout)
|
228
|
-
if not data:
|
229
|
-
return None
|
230
|
-
rec = spb.ServerResponse()
|
231
|
-
rec.ParseFromString(data)
|
232
|
-
return rec
|
File without changes
|
File without changes
|
File without changes
|