wandb 0.18.0rc1__py3-none-win_amd64.whl → 0.18.2__py3-none-win_amd64.whl
Sign up to get free protection for your applications and to get access to all the features.
- wandb/__init__.py +4 -4
- 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 +18 -5
- wandb/bin/wandb-core +0 -0
- wandb/cli/cli.py +0 -5
- wandb/data_types.py +9 -2019
- wandb/env.py +0 -5
- wandb/errors/__init__.py +11 -40
- wandb/errors/errors.py +37 -0
- wandb/errors/warnings.py +2 -0
- wandb/{sklearn → integration/sklearn}/calculate/calibration_curves.py +7 -7
- wandb/{sklearn → integration/sklearn}/calculate/class_proportions.py +1 -1
- wandb/{sklearn → integration/sklearn}/calculate/confusion_matrix.py +3 -2
- wandb/{sklearn → integration/sklearn}/calculate/elbow_curve.py +6 -6
- wandb/{sklearn → integration/sklearn}/calculate/learning_curve.py +2 -2
- wandb/{sklearn → integration/sklearn}/calculate/outlier_candidates.py +2 -2
- wandb/{sklearn → integration/sklearn}/calculate/residuals.py +8 -8
- wandb/{sklearn → integration/sklearn}/calculate/silhouette.py +2 -2
- wandb/{sklearn → integration/sklearn}/calculate/summary_metrics.py +2 -2
- wandb/{sklearn → integration/sklearn}/plot/classifier.py +5 -5
- wandb/{sklearn → integration/sklearn}/plot/clusterer.py +10 -6
- wandb/{sklearn → integration/sklearn}/plot/regressor.py +5 -5
- wandb/{sklearn → integration/sklearn}/plot/shared.py +3 -3
- wandb/{sklearn → integration/sklearn}/utils.py +8 -8
- wandb/integration/tensorboard/log.py +1 -1
- wandb/{wandb_torch.py → integration/torch/wandb_torch.py} +36 -32
- 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_base_pb2.py +2 -1
- wandb/proto/v3/wandb_internal_pb2.py +2 -1
- wandb/proto/v3/wandb_server_pb2.py +2 -1
- wandb/proto/v3/wandb_settings_pb2.py +3 -2
- wandb/proto/v3/wandb_telemetry_pb2.py +2 -1
- wandb/proto/v4/wandb_base_pb2.py +2 -1
- wandb/proto/v4/wandb_internal_pb2.py +2 -1
- wandb/proto/v4/wandb_server_pb2.py +2 -1
- wandb/proto/v4/wandb_settings_pb2.py +3 -2
- wandb/proto/v4/wandb_telemetry_pb2.py +2 -1
- wandb/proto/v5/wandb_base_pb2.py +3 -2
- wandb/proto/v5/wandb_internal_pb2.py +3 -2
- wandb/proto/v5/wandb_server_pb2.py +3 -2
- wandb/proto/v5/wandb_settings_pb2.py +4 -3
- wandb/proto/v5/wandb_telemetry_pb2.py +3 -2
- wandb/sdk/artifacts/_validators.py +48 -3
- wandb/sdk/artifacts/artifact.py +157 -183
- 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/audio.py +165 -0
- wandb/sdk/data_types/base_types/wb_value.py +1 -3
- wandb/sdk/data_types/bokeh.py +70 -0
- wandb/sdk/data_types/graph.py +405 -0
- wandb/sdk/data_types/image.py +156 -0
- wandb/sdk/data_types/table.py +1204 -0
- wandb/sdk/data_types/trace_tree.py +2 -2
- wandb/sdk/data_types/utils.py +49 -0
- 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 +2 -31
- wandb/sdk/service/streams.py +0 -7
- wandb/sdk/wandb_init.py +42 -25
- wandb/sdk/wandb_run.py +18 -159
- 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/sklearn.py +35 -0
- wandb/util.py +14 -3
- {wandb-0.18.0rc1.dist-info → wandb-0.18.2.dist-info}/METADATA +6 -5
- {wandb-0.18.0rc1.dist-info → wandb-0.18.2.dist-info}/RECORD +114 -110
- wandb/sdk/internal/update.py +0 -113
- wandb/sdk/lib/console.py +0 -39
- wandb/sdk/service/service_base.py +0 -50
- wandb/sdk/service/service_sock.py +0 -70
- wandb/sdk/wandb_manager.py +0 -232
- /wandb/{sklearn → integration/sklearn}/__init__.py +0 -0
- /wandb/{sklearn → integration/sklearn}/calculate/__init__.py +0 -0
- /wandb/{sklearn → integration/sklearn}/calculate/decision_boundaries.py +0 -0
- /wandb/{sklearn → integration/sklearn}/calculate/feature_importances.py +0 -0
- /wandb/{sklearn → integration/sklearn}/plot/__init__.py +0 -0
- /wandb/{sdk/lib → plot}/viz.py +0 -0
- {wandb-0.18.0rc1.dist-info → wandb-0.18.2.dist-info}/WHEEL +0 -0
- {wandb-0.18.0rc1.dist-info → wandb-0.18.2.dist-info}/entry_points.txt +0 -0
- {wandb-0.18.0rc1.dist-info → wandb-0.18.2.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,94 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
import dataclasses
|
4
|
+
import os
|
5
|
+
|
6
|
+
from wandb import env
|
7
|
+
|
8
|
+
_CURRENT_VERSION = "2"
|
9
|
+
_SUPPORTED_TRANSPORTS = "tcp"
|
10
|
+
|
11
|
+
|
12
|
+
def get_service_token() -> ServiceToken | None:
|
13
|
+
"""Reads the token from environment variables.
|
14
|
+
|
15
|
+
Returns:
|
16
|
+
The token if the correct environment variable is set, or None.
|
17
|
+
|
18
|
+
Raises:
|
19
|
+
ValueError: If the environment variable is set but cannot be
|
20
|
+
parsed.
|
21
|
+
"""
|
22
|
+
token = os.environ.get(env.SERVICE)
|
23
|
+
if not token:
|
24
|
+
return None
|
25
|
+
|
26
|
+
parts = token.split("-")
|
27
|
+
if len(parts) != 5:
|
28
|
+
raise ValueError(f"Invalid token: {token}")
|
29
|
+
|
30
|
+
version, pid_str, transport, host, port_str = parts
|
31
|
+
|
32
|
+
if version != _CURRENT_VERSION:
|
33
|
+
raise ValueError(
|
34
|
+
f"Expected version {_CURRENT_VERSION},"
|
35
|
+
f" but got {version} (token={token})"
|
36
|
+
)
|
37
|
+
if transport not in _SUPPORTED_TRANSPORTS:
|
38
|
+
raise ValueError(
|
39
|
+
f"Unsupported transport: {transport} (token={token})",
|
40
|
+
)
|
41
|
+
|
42
|
+
try:
|
43
|
+
return ServiceToken(
|
44
|
+
version=version,
|
45
|
+
pid=int(pid_str),
|
46
|
+
transport=transport,
|
47
|
+
host=host,
|
48
|
+
port=int(port_str),
|
49
|
+
)
|
50
|
+
except ValueError as e:
|
51
|
+
raise ValueError(f"Invalid token: {token}") from e
|
52
|
+
|
53
|
+
|
54
|
+
def set_service_token(parent_pid: int, transport: str, host: str, port: int) -> None:
|
55
|
+
"""Stores a service token in an environment variable.
|
56
|
+
|
57
|
+
Args:
|
58
|
+
parent_pid: The process ID of the process that started the service.
|
59
|
+
transport: The transport used to communicate with the service.
|
60
|
+
host: The host part of the internet address on which the service
|
61
|
+
is listening (e.g. localhost).
|
62
|
+
port: The port the service is listening on.
|
63
|
+
|
64
|
+
Raises:
|
65
|
+
ValueError: If given an unsupported transport.
|
66
|
+
"""
|
67
|
+
if transport not in _SUPPORTED_TRANSPORTS:
|
68
|
+
raise ValueError(f"Unsupported transport: {transport}")
|
69
|
+
|
70
|
+
os.environ[env.SERVICE] = "-".join(
|
71
|
+
(
|
72
|
+
_CURRENT_VERSION,
|
73
|
+
str(parent_pid),
|
74
|
+
transport,
|
75
|
+
host,
|
76
|
+
str(port),
|
77
|
+
)
|
78
|
+
)
|
79
|
+
|
80
|
+
|
81
|
+
def clear_service_token() -> None:
|
82
|
+
"""Clears the environment variable storing the service token."""
|
83
|
+
os.environ.pop(env.SERVICE, None)
|
84
|
+
|
85
|
+
|
86
|
+
@dataclasses.dataclass(frozen=True)
|
87
|
+
class ServiceToken:
|
88
|
+
"""An identifier for a running service process."""
|
89
|
+
|
90
|
+
version: str
|
91
|
+
pid: int
|
92
|
+
transport: str
|
93
|
+
host: str
|
94
|
+
port: int
|
wandb/sdk/lib/sock_client.py
CHANGED
@@ -14,9 +14,11 @@ if TYPE_CHECKING:
|
|
14
14
|
|
15
15
|
|
16
16
|
class SockClientClosedError(Exception):
|
17
|
-
"""
|
17
|
+
"""Raised on operations on a closed socket."""
|
18
18
|
|
19
|
-
|
19
|
+
|
20
|
+
class SockClientTimeoutError(Exception):
|
21
|
+
"""Raised if the server didn't respond before the timeout."""
|
20
22
|
|
21
23
|
|
22
24
|
class SockBuffer:
|
@@ -182,8 +184,10 @@ class SockClient:
|
|
182
184
|
# it should be relatively stable.
|
183
185
|
# This pass would be solved as part of the fix in https://wandb.atlassian.net/browse/WB-8709
|
184
186
|
response = self.read_server_response(timeout=1)
|
187
|
+
|
185
188
|
if response is None:
|
186
|
-
raise
|
189
|
+
raise SockClientTimeoutError("No response after 1 second.")
|
190
|
+
|
187
191
|
return response
|
188
192
|
|
189
193
|
def send(
|
wandb/sdk/service/server.py
CHANGED
@@ -20,7 +20,6 @@ class WandbServer:
|
|
20
20
|
_pid: Optional[int]
|
21
21
|
_sock_port: Optional[int]
|
22
22
|
_debug: bool
|
23
|
-
_serve_sock: bool
|
24
23
|
_sock_server: Optional[SocketServer]
|
25
24
|
_startup_debug_enabled: bool
|
26
25
|
|
@@ -31,14 +30,12 @@ class WandbServer:
|
|
31
30
|
address: Optional[str] = None,
|
32
31
|
pid: Optional[int] = None,
|
33
32
|
debug: bool = True,
|
34
|
-
serve_sock: bool = False,
|
35
33
|
) -> None:
|
36
34
|
self._sock_port = sock_port
|
37
35
|
self._port_fname = port_fname
|
38
36
|
self._address = address
|
39
37
|
self._pid = pid
|
40
38
|
self._debug = debug
|
41
|
-
self._serve_sock = serve_sock
|
42
39
|
self._sock_server = None
|
43
40
|
self._startup_debug_enabled = _startup_debug.is_enabled()
|
44
41
|
|
@@ -97,7 +94,7 @@ class WandbServer:
|
|
97
94
|
pid = str(self._pid or 0)
|
98
95
|
transport = "s" if sock_port else "g"
|
99
96
|
port = sock_port or 0
|
100
|
-
# this format is similar to
|
97
|
+
# this format is similar to the service token, but it's purely informative now
|
101
98
|
# (consider unifying this in the future)
|
102
99
|
service_id = f"{service_ver}-{pid}-{transport}-{port}"
|
103
100
|
proc_title = f"wandb-service({service_id})"
|
@@ -109,7 +106,7 @@ class WandbServer:
|
|
109
106
|
self._setup_tracelog()
|
110
107
|
mux = StreamMux()
|
111
108
|
self._startup_debug_print("before_network")
|
112
|
-
sock_port = self._start_sock(mux=mux)
|
109
|
+
sock_port = self._start_sock(mux=mux)
|
113
110
|
self._startup_debug_print("after_network")
|
114
111
|
self._inform_used_ports(sock_port=sock_port)
|
115
112
|
self._startup_debug_print("after_inform")
|
wandb/sdk/service/service.py
CHANGED
@@ -15,18 +15,12 @@ import time
|
|
15
15
|
from typing import TYPE_CHECKING, Any, Dict, Optional
|
16
16
|
|
17
17
|
from wandb import _sentry, termlog
|
18
|
-
from wandb.env import
|
19
|
-
core_debug,
|
20
|
-
core_error_reporting_enabled,
|
21
|
-
is_require_legacy_service,
|
22
|
-
)
|
18
|
+
from wandb.env import core_debug, error_reporting_enabled, is_require_legacy_service
|
23
19
|
from wandb.errors import Error, WandbCoreNotAvailableError
|
24
20
|
from wandb.sdk.lib.wburls import wburls
|
25
21
|
from wandb.util import get_core_path, get_module
|
26
22
|
|
27
23
|
from . import _startup_debug, port_file
|
28
|
-
from .service_base import ServiceInterface
|
29
|
-
from .service_sock import ServiceSockInterface
|
30
24
|
|
31
25
|
if TYPE_CHECKING:
|
32
26
|
from wandb.sdk.wandb_settings import Settings
|
@@ -35,25 +29,18 @@ if TYPE_CHECKING:
|
|
35
29
|
class ServiceStartProcessError(Error):
|
36
30
|
"""Raised when a known error occurs when launching wandb service."""
|
37
31
|
|
38
|
-
pass
|
39
|
-
|
40
32
|
|
41
33
|
class ServiceStartTimeoutError(Error):
|
42
34
|
"""Raised when service start times out."""
|
43
35
|
|
44
|
-
pass
|
45
|
-
|
46
36
|
|
47
37
|
class ServiceStartPortError(Error):
|
48
38
|
"""Raised when service start fails to find a port."""
|
49
39
|
|
50
|
-
pass
|
51
|
-
|
52
40
|
|
53
41
|
class _Service:
|
54
42
|
_settings: "Settings"
|
55
43
|
_sock_port: Optional[int]
|
56
|
-
_service_interface: ServiceInterface
|
57
44
|
_internal_proc: Optional[subprocess.Popen]
|
58
45
|
_startup_debug_enabled: bool
|
59
46
|
|
@@ -69,10 +56,6 @@ class _Service:
|
|
69
56
|
|
70
57
|
_sentry.configure_scope(tags=dict(settings), process_context="service")
|
71
58
|
|
72
|
-
# current code only supports socket server implementation, in the
|
73
|
-
# future we might be able to support both
|
74
|
-
self._service_interface = ServiceSockInterface()
|
75
|
-
|
76
59
|
def _startup_debug_print(self, message: str) -> None:
|
77
60
|
if not self._startup_debug_enabled:
|
78
61
|
return
|
@@ -162,9 +145,6 @@ class _Service:
|
|
162
145
|
|
163
146
|
executable = self._settings._executable
|
164
147
|
exec_cmd_list = [executable, "-m"]
|
165
|
-
# Add coverage collection if needed
|
166
|
-
if os.environ.get("YEA_RUN_COVERAGE") and os.environ.get("COVERAGE_RCFILE"):
|
167
|
-
exec_cmd_list += ["coverage", "run", "-m"]
|
168
148
|
|
169
149
|
service_args = []
|
170
150
|
|
@@ -176,16 +156,12 @@ class _Service:
|
|
176
156
|
|
177
157
|
service_args.extend([core_path])
|
178
158
|
|
179
|
-
if not
|
159
|
+
if not error_reporting_enabled():
|
180
160
|
service_args.append("--no-observability")
|
181
161
|
|
182
162
|
if core_debug(default="False"):
|
183
163
|
service_args.append("--debug")
|
184
164
|
|
185
|
-
trace_filename = os.environ.get("_WANDB_TRACE")
|
186
|
-
if trace_filename is not None:
|
187
|
-
service_args.extend(["--trace", trace_filename])
|
188
|
-
|
189
165
|
exec_cmd_list = []
|
190
166
|
termlog(
|
191
167
|
"Using wandb-core as the SDK backend."
|
@@ -201,7 +177,6 @@ class _Service:
|
|
201
177
|
"--pid",
|
202
178
|
pid,
|
203
179
|
]
|
204
|
-
service_args.append("--serve-sock")
|
205
180
|
|
206
181
|
if os.environ.get("WANDB_SERVICE_PROFILE") == "memray":
|
207
182
|
_ = get_module(
|
@@ -260,10 +235,6 @@ class _Service:
|
|
260
235
|
def sock_port(self) -> Optional[int]:
|
261
236
|
return self._sock_port
|
262
237
|
|
263
|
-
@property
|
264
|
-
def service_interface(self) -> ServiceInterface:
|
265
|
-
return self._service_interface
|
266
|
-
|
267
238
|
def join(self) -> int:
|
268
239
|
ret = 0
|
269
240
|
if self._internal_proc:
|
wandb/sdk/service/streams.py
CHANGED
@@ -317,7 +317,6 @@ class StreamMux:
|
|
317
317
|
# These could be done in parallel in the future
|
318
318
|
for _sid, stream in started_streams.items():
|
319
319
|
# dispatch all our final requests
|
320
|
-
server_info_handle = stream.interface.deliver_request_server_info()
|
321
320
|
poll_exit_handle = stream.interface.deliver_poll_exit()
|
322
321
|
final_summary_handle = stream.interface.deliver_get_summary()
|
323
322
|
sampled_history_handle = stream.interface.deliver_request_sampled_history()
|
@@ -327,11 +326,6 @@ class StreamMux:
|
|
327
326
|
assert result
|
328
327
|
internal_messages_response = result.response.internal_messages_response
|
329
328
|
|
330
|
-
# wait for them, it's ok to do this serially but this can be improved
|
331
|
-
result = server_info_handle.wait(timeout=-1)
|
332
|
-
assert result
|
333
|
-
server_info_response = result.response.server_info_response
|
334
|
-
|
335
329
|
result = poll_exit_handle.wait(timeout=-1)
|
336
330
|
assert result
|
337
331
|
poll_exit_response = result.response.poll_exit_response
|
@@ -348,7 +342,6 @@ class StreamMux:
|
|
348
342
|
sampled_history=sampled_history,
|
349
343
|
final_summary=final_summary,
|
350
344
|
poll_exit_response=poll_exit_response,
|
351
|
-
server_info_response=server_info_response,
|
352
345
|
internal_messages_response=internal_messages_response,
|
353
346
|
settings=stream._settings, # type: ignore
|
354
347
|
printer=printer,
|
wandb/sdk/wandb_init.py
CHANGED
@@ -174,12 +174,19 @@ class _WandbInit:
|
|
174
174
|
|
175
175
|
# we add this logic to be backward compatible with the old behavior of disable
|
176
176
|
# where it would disable the service if the mode was set to disabled
|
177
|
+
# TODO: use the regular settins object to handle this
|
177
178
|
mode = kwargs.get("mode")
|
178
179
|
settings_mode = (kwargs.get("settings") or {}).get("mode") or os.environ.get(
|
179
|
-
|
180
|
+
wandb.env.MODE
|
180
181
|
)
|
181
|
-
|
182
|
-
|
182
|
+
settings__disable_service = (kwargs.get("settings") or {}).get(
|
183
|
+
"_disable_service"
|
184
|
+
) or os.environ.get(wandb.env._DISABLE_SERVICE)
|
185
|
+
|
186
|
+
setup_settings = {
|
187
|
+
"mode": mode or settings_mode,
|
188
|
+
"_disable_service": settings__disable_service,
|
189
|
+
}
|
183
190
|
|
184
191
|
self._wl = wandb_setup.setup(settings=setup_settings)
|
185
192
|
# Make sure we have a logger setup (might be an early logger)
|
@@ -648,9 +655,9 @@ class _WandbInit:
|
|
648
655
|
f"Successfully finished last run (ID:{latest_run._run_id}). Initializing new run:<br/>"
|
649
656
|
)
|
650
657
|
elif isinstance(wandb.run, Run):
|
651
|
-
|
658
|
+
service = self._wl.service
|
652
659
|
# We shouldn't return a stale global run if we are in a new pid
|
653
|
-
if not
|
660
|
+
if not service or os.getpid() == wandb.run._init_pid:
|
654
661
|
logger.info("wandb.init() called when a run is still active")
|
655
662
|
with telemetry.context() as tel:
|
656
663
|
tel.feature.init_return_run = True
|
@@ -658,15 +665,20 @@ class _WandbInit:
|
|
658
665
|
|
659
666
|
logger.info("starting backend")
|
660
667
|
|
661
|
-
|
662
|
-
if
|
663
|
-
logger.info("
|
664
|
-
|
665
|
-
settings=self.settings.to_proto(),
|
668
|
+
service = self._wl.service
|
669
|
+
if service:
|
670
|
+
logger.info("sending inform_init request")
|
671
|
+
service.inform_init(
|
672
|
+
settings=self.settings.to_proto(),
|
673
|
+
run_id=self.settings.run_id,
|
666
674
|
)
|
667
675
|
|
668
676
|
mailbox = Mailbox()
|
669
|
-
backend = Backend(
|
677
|
+
backend = Backend(
|
678
|
+
settings=self.settings,
|
679
|
+
service=service,
|
680
|
+
mailbox=mailbox,
|
681
|
+
)
|
670
682
|
backend.ensure_launched()
|
671
683
|
logger.info("backend started and connected")
|
672
684
|
# Make sure we are logged in
|
@@ -732,7 +744,7 @@ class _WandbInit:
|
|
732
744
|
if os.environ.get(wandb.env._DISABLE_SERVICE):
|
733
745
|
tel.feature.service_disabled = True
|
734
746
|
|
735
|
-
if
|
747
|
+
if service:
|
736
748
|
tel.feature.service = True
|
737
749
|
if self.settings._flow_control_disabled:
|
738
750
|
tel.feature.flow_control_disabled = True
|
@@ -823,7 +835,7 @@ class _WandbInit:
|
|
823
835
|
|
824
836
|
if error is not None:
|
825
837
|
logger.error(f"encountered error: {error}")
|
826
|
-
if not
|
838
|
+
if not service:
|
827
839
|
# Shutdown the backend and get rid of the logger
|
828
840
|
# we don't need to do console cleanup at this point
|
829
841
|
backend.cleanup()
|
@@ -850,9 +862,10 @@ class _WandbInit:
|
|
850
862
|
logger.info("starting run threads in backend")
|
851
863
|
# initiate run (stats and metadata probing)
|
852
864
|
|
853
|
-
if
|
854
|
-
|
855
|
-
settings=self.settings.to_proto(),
|
865
|
+
if service:
|
866
|
+
service.inform_start(
|
867
|
+
settings=self.settings.to_proto(),
|
868
|
+
run_id=self.settings.run_id,
|
856
869
|
)
|
857
870
|
|
858
871
|
assert backend.interface
|
@@ -927,33 +940,37 @@ def _attach(
|
|
927
940
|
if logger is None:
|
928
941
|
raise UsageError("logger is not initialized")
|
929
942
|
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
943
|
+
service = _wl.service
|
944
|
+
if not service:
|
945
|
+
raise UsageError(f"Unable to attach to run {attach_id} (no service process)")
|
946
|
+
|
947
|
+
try:
|
948
|
+
attach_settings = service.inform_attach(attach_id=attach_id)
|
949
|
+
except Exception as e:
|
950
|
+
raise UsageError(f"Unable to attach to run {attach_id}") from e
|
934
951
|
|
935
952
|
settings: Settings = copy.copy(_wl._settings)
|
936
953
|
|
937
954
|
settings.update(
|
938
955
|
{
|
939
956
|
"run_id": attach_id,
|
940
|
-
"_start_time":
|
941
|
-
"_start_datetime":
|
942
|
-
"_offline":
|
957
|
+
"_start_time": attach_settings._start_time.value,
|
958
|
+
"_start_datetime": attach_settings._start_datetime.value,
|
959
|
+
"_offline": attach_settings._offline.value,
|
943
960
|
},
|
944
961
|
source=Source.INIT,
|
945
962
|
)
|
946
963
|
|
947
964
|
# TODO: consolidate this codepath with wandb.init()
|
948
965
|
mailbox = Mailbox()
|
949
|
-
backend = Backend(settings=settings,
|
966
|
+
backend = Backend(settings=settings, service=service, mailbox=mailbox)
|
950
967
|
backend.ensure_launched()
|
951
968
|
logger.info("attach backend started and connected")
|
952
969
|
|
953
970
|
if run is None:
|
954
971
|
run = Run(settings=settings)
|
955
972
|
else:
|
956
|
-
run._init()
|
973
|
+
run._init(settings=settings)
|
957
974
|
run._set_library(_wl)
|
958
975
|
run._set_backend(backend)
|
959
976
|
backend._hack_set_run(run)
|