wandb 0.18.6__py3-none-any.whl → 0.19.0rc1__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- package_readme.md +8 -0
- wandb/__init__.py +5 -7
- wandb/__init__.pyi +51 -30
- wandb/analytics/sentry.py +4 -10
- wandb/apis/importers/internals/internal.py +6 -6
- wandb/apis/importers/internals/protocols.py +11 -7
- wandb/apis/public/api.py +5 -1
- wandb/apis/public/jobs.py +1 -7
- wandb/apis/public/reports.py +6 -17
- wandb/apis/public/runs.py +12 -10
- wandb/bin/gpu_stats +0 -0
- wandb/cli/cli.py +9 -45
- wandb/env.py +3 -5
- wandb/errors/links.py +1 -1
- wandb/errors/term.py +1 -6
- wandb/filesync/dir_watcher.py +3 -3
- wandb/filesync/step_upload.py +2 -5
- wandb/integration/fastai/__init__.py +1 -6
- wandb/integration/gym/__init__.py +1 -7
- wandb/integration/keras/callbacks/metrics_logger.py +1 -8
- wandb/integration/keras/callbacks/model_checkpoint.py +1 -8
- wandb/integration/keras/keras.py +3 -5
- wandb/integration/lightgbm/__init__.py +1 -1
- wandb/integration/sb3/sb3.py +1 -7
- wandb/integration/sklearn/utils.py +1 -1
- wandb/integration/tensorboard/log.py +1 -2
- wandb/integration/torch/wandb_torch.py +1 -1
- wandb/integration/ultralytics/bbox_utils.py +9 -2
- wandb/jupyter.py +4 -4
- wandb/proto/v3/wandb_internal_pb2.py +31 -31
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v4/wandb_internal_pb2.py +31 -31
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v5/wandb_internal_pb2.py +31 -31
- wandb/proto/v5/wandb_settings_pb2.py +2 -2
- wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
- wandb/proto/wandb_deprecated.py +3 -11
- wandb/proto/wandb_generate_deprecated.py +3 -7
- wandb/sdk/artifacts/artifact.py +3 -11
- wandb/sdk/artifacts/artifact_file_cache.py +2 -5
- wandb/sdk/artifacts/artifact_saver.py +2 -6
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +2 -4
- wandb/sdk/artifacts/storage_handlers/local_file_handler.py +2 -4
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +2 -4
- wandb/sdk/backend/backend.py +1 -1
- wandb/sdk/data_types/base_types/wb_value.py +20 -10
- wandb/sdk/data_types/histogram.py +1 -3
- wandb/sdk/data_types/object_3d.py +2 -6
- wandb/sdk/data_types/table.py +1 -1
- wandb/sdk/data_types/utils.py +1 -2
- wandb/sdk/data_types/video.py +15 -4
- wandb/sdk/integration_utils/auto_logging.py +1 -8
- wandb/sdk/interface/interface.py +12 -5
- wandb/sdk/interface/interface_queue.py +0 -6
- wandb/sdk/interface/interface_shared.py +9 -0
- wandb/sdk/interface/router.py +1 -2
- wandb/sdk/interface/router_queue.py +0 -3
- wandb/sdk/interface/router_relay.py +0 -2
- wandb/sdk/internal/file_stream.py +1 -4
- wandb/sdk/internal/flow_control.py +1 -1
- wandb/sdk/internal/handler.py +8 -5
- wandb/sdk/internal/internal.py +3 -17
- wandb/sdk/internal/internal_api.py +3 -10
- wandb/sdk/internal/internal_util.py +0 -3
- wandb/sdk/internal/job_builder.py +20 -12
- wandb/sdk/internal/progress.py +1 -5
- wandb/sdk/internal/sender.py +9 -15
- wandb/sdk/internal/settings_static.py +4 -10
- wandb/sdk/internal/system/assets/cpu.py +2 -2
- wandb/sdk/internal/system/assets/disk.py +3 -3
- wandb/sdk/internal/system/assets/gpu.py +7 -7
- wandb/sdk/internal/system/assets/gpu_amd.py +1 -7
- wandb/sdk/internal/system/assets/interfaces.py +11 -13
- wandb/sdk/internal/system/assets/ipu.py +1 -1
- wandb/sdk/internal/system/assets/memory.py +2 -2
- wandb/sdk/internal/system/assets/open_metrics.py +2 -8
- wandb/sdk/internal/system/assets/trainium.py +3 -9
- wandb/sdk/internal/system/system_info.py +14 -13
- wandb/sdk/internal/system/system_monitor.py +5 -12
- wandb/sdk/internal/tb_watcher.py +1 -1
- wandb/sdk/internal/writer.py +2 -4
- wandb/sdk/launch/__init__.py +2 -1
- wandb/sdk/launch/agent/run_queue_item_file_saver.py +1 -7
- wandb/sdk/launch/create_job.py +2 -3
- wandb/sdk/launch/runner/abstract.py +1 -6
- wandb/sdk/launch/runner/kubernetes_monitor.py +2 -4
- wandb/sdk/lib/apikey.py +2 -6
- wandb/sdk/lib/fsm.py +12 -6
- wandb/sdk/lib/ipython.py +1 -6
- wandb/sdk/lib/module.py +0 -3
- wandb/sdk/lib/progress.py +2 -3
- wandb/sdk/lib/run_moment.py +1 -7
- wandb/sdk/lib/server.py +10 -24
- wandb/sdk/lib/sock_client.py +0 -5
- wandb/sdk/service/server.py +3 -12
- wandb/sdk/service/server_sock.py +0 -2
- wandb/sdk/service/service.py +5 -5
- wandb/sdk/wandb_init.py +215 -166
- wandb/sdk/wandb_login.py +17 -27
- wandb/sdk/wandb_run.py +129 -161
- wandb/sdk/wandb_settings.py +978 -1760
- wandb/sdk/wandb_setup.py +87 -94
- wandb/sdk/wandb_watch.py +1 -1
- wandb/sync/sync.py +1 -2
- wandb/util.py +7 -40
- wandb/wandb_controller.py +10 -12
- {wandb-0.18.6.dist-info → wandb-0.19.0rc1.dist-info}/METADATA +13 -4
- {wandb-0.18.6.dist-info → wandb-0.19.0rc1.dist-info}/RECORD +113 -119
- {wandb-0.18.6.dist-info → wandb-0.19.0rc1.dist-info}/WHEEL +1 -1
- wandb/integration/magic.py +0 -556
- wandb/magic.py +0 -3
- wandb/sdk/lib/_settings_toposort_generate.py +0 -159
- wandb/sdk/lib/_settings_toposort_generated.py +0 -250
- wandb/sdk/lib/reporting.py +0 -99
- wandb/sdk/lib/tracelog.py +0 -255
- {wandb-0.18.6.dist-info → wandb-0.19.0rc1.dist-info}/entry_points.txt +0 -0
- {wandb-0.18.6.dist-info → wandb-0.19.0rc1.dist-info}/licenses/LICENSE +0 -0
@@ -1,5 +1,6 @@
|
|
1
1
|
from typing import TYPE_CHECKING, Any, ClassVar, Dict, List, Optional, Type, Union
|
2
2
|
|
3
|
+
import wandb
|
3
4
|
from wandb import util
|
4
5
|
|
5
6
|
if TYPE_CHECKING: # pragma: no cover
|
@@ -13,16 +14,25 @@ if TYPE_CHECKING: # pragma: no cover
|
|
13
14
|
def _server_accepts_client_ids() -> bool:
|
14
15
|
from wandb.util import parse_version
|
15
16
|
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
|
17
|
+
# There are versions of W&B Server that cannot accept client IDs. Those versions of
|
18
|
+
# the backend have a max_cli_version of less than "0.11.0." If the backend cannot
|
19
|
+
# accept client IDs, manifests and artifact data would never be resolvable and lead
|
20
|
+
# to failed uploads. Our position in 2021/06/29 was to never lose data - and instead take the
|
21
|
+
# tradeoff in the UI. The results in tables not displaying media correctly, but
|
22
|
+
# the table can still be accessed via the .artifact op.
|
23
|
+
#
|
24
|
+
# The latest SDK version that is < "0.11.0" was released on 2021/06/29.
|
25
|
+
# AS OF NOW, 2024/11/06, we assume that all customer's server deployments accept
|
26
|
+
# client IDs.
|
27
|
+
#
|
28
|
+
# If there are any users with issues on an older backend, customers can disable the
|
29
|
+
# setting `allow_offline_artifacts` to revert the SDK's behavior back to not
|
30
|
+
# using client IDs in offline mode.
|
31
|
+
if (
|
32
|
+
util._is_offline()
|
33
|
+
and wandb.run
|
34
|
+
and not wandb.run.settings.allow_offline_artifacts
|
35
|
+
):
|
26
36
|
return False
|
27
37
|
|
28
38
|
# If the script is online, request the max_cli_version and ensure the server
|
@@ -78,9 +78,7 @@ class Histogram(WBValue):
|
|
78
78
|
self.histogram = self.histogram.tolist()
|
79
79
|
self.bins = self.bins.tolist()
|
80
80
|
if len(self.histogram) > self.MAX_LENGTH:
|
81
|
-
raise ValueError(
|
82
|
-
"The maximum length of a histogram is %i" % self.MAX_LENGTH
|
83
|
-
)
|
81
|
+
raise ValueError(f"The maximum length of a histogram is {self.MAX_LENGTH}")
|
84
82
|
if len(self.histogram) + 1 != len(self.bins):
|
85
83
|
raise ValueError("len(bins) must be len(histogram) + 1")
|
86
84
|
|
@@ -2,24 +2,20 @@ import codecs
|
|
2
2
|
import itertools
|
3
3
|
import json
|
4
4
|
import os
|
5
|
-
import sys
|
6
5
|
from typing import (
|
7
6
|
TYPE_CHECKING,
|
8
7
|
ClassVar,
|
8
|
+
Literal,
|
9
9
|
Optional,
|
10
10
|
Sequence,
|
11
11
|
Set,
|
12
12
|
TextIO,
|
13
13
|
Tuple,
|
14
14
|
Type,
|
15
|
+
TypedDict,
|
15
16
|
Union,
|
16
17
|
)
|
17
18
|
|
18
|
-
if sys.version_info >= (3, 8):
|
19
|
-
from typing import Literal, TypedDict
|
20
|
-
else:
|
21
|
-
from typing_extensions import Literal, TypedDict
|
22
|
-
|
23
19
|
import wandb
|
24
20
|
from wandb import util
|
25
21
|
from wandb.sdk.lib import runid
|
wandb/sdk/data_types/table.py
CHANGED
@@ -490,7 +490,7 @@ class Table(Media):
|
|
490
490
|
f"the limit with `wandb.Table.MAX_ARTIFACT_ROWS = X` and try again. Note: "
|
491
491
|
f"this may cause slower queries in the W&B UI."
|
492
492
|
)
|
493
|
-
logging.warning("Truncating wandb.Table object to
|
493
|
+
logging.warning(f"Truncating wandb.Table object to {max_rows} rows.")
|
494
494
|
return {"columns": self.columns, "data": self.data[:max_rows]}
|
495
495
|
|
496
496
|
def bind_to_run(self, *args, **kwargs):
|
wandb/sdk/data_types/utils.py
CHANGED
@@ -175,8 +175,7 @@ def _prune_max_seq(seq: Sequence["BatchableMedia"]) -> Sequence["BatchableMedia"
|
|
175
175
|
items = seq
|
176
176
|
if hasattr(seq[0], "MAX_ITEMS") and seq[0].MAX_ITEMS < len(seq):
|
177
177
|
logging.warning(
|
178
|
-
"Only
|
179
|
-
% (seq[0].MAX_ITEMS, seq[0].__class__.__name__)
|
178
|
+
f"Only {seq[0].MAX_ITEMS} {seq[0].__class__.__name__} will be uploaded."
|
180
179
|
)
|
181
180
|
items = seq[: seq[0].MAX_ITEMS]
|
182
181
|
return items
|
wandb/sdk/data_types/video.py
CHANGED
@@ -138,10 +138,21 @@ class Video(BatchableMedia):
|
|
138
138
|
self.encode(fps=fps)
|
139
139
|
|
140
140
|
def encode(self, fps: int = 4) -> None:
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
141
|
+
# Try to import ImageSequenceClip from the appropriate MoviePy module
|
142
|
+
mpy = None
|
143
|
+
try:
|
144
|
+
# Attempt to load moviepy.editor for MoviePy < 2.0
|
145
|
+
mpy = util.get_module(
|
146
|
+
"moviepy.editor",
|
147
|
+
required='wandb.Video requires moviepy when passing raw data. Install with "pip install wandb[media]"',
|
148
|
+
)
|
149
|
+
except wandb.Error:
|
150
|
+
# Fallback to moviepy for MoviePy >= 2.0
|
151
|
+
mpy = util.get_module(
|
152
|
+
"moviepy",
|
153
|
+
required='wandb.Video requires moviepy when passing raw data. Install with "pip install wandb[media]"',
|
154
|
+
)
|
155
|
+
|
145
156
|
tensor = self._prepare_video(self.data)
|
146
157
|
_, self._height, self._width, self._channels = tensor.shape # type: ignore
|
147
158
|
|
@@ -2,20 +2,13 @@ import asyncio
|
|
2
2
|
import functools
|
3
3
|
import inspect
|
4
4
|
import logging
|
5
|
-
import
|
6
|
-
from typing import Any, Dict, Optional, Sequence, TypeVar
|
5
|
+
from typing import Any, Dict, Optional, Protocol, Sequence, TypeVar
|
7
6
|
|
8
7
|
import wandb.sdk
|
9
8
|
import wandb.util
|
10
9
|
from wandb.sdk.lib import telemetry as wb_telemetry
|
11
10
|
from wandb.sdk.lib.timer import Timer
|
12
11
|
|
13
|
-
if sys.version_info >= (3, 8):
|
14
|
-
from typing import Protocol
|
15
|
-
else:
|
16
|
-
from typing_extensions import Protocol
|
17
|
-
|
18
|
-
|
19
12
|
logger = logging.getLogger(__name__)
|
20
13
|
|
21
14
|
|
wandb/sdk/interface/interface.py
CHANGED
@@ -11,7 +11,6 @@ InterfaceRelay: Responses are routed to a relay queue (not matching uuids)
|
|
11
11
|
import gzip
|
12
12
|
import logging
|
13
13
|
import os
|
14
|
-
import sys
|
15
14
|
import time
|
16
15
|
from abc import abstractmethod
|
17
16
|
from pathlib import Path
|
@@ -22,9 +21,11 @@ from typing import (
|
|
22
21
|
Dict,
|
23
22
|
Iterable,
|
24
23
|
List,
|
24
|
+
Literal,
|
25
25
|
NewType,
|
26
26
|
Optional,
|
27
27
|
Tuple,
|
28
|
+
TypedDict,
|
28
29
|
Union,
|
29
30
|
)
|
30
31
|
|
@@ -54,10 +55,6 @@ MANIFEST_FILE_SIZE_THRESHOLD = 100_000
|
|
54
55
|
|
55
56
|
GlobStr = NewType("GlobStr", str)
|
56
57
|
|
57
|
-
if sys.version_info >= (3, 8):
|
58
|
-
from typing import Literal, TypedDict
|
59
|
-
else:
|
60
|
-
from typing_extensions import Literal, TypedDict
|
61
58
|
|
62
59
|
PolicyName = Literal["now", "live", "end"]
|
63
60
|
|
@@ -953,6 +950,16 @@ class InterfaceBase:
|
|
953
950
|
def _deliver_poll_exit(self, poll_exit: pb.PollExitRequest) -> MailboxHandle:
|
954
951
|
raise NotImplementedError
|
955
952
|
|
953
|
+
def deliver_finish_without_exit(self) -> MailboxHandle:
|
954
|
+
run_finish_without_exit = pb.RunFinishWithoutExitRequest()
|
955
|
+
return self._deliver_finish_without_exit(run_finish_without_exit)
|
956
|
+
|
957
|
+
@abstractmethod
|
958
|
+
def _deliver_finish_without_exit(
|
959
|
+
self, run_finish_without_exit: pb.RunFinishWithoutExitRequest
|
960
|
+
) -> MailboxHandle:
|
961
|
+
raise NotImplementedError
|
962
|
+
|
956
963
|
def deliver_request_sampled_history(self) -> MailboxHandle:
|
957
964
|
sampled_history = pb.SampledHistoryRequest()
|
958
965
|
return self._deliver_request_sampled_history(sampled_history)
|
@@ -8,7 +8,6 @@ import logging
|
|
8
8
|
from multiprocessing.process import BaseProcess
|
9
9
|
from typing import TYPE_CHECKING, Optional
|
10
10
|
|
11
|
-
from ..lib import tracelog
|
12
11
|
from ..lib.mailbox import Mailbox
|
13
12
|
from .interface_shared import InterfaceShared
|
14
13
|
from .router_queue import MessageQueueRouter
|
@@ -37,10 +36,6 @@ class InterfaceQueue(InterfaceShared):
|
|
37
36
|
) -> None:
|
38
37
|
self.record_q = record_q
|
39
38
|
self.result_q = result_q
|
40
|
-
if self.record_q:
|
41
|
-
tracelog.annotate_queue(self.record_q, "record_q")
|
42
|
-
if self.result_q:
|
43
|
-
tracelog.annotate_queue(self.result_q, "result_q")
|
44
39
|
super().__init__(process=process, process_check=process_check, mailbox=mailbox)
|
45
40
|
|
46
41
|
def _init_router(self) -> None:
|
@@ -55,5 +50,4 @@ class InterfaceQueue(InterfaceShared):
|
|
55
50
|
if local:
|
56
51
|
record.control.local = local
|
57
52
|
if self.record_q:
|
58
|
-
tracelog.log_message_queue(record, self.record_q)
|
59
53
|
self.record_q.put(record)
|
@@ -153,6 +153,7 @@ class InterfaceShared(InterfaceBase):
|
|
153
153
|
get_system_metrics: Optional[pb.GetSystemMetricsRequest] = None,
|
154
154
|
python_packages: Optional[pb.PythonPackagesRequest] = None,
|
155
155
|
job_input: Optional[pb.JobInputRequest] = None,
|
156
|
+
run_finish_without_exit: Optional[pb.RunFinishWithoutExitRequest] = None,
|
156
157
|
) -> pb.Record:
|
157
158
|
request = pb.Request()
|
158
159
|
if login:
|
@@ -217,6 +218,8 @@ class InterfaceShared(InterfaceBase):
|
|
217
218
|
request.python_packages.CopyFrom(python_packages)
|
218
219
|
elif job_input:
|
219
220
|
request.job_input.CopyFrom(job_input)
|
221
|
+
elif run_finish_without_exit:
|
222
|
+
request.run_finish_without_exit.CopyFrom(run_finish_without_exit)
|
220
223
|
else:
|
221
224
|
raise Exception("Invalid request")
|
222
225
|
record = self._make_record(request=request)
|
@@ -482,6 +485,12 @@ class InterfaceShared(InterfaceBase):
|
|
482
485
|
record = self._make_request(poll_exit=poll_exit)
|
483
486
|
return self._deliver_record(record)
|
484
487
|
|
488
|
+
def _deliver_finish_without_exit(
|
489
|
+
self, run_finish_without_exit: pb.RunFinishWithoutExitRequest
|
490
|
+
) -> MailboxHandle:
|
491
|
+
record = self._make_request(run_finish_without_exit=run_finish_without_exit)
|
492
|
+
return self._deliver_record(record)
|
493
|
+
|
485
494
|
def _deliver_stop_status(self, stop_status: pb.StopStatusRequest) -> MailboxHandle:
|
486
495
|
record = self._make_request(stop_status=stop_status)
|
487
496
|
return self._deliver_record(record)
|
wandb/sdk/interface/router.py
CHANGED
@@ -10,7 +10,7 @@ import uuid
|
|
10
10
|
from abc import abstractmethod
|
11
11
|
from typing import TYPE_CHECKING, Dict, Optional
|
12
12
|
|
13
|
-
from ..lib import mailbox
|
13
|
+
from ..lib import mailbox
|
14
14
|
from .message_future import MessageFuture
|
15
15
|
|
16
16
|
if TYPE_CHECKING:
|
@@ -108,7 +108,6 @@ class MessageRouter:
|
|
108
108
|
# TODO (cvp): saw this in tests, seemed benign enough to ignore, but
|
109
109
|
# could point to other issues.
|
110
110
|
if msg.uuid != "":
|
111
|
-
tracelog.log_message_assert(msg)
|
112
111
|
logger.warning(
|
113
112
|
"No listener found for msg with uuid %s (%s)", msg.uuid, msg
|
114
113
|
)
|
@@ -7,7 +7,6 @@ Router to manage responses from a queue.
|
|
7
7
|
import queue
|
8
8
|
from typing import TYPE_CHECKING, Optional
|
9
9
|
|
10
|
-
from ..lib import tracelog
|
11
10
|
from ..lib.mailbox import Mailbox
|
12
11
|
from .router import MessageRouter
|
13
12
|
|
@@ -36,9 +35,7 @@ class MessageQueueRouter(MessageRouter):
|
|
36
35
|
msg = self._response_queue.get(timeout=1)
|
37
36
|
except queue.Empty:
|
38
37
|
return None
|
39
|
-
tracelog.log_message_dequeue(msg, self._response_queue)
|
40
38
|
return msg
|
41
39
|
|
42
40
|
def _send_message(self, record: "pb.Record") -> None:
|
43
|
-
tracelog.log_message_queue(record, self._request_queue)
|
44
41
|
self._request_queue.put(record)
|
@@ -6,7 +6,6 @@ Router to manage responses from a queue with relay.
|
|
6
6
|
|
7
7
|
from typing import TYPE_CHECKING
|
8
8
|
|
9
|
-
from ..lib import tracelog
|
10
9
|
from ..lib.mailbox import Mailbox
|
11
10
|
from .router_queue import MessageQueueRouter
|
12
11
|
|
@@ -33,7 +32,6 @@ class MessageRelayRouter(MessageQueueRouter):
|
|
33
32
|
|
34
33
|
def _handle_msg_rcv(self, msg: "pb.Result") -> None:
|
35
34
|
if msg.control.relay_id:
|
36
|
-
tracelog.log_message_queue(msg, self._relay_queue)
|
37
35
|
self._relay_queue.put(msg)
|
38
36
|
return
|
39
37
|
super()._handle_msg_rcv(msg)
|
@@ -24,10 +24,7 @@ from typing import (
|
|
24
24
|
)
|
25
25
|
|
26
26
|
if TYPE_CHECKING:
|
27
|
-
|
28
|
-
from typing import TypedDict
|
29
|
-
else:
|
30
|
-
from typing_extensions import TypedDict
|
27
|
+
from typing import TypedDict
|
31
28
|
|
32
29
|
class ProcessedChunk(TypedDict):
|
33
30
|
offset: int
|
@@ -88,7 +88,7 @@ class FlowControl:
|
|
88
88
|
or _threshold_bytes_mid == 0
|
89
89
|
or _threshold_bytes_low == 0
|
90
90
|
):
|
91
|
-
threshold = settings.
|
91
|
+
threshold = settings.x_network_buffer or DEFAULT_THRESHOLD
|
92
92
|
_threshold_bytes_high = threshold
|
93
93
|
_threshold_bytes_mid = threshold // 2
|
94
94
|
_threshold_bytes_low = threshold // 4
|
wandb/sdk/internal/handler.py
CHANGED
@@ -38,7 +38,7 @@ from wandb.proto.wandb_internal_pb2 import (
|
|
38
38
|
)
|
39
39
|
|
40
40
|
from ..interface.interface_queue import InterfaceQueue
|
41
|
-
from ..lib import handler_util, proto_util
|
41
|
+
from ..lib import handler_util, proto_util
|
42
42
|
from . import context, sample, tb_watcher
|
43
43
|
from .settings_static import SettingsStatic
|
44
44
|
from .system.system_monitor import SystemMonitor
|
@@ -163,11 +163,9 @@ class HandleManager:
|
|
163
163
|
def _dispatch_record(self, record: Record, always_send: bool = False) -> None:
|
164
164
|
if always_send:
|
165
165
|
record.control.always_send = True
|
166
|
-
tracelog.log_message_queue(record, self._writer_q)
|
167
166
|
self._writer_q.put(record)
|
168
167
|
|
169
168
|
def _respond_result(self, result: Result) -> None:
|
170
|
-
tracelog.log_message_queue(result, self._result_q)
|
171
169
|
context_id = context.context_id_from_result(result)
|
172
170
|
self._context_keeper.release(context_id)
|
173
171
|
self._result_q.put(result)
|
@@ -694,9 +692,14 @@ class HandleManager:
|
|
694
692
|
self._settings,
|
695
693
|
self._interface,
|
696
694
|
)
|
697
|
-
if not
|
695
|
+
if not (
|
696
|
+
self._settings.x_disable_stats or self._settings.x_disable_machine_info
|
697
|
+
):
|
698
698
|
self._system_monitor.start()
|
699
|
-
if
|
699
|
+
if (
|
700
|
+
not (self._settings.x_disable_meta or self._settings.x_disable_machine_info)
|
701
|
+
and not run_start.run.resumed
|
702
|
+
):
|
700
703
|
self._system_monitor.probe(publish=True)
|
701
704
|
|
702
705
|
self._tb_watcher = tb_watcher.TBWatcher(
|
wandb/sdk/internal/internal.py
CHANGED
@@ -28,7 +28,6 @@ import psutil
|
|
28
28
|
import wandb
|
29
29
|
|
30
30
|
from ..interface.interface_queue import InterfaceQueue
|
31
|
-
from ..lib import tracelog
|
32
31
|
from . import context, handler, internal_util, sender, writer
|
33
32
|
|
34
33
|
if TYPE_CHECKING:
|
@@ -63,7 +62,6 @@ def wandb_internal(
|
|
63
62
|
"""
|
64
63
|
# mark this process as internal
|
65
64
|
wandb._set_internal_process() # type: ignore
|
66
|
-
_setup_tracelog()
|
67
65
|
started = time.time()
|
68
66
|
|
69
67
|
# any sentry events in the internal process will be tagged as such
|
@@ -77,7 +75,7 @@ def wandb_internal(
|
|
77
75
|
# Let's make sure we don't modify settings so use a static object
|
78
76
|
_settings = settings
|
79
77
|
if _settings.log_internal:
|
80
|
-
configure_logging(_settings.log_internal, _settings.
|
78
|
+
configure_logging(_settings.log_internal, _settings.x_log_level)
|
81
79
|
|
82
80
|
user_pid = user_pid or os.getppid()
|
83
81
|
pid = os.getpid()
|
@@ -88,8 +86,6 @@ def wandb_internal(
|
|
88
86
|
datetime.fromtimestamp(started),
|
89
87
|
)
|
90
88
|
|
91
|
-
tracelog.annotate_queue(record_q, "record_q")
|
92
|
-
tracelog.annotate_queue(result_q, "result_q")
|
93
89
|
publish_interface = InterfaceQueue(record_q=record_q)
|
94
90
|
|
95
91
|
stopped = threading.Event()
|
@@ -98,10 +94,8 @@ def wandb_internal(
|
|
98
94
|
context_keeper = context.ContextKeeper()
|
99
95
|
|
100
96
|
send_record_q: Queue[Record] = queue.Queue()
|
101
|
-
tracelog.annotate_queue(send_record_q, "send_q")
|
102
97
|
|
103
98
|
write_record_q: Queue[Record] = queue.Queue()
|
104
|
-
tracelog.annotate_queue(write_record_q, "write_q")
|
105
99
|
|
106
100
|
record_sender_thread = SenderThread(
|
107
101
|
settings=_settings,
|
@@ -175,7 +169,7 @@ def wandb_internal(
|
|
175
169
|
traceback.print_exception(*exc_info)
|
176
170
|
wandb._sentry.exception(exc_info)
|
177
171
|
wandb.termerror("Internal wandb error: file data was not synced")
|
178
|
-
if not settings.
|
172
|
+
if not settings.x_disable_service:
|
179
173
|
# TODO: We can make this more graceful by returning an error to streams.py
|
180
174
|
# and potentially just fail the one stream.
|
181
175
|
os._exit(-1)
|
@@ -184,14 +178,6 @@ def wandb_internal(
|
|
184
178
|
close_internal_log()
|
185
179
|
|
186
180
|
|
187
|
-
def _setup_tracelog() -> None:
|
188
|
-
# TODO: remove this temporary hack, need to find a better way to pass settings
|
189
|
-
# to the server. for now lets just look at the environment variable we need
|
190
|
-
tracelog_mode = os.environ.get("WANDB_TRACELOG")
|
191
|
-
if tracelog_mode:
|
192
|
-
tracelog.enable(tracelog_mode)
|
193
|
-
|
194
|
-
|
195
181
|
def configure_logging(
|
196
182
|
log_fname: str, log_level: int, run_id: Optional[str] = None
|
197
183
|
) -> None:
|
@@ -394,7 +380,7 @@ class ProcessCheck:
|
|
394
380
|
self.settings = settings
|
395
381
|
self.pid = user_pid
|
396
382
|
self.check_process_last = None
|
397
|
-
self.check_process_interval = settings.
|
383
|
+
self.check_process_interval = settings.x_internal_check_process
|
398
384
|
|
399
385
|
def is_dead(self) -> bool:
|
400
386
|
if not self.check_process_interval or not self.pid:
|
@@ -20,6 +20,7 @@ from typing import (
|
|
20
20
|
Dict,
|
21
21
|
Iterable,
|
22
22
|
List,
|
23
|
+
Literal,
|
23
24
|
Mapping,
|
24
25
|
MutableMapping,
|
25
26
|
NamedTuple,
|
@@ -30,11 +31,6 @@ from typing import (
|
|
30
31
|
Union,
|
31
32
|
)
|
32
33
|
|
33
|
-
if sys.version_info >= (3, 8):
|
34
|
-
from typing import Literal
|
35
|
-
else:
|
36
|
-
from typing_extensions import Literal
|
37
|
-
|
38
34
|
import click
|
39
35
|
import requests
|
40
36
|
import yaml
|
@@ -63,10 +59,7 @@ logger = logging.getLogger(__name__)
|
|
63
59
|
LAUNCH_DEFAULT_PROJECT = "model-registry"
|
64
60
|
|
65
61
|
if TYPE_CHECKING:
|
66
|
-
|
67
|
-
from typing import Literal, TypedDict
|
68
|
-
else:
|
69
|
-
from typing_extensions import Literal, TypedDict
|
62
|
+
from typing import Literal, TypedDict
|
70
63
|
|
71
64
|
from .progress import ProgressFn
|
72
65
|
|
@@ -4557,7 +4550,7 @@ class Api:
|
|
4557
4550
|
check_httpclient_logger_handler()
|
4558
4551
|
return requests.put(
|
4559
4552
|
url=url,
|
4560
|
-
headers={"Content-Length": "0", "Content-Range": "bytes
|
4553
|
+
headers={"Content-Length": "0", "Content-Range": f"bytes */{length}"},
|
4561
4554
|
)
|
4562
4555
|
|
4563
4556
|
def _flatten_edges(self, response: "_Response") -> List[Dict]:
|
@@ -11,8 +11,6 @@ import threading
|
|
11
11
|
import time
|
12
12
|
from typing import TYPE_CHECKING, Optional, Tuple, Type, Union
|
13
13
|
|
14
|
-
from ..lib import tracelog
|
15
|
-
|
16
14
|
if TYPE_CHECKING:
|
17
15
|
from queue import Queue
|
18
16
|
from threading import Event
|
@@ -95,6 +93,5 @@ class RecordLoopThread(ExceptionThread):
|
|
95
93
|
record = self._input_record_q.get(timeout=1)
|
96
94
|
except queue.Empty:
|
97
95
|
continue
|
98
|
-
tracelog.log_message_dequeue(record, self._input_record_q)
|
99
96
|
self._process(record)
|
100
97
|
self._finish()
|
@@ -5,7 +5,18 @@ import logging
|
|
5
5
|
import os
|
6
6
|
import re
|
7
7
|
import sys
|
8
|
-
from typing import
|
8
|
+
from typing import (
|
9
|
+
TYPE_CHECKING,
|
10
|
+
Any,
|
11
|
+
Callable,
|
12
|
+
Dict,
|
13
|
+
List,
|
14
|
+
Literal,
|
15
|
+
Optional,
|
16
|
+
Tuple,
|
17
|
+
TypedDict,
|
18
|
+
Union,
|
19
|
+
)
|
9
20
|
|
10
21
|
import wandb
|
11
22
|
from wandb.sdk.artifacts.artifact import Artifact
|
@@ -16,11 +27,6 @@ from wandb.util import make_artifact_name_safe
|
|
16
27
|
|
17
28
|
from .settings_static import SettingsStatic
|
18
29
|
|
19
|
-
if sys.version_info >= (3, 8):
|
20
|
-
from typing import Literal, TypedDict
|
21
|
-
else:
|
22
|
-
from typing_extensions import Literal, TypedDict
|
23
|
-
|
24
30
|
_logger = logging.getLogger(__name__)
|
25
31
|
|
26
32
|
if TYPE_CHECKING:
|
@@ -152,7 +158,7 @@ class JobBuilder:
|
|
152
158
|
self._logged_code_artifact = None
|
153
159
|
self._job_seq_id = None
|
154
160
|
self._job_version_alias = None
|
155
|
-
self._disable = settings.disable_job_creation
|
161
|
+
self._disable = settings.disable_job_creation or settings.x_disable_machine_info
|
156
162
|
self._partial_source_id = None
|
157
163
|
self._aliases = []
|
158
164
|
self._source_type: Optional[Literal["repo", "artifact", "image"]] = (
|
@@ -228,16 +234,16 @@ class JobBuilder:
|
|
228
234
|
):
|
229
235
|
return None, None
|
230
236
|
|
231
|
-
if root is None or self._settings.
|
237
|
+
if root is None or self._settings.x_jupyter_root is None:
|
232
238
|
_logger.info("target path does not exist, exiting")
|
233
239
|
return None, None
|
234
|
-
assert self._settings.
|
240
|
+
assert self._settings.x_jupyter_root is not None
|
235
241
|
# git notebooks set the root to the git root,
|
236
242
|
# jupyter_root contains the path where the jupyter notebook was started
|
237
243
|
# program_relpath contains the path from jupyter_root to the file
|
238
244
|
# full program path here is actually the relpath from the program to the git root
|
239
245
|
full_program_path = os.path.join(
|
240
|
-
os.path.relpath(str(self._settings.
|
246
|
+
os.path.relpath(str(self._settings.x_jupyter_root), root),
|
241
247
|
program_relpath,
|
242
248
|
)
|
243
249
|
full_program_path = os.path.normpath(full_program_path)
|
@@ -476,7 +482,8 @@ class JobBuilder:
|
|
476
482
|
# can't build a job without a python version
|
477
483
|
if runtime is None:
|
478
484
|
self._log_if_verbose(
|
479
|
-
"No python version found in metadata, not creating job artifact.
|
485
|
+
"No python version found in metadata, not creating job artifact. "
|
486
|
+
"See https://docs.wandb.ai/guides/launch/create-job",
|
480
487
|
"warn",
|
481
488
|
)
|
482
489
|
return None
|
@@ -505,7 +512,8 @@ class JobBuilder:
|
|
505
512
|
program_relpath = self._get_program_relpath(source_type, metadata)
|
506
513
|
if not self._partial and source_type != "image" and not program_relpath:
|
507
514
|
self._log_if_verbose(
|
508
|
-
"No program path found, not creating job artifact.
|
515
|
+
"No program path found, not creating job artifact. "
|
516
|
+
"See https://docs.wandb.ai/guides/launch/create-job",
|
509
517
|
"warn",
|
510
518
|
)
|
511
519
|
return None
|
wandb/sdk/internal/progress.py
CHANGED
@@ -1,16 +1,12 @@
|
|
1
1
|
"""progress."""
|
2
2
|
|
3
3
|
import os
|
4
|
-
import sys
|
5
4
|
from typing import IO, TYPE_CHECKING, Optional
|
6
5
|
|
7
6
|
from wandb.errors import CommError
|
8
7
|
|
9
8
|
if TYPE_CHECKING:
|
10
|
-
|
11
|
-
from typing import Protocol
|
12
|
-
else:
|
13
|
-
from typing_extensions import Protocol
|
9
|
+
from typing import Protocol
|
14
10
|
|
15
11
|
class ProgressFn(Protocol):
|
16
12
|
def __call__(self, new_bytes: int, total_bytes: int) -> None:
|