wandb 0.18.1__py3-none-win32.whl → 0.18.3__py3-none-win32.whl
Sign up to get free protection for your applications and to get access to all the features.
- wandb/__init__.py +3 -3
- wandb/__init__.pyi +67 -12
- wandb/apis/internal.py +3 -0
- wandb/apis/public/api.py +128 -2
- wandb/apis/public/artifacts.py +11 -7
- wandb/apis/public/jobs.py +8 -0
- wandb/apis/public/runs.py +16 -5
- wandb/bin/nvidia_gpu_stats.exe +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/cli/cli.py +0 -3
- wandb/errors/__init__.py +11 -40
- wandb/errors/errors.py +37 -0
- wandb/errors/warnings.py +2 -0
- wandb/integration/tensorboard/log.py +1 -1
- wandb/old/core.py +2 -80
- wandb/plot/bar.py +7 -4
- wandb/plot/confusion_matrix.py +5 -4
- wandb/plot/histogram.py +7 -4
- wandb/plot/line.py +7 -4
- wandb/proto/v3/wandb_internal_pb2.py +31 -21
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_internal_pb2.py +23 -21
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v5/wandb_internal_pb2.py +23 -21
- wandb/proto/v5/wandb_settings_pb2.py +2 -2
- wandb/sdk/artifacts/_validators.py +48 -3
- wandb/sdk/artifacts/artifact.py +160 -186
- wandb/sdk/artifacts/artifact_file_cache.py +13 -11
- wandb/sdk/artifacts/artifact_instance_cache.py +4 -2
- wandb/sdk/artifacts/artifact_manifest.py +13 -11
- wandb/sdk/artifacts/artifact_manifest_entry.py +24 -22
- wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +9 -7
- wandb/sdk/artifacts/artifact_saver.py +27 -25
- wandb/sdk/artifacts/exceptions.py +26 -25
- wandb/sdk/artifacts/storage_handler.py +11 -9
- wandb/sdk/artifacts/storage_handlers/azure_handler.py +16 -14
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +15 -13
- wandb/sdk/artifacts/storage_handlers/http_handler.py +15 -14
- wandb/sdk/artifacts/storage_handlers/local_file_handler.py +10 -8
- wandb/sdk/artifacts/storage_handlers/multi_handler.py +14 -12
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +19 -19
- wandb/sdk/artifacts/storage_handlers/tracking_handler.py +10 -8
- wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +12 -10
- wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +9 -7
- wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +31 -29
- wandb/sdk/artifacts/storage_policy.py +20 -20
- wandb/sdk/backend/backend.py +8 -26
- wandb/sdk/data_types/base_types/wb_value.py +1 -3
- wandb/sdk/data_types/video.py +2 -2
- wandb/sdk/interface/interface.py +0 -24
- wandb/sdk/interface/interface_shared.py +0 -12
- wandb/sdk/internal/handler.py +0 -10
- wandb/sdk/internal/internal_api.py +71 -0
- wandb/sdk/internal/sender.py +0 -43
- wandb/sdk/internal/tb_watcher.py +1 -1
- wandb/sdk/lib/_settings_toposort_generated.py +1 -0
- wandb/sdk/lib/hashutil.py +34 -12
- wandb/sdk/lib/service_connection.py +216 -0
- wandb/sdk/lib/service_token.py +94 -0
- wandb/sdk/lib/sock_client.py +7 -3
- wandb/sdk/service/server.py +2 -5
- wandb/sdk/service/service.py +0 -22
- wandb/sdk/wandb_init.py +33 -22
- wandb/sdk/wandb_run.py +45 -33
- wandb/sdk/wandb_settings.py +2 -0
- wandb/sdk/wandb_setup.py +25 -16
- wandb/sdk/wandb_sync.py +9 -3
- wandb/sdk/wandb_watch.py +31 -15
- wandb/util.py +8 -1
- {wandb-0.18.1.dist-info → wandb-0.18.3.dist-info}/METADATA +3 -2
- {wandb-0.18.1.dist-info → wandb-0.18.3.dist-info}/RECORD +75 -74
- wandb/sdk/internal/update.py +0 -113
- wandb/sdk/service/service_base.py +0 -50
- wandb/sdk/service/service_sock.py +0 -70
- wandb/sdk/wandb_manager.py +0 -232
- /wandb/{sdk/lib → plot}/viz.py +0 -0
- {wandb-0.18.1.dist-info → wandb-0.18.3.dist-info}/WHEEL +0 -0
- {wandb-0.18.1.dist-info → wandb-0.18.3.dist-info}/entry_points.txt +0 -0
- {wandb-0.18.1.dist-info → wandb-0.18.3.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/wandb_manager.py
DELETED
@@ -1,232 +0,0 @@
|
|
1
|
-
"""Manage wandb processes.
|
2
|
-
|
3
|
-
Create a manager channel.
|
4
|
-
"""
|
5
|
-
|
6
|
-
import atexit
|
7
|
-
import os
|
8
|
-
from typing import TYPE_CHECKING, Callable, Optional
|
9
|
-
|
10
|
-
import psutil
|
11
|
-
|
12
|
-
import wandb
|
13
|
-
from wandb import env, trigger
|
14
|
-
from wandb.errors import Error
|
15
|
-
from wandb.sdk.lib.exit_hooks import ExitHooks
|
16
|
-
|
17
|
-
if TYPE_CHECKING:
|
18
|
-
from wandb.proto import wandb_settings_pb2
|
19
|
-
from wandb.sdk.service import service
|
20
|
-
from wandb.sdk.service.service_base import ServiceInterface
|
21
|
-
from wandb.sdk.wandb_settings import Settings
|
22
|
-
|
23
|
-
|
24
|
-
class ManagerConnectionError(Error):
|
25
|
-
"""Raised when service process is not running."""
|
26
|
-
|
27
|
-
pass
|
28
|
-
|
29
|
-
|
30
|
-
class ManagerConnectionRefusedError(ManagerConnectionError):
|
31
|
-
"""Raised when service process is not running."""
|
32
|
-
|
33
|
-
pass
|
34
|
-
|
35
|
-
|
36
|
-
class _ManagerToken:
|
37
|
-
_version = "2"
|
38
|
-
_supported_transports = {"tcp"}
|
39
|
-
_token_str: str
|
40
|
-
_pid: int
|
41
|
-
_transport: str
|
42
|
-
_host: str
|
43
|
-
_port: int
|
44
|
-
|
45
|
-
def __init__(self, token: str) -> None:
|
46
|
-
self._token_str = token
|
47
|
-
self._parse()
|
48
|
-
|
49
|
-
@classmethod
|
50
|
-
def from_environment(cls) -> Optional["_ManagerToken"]:
|
51
|
-
token = os.environ.get(env.SERVICE)
|
52
|
-
if not token:
|
53
|
-
return None
|
54
|
-
return cls(token=token)
|
55
|
-
|
56
|
-
@classmethod
|
57
|
-
def from_params(cls, transport: str, host: str, port: int) -> "_ManagerToken":
|
58
|
-
version = cls._version
|
59
|
-
pid = os.getpid()
|
60
|
-
token = "-".join([version, str(pid), transport, host, str(port)])
|
61
|
-
return cls(token=token)
|
62
|
-
|
63
|
-
def set_environment(self) -> None:
|
64
|
-
os.environ[env.SERVICE] = self._token_str
|
65
|
-
|
66
|
-
def _parse(self) -> None:
|
67
|
-
assert self._token_str
|
68
|
-
parts = self._token_str.split("-")
|
69
|
-
assert len(parts) == 5, f"token must have 5 parts: {parts}"
|
70
|
-
# TODO: make more robust?
|
71
|
-
version, pid_str, transport, host, port_str = parts
|
72
|
-
assert version == self._version
|
73
|
-
assert transport in self._supported_transports
|
74
|
-
self._pid = int(pid_str)
|
75
|
-
self._transport = transport
|
76
|
-
self._host = host
|
77
|
-
self._port = int(port_str)
|
78
|
-
|
79
|
-
def reset_environment(self) -> None:
|
80
|
-
os.environ.pop(env.SERVICE, None)
|
81
|
-
|
82
|
-
@property
|
83
|
-
def token(self) -> str:
|
84
|
-
return self._token_str
|
85
|
-
|
86
|
-
@property
|
87
|
-
def pid(self) -> int:
|
88
|
-
return self._pid
|
89
|
-
|
90
|
-
@property
|
91
|
-
def transport(self) -> str:
|
92
|
-
return self._transport
|
93
|
-
|
94
|
-
@property
|
95
|
-
def host(self) -> str:
|
96
|
-
return self._host
|
97
|
-
|
98
|
-
@property
|
99
|
-
def port(self) -> int:
|
100
|
-
return self._port
|
101
|
-
|
102
|
-
|
103
|
-
class _Manager:
|
104
|
-
_token: _ManagerToken
|
105
|
-
_atexit_lambda: Optional[Callable[[], None]]
|
106
|
-
_hooks: Optional[ExitHooks]
|
107
|
-
_settings: "Settings"
|
108
|
-
_service: "service._Service"
|
109
|
-
|
110
|
-
def _service_connect(self) -> None:
|
111
|
-
port = self._token.port
|
112
|
-
svc_iface = self._get_service_interface()
|
113
|
-
|
114
|
-
try:
|
115
|
-
svc_iface._svc_connect(port=port)
|
116
|
-
|
117
|
-
except ConnectionRefusedError as e:
|
118
|
-
if not psutil.pid_exists(self._token.pid):
|
119
|
-
message = (
|
120
|
-
"Connection to wandb service failed"
|
121
|
-
" because the process is not available."
|
122
|
-
)
|
123
|
-
else:
|
124
|
-
message = "Connection to wandb service failed."
|
125
|
-
raise ManagerConnectionRefusedError(message) from e
|
126
|
-
|
127
|
-
except Exception as e:
|
128
|
-
raise ManagerConnectionError(
|
129
|
-
"Connection to wandb service failed.",
|
130
|
-
) from e
|
131
|
-
|
132
|
-
def __init__(self, settings: "Settings") -> None:
|
133
|
-
"""Connects to the internal service, starting it if necessary."""
|
134
|
-
from wandb.sdk.service import service
|
135
|
-
|
136
|
-
self._settings = settings
|
137
|
-
self._atexit_lambda = None
|
138
|
-
self._hooks = None
|
139
|
-
|
140
|
-
self._service = service._Service(settings=self._settings)
|
141
|
-
|
142
|
-
token = _ManagerToken.from_environment()
|
143
|
-
if not token:
|
144
|
-
self._service.start()
|
145
|
-
host = "localhost"
|
146
|
-
transport = "tcp"
|
147
|
-
port = self._service.sock_port
|
148
|
-
assert port
|
149
|
-
token = _ManagerToken.from_params(transport=transport, host=host, port=port)
|
150
|
-
token.set_environment()
|
151
|
-
self._atexit_setup()
|
152
|
-
self._token = token
|
153
|
-
|
154
|
-
try:
|
155
|
-
self._service_connect()
|
156
|
-
except ManagerConnectionError as e:
|
157
|
-
wandb._sentry.reraise(e)
|
158
|
-
|
159
|
-
def _teardown(self, exit_code: int) -> int:
|
160
|
-
"""Shuts down the internal process and returns its exit code.
|
161
|
-
|
162
|
-
This sends a teardown record to the process. An exception is raised if
|
163
|
-
the process has already been shut down.
|
164
|
-
"""
|
165
|
-
if self._atexit_lambda:
|
166
|
-
atexit.unregister(self._atexit_lambda)
|
167
|
-
self._atexit_lambda = None
|
168
|
-
|
169
|
-
try:
|
170
|
-
self._inform_teardown(exit_code)
|
171
|
-
return self._service.join()
|
172
|
-
finally:
|
173
|
-
self._token.reset_environment()
|
174
|
-
|
175
|
-
def _atexit_setup(self) -> None:
|
176
|
-
self._atexit_lambda = lambda: self._atexit_teardown()
|
177
|
-
|
178
|
-
self._hooks = ExitHooks()
|
179
|
-
self._hooks.hook()
|
180
|
-
atexit.register(self._atexit_lambda)
|
181
|
-
|
182
|
-
def _atexit_teardown(self) -> None:
|
183
|
-
trigger.call("on_finished")
|
184
|
-
|
185
|
-
# Clear the atexit hook---we're executing it now, after which the
|
186
|
-
# process will exit.
|
187
|
-
self._atexit_lambda = None
|
188
|
-
|
189
|
-
try:
|
190
|
-
self._teardown(self._hooks.exit_code if self._hooks else 0)
|
191
|
-
except Exception as e:
|
192
|
-
wandb.termlog(
|
193
|
-
f"Encountered an error while tearing down the service manager: {e}",
|
194
|
-
repeat=False,
|
195
|
-
)
|
196
|
-
|
197
|
-
def _get_service(self) -> "service._Service":
|
198
|
-
return self._service
|
199
|
-
|
200
|
-
def _get_service_interface(self) -> "ServiceInterface":
|
201
|
-
assert self._service
|
202
|
-
svc_iface = self._service.service_interface
|
203
|
-
assert svc_iface
|
204
|
-
return svc_iface
|
205
|
-
|
206
|
-
def _inform_init(
|
207
|
-
self, settings: "wandb_settings_pb2.Settings", run_id: str
|
208
|
-
) -> None:
|
209
|
-
svc_iface = self._get_service_interface()
|
210
|
-
svc_iface._svc_inform_init(settings=settings, run_id=run_id)
|
211
|
-
|
212
|
-
def _inform_start(
|
213
|
-
self, settings: "wandb_settings_pb2.Settings", run_id: str
|
214
|
-
) -> None:
|
215
|
-
svc_iface = self._get_service_interface()
|
216
|
-
svc_iface._svc_inform_start(settings=settings, run_id=run_id)
|
217
|
-
|
218
|
-
def _inform_attach(self, attach_id: str) -> Optional["wandb_settings_pb2.Settings"]:
|
219
|
-
svc_iface = self._get_service_interface()
|
220
|
-
try:
|
221
|
-
response = svc_iface._svc_inform_attach(attach_id=attach_id)
|
222
|
-
except Exception:
|
223
|
-
return None
|
224
|
-
return response.settings
|
225
|
-
|
226
|
-
def _inform_finish(self, run_id: Optional[str] = None) -> None:
|
227
|
-
svc_iface = self._get_service_interface()
|
228
|
-
svc_iface._svc_inform_finish(run_id=run_id)
|
229
|
-
|
230
|
-
def _inform_teardown(self, exit_code: int) -> None:
|
231
|
-
svc_iface = self._get_service_interface()
|
232
|
-
svc_iface._svc_inform_teardown(exit_code)
|
/wandb/{sdk/lib → plot}/viz.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|