wandb 0.18.5__py3-none-win32.whl → 0.18.7__py3-none-win32.whl
Sign up to get free protection for your applications and to get access to all the features.
- wandb/__init__.py +2 -2
- wandb/__init__.pyi +22 -20
- wandb/agents/pyagent.py +1 -1
- wandb/apis/importers/wandb.py +1 -1
- wandb/apis/normalize.py +2 -18
- wandb/apis/public/api.py +126 -62
- wandb/apis/public/artifacts.py +8 -3
- wandb/apis/public/files.py +17 -2
- wandb/apis/public/jobs.py +2 -2
- wandb/apis/public/query_generator.py +1 -1
- wandb/apis/public/runs.py +8 -8
- wandb/apis/public/teams.py +3 -3
- wandb/apis/public/users.py +1 -1
- wandb/apis/public/utils.py +68 -0
- wandb/bin/gpu_stats.exe +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/cli/cli.py +12 -3
- wandb/data_types.py +1 -1
- wandb/docker/__init__.py +2 -1
- wandb/docker/auth.py +2 -3
- wandb/errors/links.py +73 -0
- wandb/errors/term.py +7 -6
- wandb/filesync/step_prepare.py +1 -1
- wandb/filesync/upload_job.py +1 -1
- wandb/integration/catboost/catboost.py +2 -2
- wandb/integration/diffusers/pipeline_resolver.py +1 -1
- wandb/integration/diffusers/resolvers/multimodal.py +6 -6
- wandb/integration/diffusers/resolvers/utils.py +1 -1
- wandb/integration/fastai/__init__.py +3 -2
- wandb/integration/keras/callbacks/metrics_logger.py +1 -1
- wandb/integration/keras/callbacks/model_checkpoint.py +1 -1
- wandb/integration/keras/keras.py +1 -1
- wandb/integration/kfp/kfp_patch.py +1 -1
- wandb/integration/lightgbm/__init__.py +2 -2
- wandb/integration/magic.py +2 -2
- wandb/integration/metaflow/metaflow.py +1 -1
- wandb/integration/sacred/__init__.py +1 -1
- wandb/integration/sagemaker/auth.py +1 -1
- wandb/integration/sklearn/plot/classifier.py +7 -7
- wandb/integration/sklearn/plot/clusterer.py +3 -3
- wandb/integration/sklearn/plot/regressor.py +3 -3
- wandb/integration/sklearn/plot/shared.py +2 -2
- wandb/integration/tensorboard/log.py +2 -2
- wandb/integration/ultralytics/callback.py +2 -2
- wandb/integration/xgboost/xgboost.py +1 -1
- wandb/jupyter.py +0 -1
- wandb/plot/__init__.py +17 -8
- wandb/plot/bar.py +53 -27
- wandb/plot/confusion_matrix.py +151 -70
- wandb/plot/custom_chart.py +124 -0
- wandb/plot/histogram.py +46 -20
- wandb/plot/line.py +57 -26
- wandb/plot/line_series.py +148 -60
- wandb/plot/pr_curve.py +89 -44
- wandb/plot/roc_curve.py +82 -37
- wandb/plot/scatter.py +53 -20
- wandb/plot/viz.py +20 -102
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v5/wandb_settings_pb2.py +2 -2
- wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
- wandb/proto/wandb_deprecated.py +2 -0
- wandb/sdk/artifacts/artifact.py +281 -329
- wandb/sdk/artifacts/artifact_manifest.py +10 -9
- wandb/sdk/artifacts/artifact_manifest_entry.py +1 -1
- wandb/sdk/artifacts/storage_handlers/azure_handler.py +9 -4
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +1 -3
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +1 -1
- wandb/sdk/artifacts/storage_handlers/wb_artifact_handler.py +2 -2
- wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +1 -1
- wandb/sdk/backend/backend.py +0 -1
- wandb/sdk/data_types/audio.py +1 -1
- wandb/sdk/data_types/base_types/media.py +66 -5
- wandb/sdk/data_types/base_types/wb_value.py +20 -10
- wandb/sdk/data_types/bokeh.py +1 -1
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -1
- wandb/sdk/data_types/helper_types/image_mask.py +2 -2
- wandb/sdk/data_types/histogram.py +1 -1
- wandb/sdk/data_types/html.py +1 -1
- wandb/sdk/data_types/image.py +1 -1
- wandb/sdk/data_types/molecule.py +3 -3
- wandb/sdk/data_types/object_3d.py +4 -4
- wandb/sdk/data_types/plotly.py +1 -1
- wandb/sdk/data_types/saved_model.py +0 -1
- wandb/sdk/data_types/table.py +7 -7
- wandb/sdk/data_types/trace_tree.py +1 -1
- wandb/sdk/data_types/video.py +4 -3
- wandb/sdk/interface/interface_queue.py +0 -6
- wandb/sdk/interface/router.py +1 -4
- wandb/sdk/interface/router_queue.py +0 -3
- wandb/sdk/interface/router_relay.py +0 -2
- wandb/sdk/internal/datastore.py +1 -1
- wandb/sdk/internal/file_pusher.py +1 -1
- wandb/sdk/internal/file_stream.py +4 -4
- wandb/sdk/internal/handler.py +3 -4
- wandb/sdk/internal/internal.py +1 -15
- wandb/sdk/internal/internal_api.py +178 -63
- wandb/sdk/internal/internal_util.py +0 -3
- wandb/sdk/internal/job_builder.py +4 -3
- wandb/sdk/internal/sender.py +0 -2
- wandb/sdk/internal/system/assets/__init__.py +0 -2
- wandb/sdk/internal/tb_watcher.py +11 -10
- wandb/sdk/internal/writer.py +1 -3
- wandb/sdk/launch/__init__.py +2 -1
- wandb/sdk/launch/_launch.py +4 -3
- wandb/sdk/launch/_launch_add.py +2 -2
- wandb/sdk/launch/builder/kaniko_builder.py +0 -1
- wandb/sdk/launch/create_job.py +1 -0
- wandb/sdk/launch/environment/local_environment.py +0 -1
- wandb/sdk/launch/errors.py +0 -6
- wandb/sdk/launch/registry/local_registry.py +0 -2
- wandb/sdk/launch/runner/abstract.py +0 -5
- wandb/sdk/launch/sweeps/__init__.py +0 -2
- wandb/sdk/launch/sweeps/scheduler.py +0 -2
- wandb/sdk/launch/sweeps/scheduler_sweep.py +0 -1
- wandb/sdk/lib/_settings_toposort_generated.py +1 -0
- wandb/sdk/lib/apikey.py +3 -3
- wandb/sdk/lib/file_stream_utils.py +1 -1
- wandb/sdk/lib/filesystem.py +1 -1
- wandb/sdk/lib/ipython.py +16 -9
- wandb/sdk/lib/mailbox.py +0 -4
- wandb/sdk/lib/printer.py +44 -8
- wandb/sdk/lib/retry.py +1 -1
- wandb/sdk/lib/sock_client.py +0 -5
- wandb/sdk/service/server.py +2 -11
- wandb/sdk/service/server_sock.py +0 -2
- wandb/sdk/service/service.py +3 -3
- wandb/sdk/service/streams.py +2 -4
- wandb/sdk/wandb_init.py +20 -20
- wandb/sdk/wandb_login.py +1 -1
- wandb/sdk/wandb_require.py +1 -4
- wandb/sdk/wandb_run.py +97 -115
- wandb/sdk/wandb_settings.py +23 -6
- wandb/sdk/wandb_setup.py +1 -5
- wandb/sdk/wandb_sync.py +2 -1
- wandb/util.py +49 -21
- wandb/wandb_agent.py +3 -3
- wandb/wandb_controller.py +2 -2
- {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/METADATA +1 -1
- {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/RECORD +145 -147
- wandb/sdk/internal/system/assets/gpu_apple.py +0 -177
- wandb/sdk/lib/_wburls_generate.py +0 -25
- wandb/sdk/lib/_wburls_generated.py +0 -22
- wandb/sdk/lib/tracelog.py +0 -255
- wandb/sdk/lib/wburls.py +0 -46
- {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/WHEEL +0 -0
- {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/entry_points.txt +0 -0
- {wandb-0.18.5.dist-info → wandb-0.18.7.dist-info}/licenses/LICENSE +0 -0
@@ -1,177 +0,0 @@
|
|
1
|
-
import json
|
2
|
-
import logging
|
3
|
-
import pathlib
|
4
|
-
import platform
|
5
|
-
import subprocess
|
6
|
-
import sys
|
7
|
-
import threading
|
8
|
-
from collections import deque
|
9
|
-
from typing import TYPE_CHECKING, List
|
10
|
-
|
11
|
-
if sys.version_info >= (3, 8):
|
12
|
-
from typing import TypedDict
|
13
|
-
else:
|
14
|
-
from typing_extensions import TypedDict
|
15
|
-
|
16
|
-
from wandb.sdk.lib import telemetry
|
17
|
-
|
18
|
-
from .aggregators import aggregate_mean
|
19
|
-
from .asset_registry import asset_registry
|
20
|
-
from .interfaces import Interface, Metric, MetricsMonitor
|
21
|
-
|
22
|
-
if TYPE_CHECKING:
|
23
|
-
from typing import Deque
|
24
|
-
|
25
|
-
from wandb.sdk.internal.settings_static import SettingsStatic
|
26
|
-
|
27
|
-
|
28
|
-
logger = logging.getLogger(__name__)
|
29
|
-
|
30
|
-
|
31
|
-
class _Stats(TypedDict):
|
32
|
-
gpu: float
|
33
|
-
memoryAllocated: float # noqa: N815
|
34
|
-
temp: float
|
35
|
-
powerWatts: float # noqa: N815
|
36
|
-
powerPercent: float # noqa: N815
|
37
|
-
# cpuWaitMs: float
|
38
|
-
|
39
|
-
|
40
|
-
def get_apple_gpu_path() -> pathlib.Path:
|
41
|
-
return (
|
42
|
-
pathlib.Path(sys.modules["wandb"].__path__[0]) / "bin" / "apple_gpu_stats"
|
43
|
-
).resolve()
|
44
|
-
|
45
|
-
|
46
|
-
class GPUAppleStats:
|
47
|
-
"""Apple GPU stats available on Arm Macs."""
|
48
|
-
|
49
|
-
name = "gpu.0.{}"
|
50
|
-
samples: "Deque[_Stats]"
|
51
|
-
|
52
|
-
# TODO: hard coded max watts as 16.5, found this number in the SMC list.
|
53
|
-
# Eventually we can have the apple_gpu_stats binary query for this.
|
54
|
-
MAX_POWER_WATTS = 16.5
|
55
|
-
|
56
|
-
def __init__(self) -> None:
|
57
|
-
self.samples = deque()
|
58
|
-
self.binary_path = get_apple_gpu_path()
|
59
|
-
|
60
|
-
def sample(self) -> None:
|
61
|
-
try:
|
62
|
-
command = [str(self.binary_path), "--json"]
|
63
|
-
output = (
|
64
|
-
subprocess.check_output(command, universal_newlines=True)
|
65
|
-
.strip()
|
66
|
-
.split("\n")
|
67
|
-
)[0]
|
68
|
-
raw_stats = json.loads(output)
|
69
|
-
|
70
|
-
temp_keys = [
|
71
|
-
"m1Gpu1",
|
72
|
-
"m1Gpu2",
|
73
|
-
"m1Gpu3",
|
74
|
-
"m1Gpu4",
|
75
|
-
"m2Gpu1",
|
76
|
-
"m2Gpu2",
|
77
|
-
"m3Gpu1",
|
78
|
-
"m3Gpu2",
|
79
|
-
"m3Gpu3",
|
80
|
-
"m3Gpu4",
|
81
|
-
"m3Gpu5",
|
82
|
-
"m3Gpu6",
|
83
|
-
"m3Gpu7",
|
84
|
-
"m3Gpu8",
|
85
|
-
]
|
86
|
-
temp, count = 0, 0
|
87
|
-
for k in temp_keys:
|
88
|
-
if raw_stats.get(k, 0) > 0:
|
89
|
-
temp += raw_stats[k]
|
90
|
-
count += 1
|
91
|
-
|
92
|
-
stats: _Stats = {
|
93
|
-
"gpu": raw_stats["utilization"],
|
94
|
-
"memoryAllocated": (
|
95
|
-
raw_stats["inUseSystemMemory"]
|
96
|
-
/ raw_stats["allocatedSystemMemory"]
|
97
|
-
* 100
|
98
|
-
),
|
99
|
-
"powerWatts": raw_stats["systemPower"],
|
100
|
-
"powerPercent": (raw_stats["systemPower"] / self.MAX_POWER_WATTS) * 100,
|
101
|
-
"temp": temp / count if count > 0 else 0,
|
102
|
-
# TODO: this stat could be useful eventually, it was consistently
|
103
|
-
# 0 in my experimentation and requires a frontend change
|
104
|
-
# so leaving it out for now.
|
105
|
-
# "cpuWaitMs": raw_stats["cpu_wait_ms"],
|
106
|
-
}
|
107
|
-
self.samples.append(stats)
|
108
|
-
|
109
|
-
except (OSError, ValueError, TypeError, subprocess.CalledProcessError) as e:
|
110
|
-
logger.exception("GPU stats error: %s", e)
|
111
|
-
|
112
|
-
def clear(self) -> None:
|
113
|
-
self.samples.clear()
|
114
|
-
|
115
|
-
def aggregate(self) -> dict:
|
116
|
-
if not self.samples:
|
117
|
-
return {}
|
118
|
-
stats = {}
|
119
|
-
for key in self.samples[0].keys():
|
120
|
-
samples = [s[key] for s in self.samples] # type: ignore
|
121
|
-
aggregate = aggregate_mean(samples)
|
122
|
-
stats[self.name.format(key)] = aggregate
|
123
|
-
return stats
|
124
|
-
|
125
|
-
|
126
|
-
@asset_registry.register
|
127
|
-
class GPUApple:
|
128
|
-
def __init__(
|
129
|
-
self,
|
130
|
-
interface: "Interface",
|
131
|
-
settings: "SettingsStatic",
|
132
|
-
shutdown_event: threading.Event,
|
133
|
-
) -> None:
|
134
|
-
self.name = self.__class__.__name__.lower()
|
135
|
-
self.metrics: List[Metric] = [
|
136
|
-
GPUAppleStats(),
|
137
|
-
]
|
138
|
-
self.metrics_monitor = MetricsMonitor(
|
139
|
-
self.name,
|
140
|
-
self.metrics,
|
141
|
-
interface,
|
142
|
-
settings,
|
143
|
-
shutdown_event,
|
144
|
-
)
|
145
|
-
telemetry_record = telemetry.TelemetryRecord()
|
146
|
-
telemetry_record.env.m1_gpu = True
|
147
|
-
interface._publish_telemetry(telemetry_record)
|
148
|
-
self.binary_path = get_apple_gpu_path()
|
149
|
-
|
150
|
-
@classmethod
|
151
|
-
def is_available(cls) -> bool:
|
152
|
-
return platform.system() == "Darwin" and platform.processor() == "arm"
|
153
|
-
|
154
|
-
def start(self) -> None:
|
155
|
-
self.metrics_monitor.start()
|
156
|
-
|
157
|
-
def finish(self) -> None:
|
158
|
-
self.metrics_monitor.finish()
|
159
|
-
|
160
|
-
def probe(self) -> dict:
|
161
|
-
try:
|
162
|
-
command = [str(self.binary_path), "--json"]
|
163
|
-
output = (
|
164
|
-
subprocess.check_output(command, universal_newlines=True)
|
165
|
-
.strip()
|
166
|
-
.split("\n")
|
167
|
-
)[0]
|
168
|
-
raw_stats = json.loads(output)
|
169
|
-
return {
|
170
|
-
self.name: {
|
171
|
-
"type": raw_stats["name"],
|
172
|
-
"vendor": raw_stats["vendor"],
|
173
|
-
}
|
174
|
-
}
|
175
|
-
except (OSError, ValueError, TypeError, subprocess.CalledProcessError) as e:
|
176
|
-
logger.exception("GPU stats error: %s", e)
|
177
|
-
return {self.name: {"type": "arm", "vendor": "Apple"}}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
from wburls import wburls # type: ignore
|
2
|
-
|
3
|
-
template = """
|
4
|
-
import sys
|
5
|
-
|
6
|
-
if sys.version_info >= (3, 8):
|
7
|
-
from typing import Literal
|
8
|
-
else:
|
9
|
-
from typing_extensions import Literal
|
10
|
-
|
11
|
-
|
12
|
-
URLS = Literal[
|
13
|
-
$literal_list
|
14
|
-
]
|
15
|
-
"""
|
16
|
-
|
17
|
-
|
18
|
-
def generate() -> None:
|
19
|
-
urls = wburls._get_urls()
|
20
|
-
literal_list = ", ".join([f"{key!r}" for key in urls])
|
21
|
-
print(template.replace("$literal_list", literal_list))
|
22
|
-
|
23
|
-
|
24
|
-
if __name__ == "__main__":
|
25
|
-
generate()
|
@@ -1,22 +0,0 @@
|
|
1
|
-
# DO NOT EDIT -- GENERATED BY: `generate-tool.py --generate`
|
2
|
-
import sys
|
3
|
-
|
4
|
-
if sys.version_info >= (3, 8):
|
5
|
-
from typing import Literal
|
6
|
-
else:
|
7
|
-
from typing_extensions import Literal
|
8
|
-
|
9
|
-
|
10
|
-
URLS = Literal[
|
11
|
-
"cli_launch",
|
12
|
-
"doc_run",
|
13
|
-
"doc_require",
|
14
|
-
"doc_start_err",
|
15
|
-
"doc_artifacts_guide",
|
16
|
-
"upgrade_server",
|
17
|
-
"multiprocess",
|
18
|
-
"wandb_init",
|
19
|
-
"wandb_server",
|
20
|
-
"wandb_define_metric",
|
21
|
-
"wandb_core",
|
22
|
-
]
|
wandb/sdk/lib/tracelog.py
DELETED
@@ -1,255 +0,0 @@
|
|
1
|
-
"""tracelog.
|
2
|
-
|
3
|
-
Functions:
|
4
|
-
log_message_queue - message put() to queue
|
5
|
-
log_message_dequeue - message get() from queue
|
6
|
-
log_message_send - message sent to socket
|
7
|
-
log_message_recv - message received from socket
|
8
|
-
log_message_process - message processed by thread
|
9
|
-
log_message_link - message linked to another message
|
10
|
-
log_message_assert - message encountered problem
|
11
|
-
|
12
|
-
"""
|
13
|
-
|
14
|
-
import datetime
|
15
|
-
import logging
|
16
|
-
import secrets
|
17
|
-
import sys
|
18
|
-
import threading
|
19
|
-
from typing import TYPE_CHECKING, Optional, cast
|
20
|
-
|
21
|
-
if TYPE_CHECKING:
|
22
|
-
import multiprocessing
|
23
|
-
import queue
|
24
|
-
import socket
|
25
|
-
from typing import Union
|
26
|
-
|
27
|
-
from wandb.proto import wandb_internal_pb2 as pb
|
28
|
-
from wandb.proto import wandb_server_pb2 as spb
|
29
|
-
|
30
|
-
MessageQueueType = Union[pb.Record, pb.Result]
|
31
|
-
MessageType = Union[pb.Record, pb.Result, spb.ServerRequest, spb.ServerResponse]
|
32
|
-
QueueType = Union[multiprocessing.Queue, queue.Queue]
|
33
|
-
TransportType = Union[socket.socket, str]
|
34
|
-
|
35
|
-
|
36
|
-
# Supported modes:
|
37
|
-
# logger - tracelog output goes to python logging (default)
|
38
|
-
# stdout - tracelog output goes to stdout
|
39
|
-
# stderr - tracelog output goes to stderr
|
40
|
-
tracelog_mode: Optional[str] = "logger"
|
41
|
-
|
42
|
-
logger = logging.getLogger(__name__)
|
43
|
-
|
44
|
-
|
45
|
-
ANNOTATE_QUEUE_NAME = "_DEBUGLOG_QUEUE_NAME"
|
46
|
-
|
47
|
-
# capture stdout and stderr before anyone messes with them
|
48
|
-
stdout_write = sys.__stdout__.write # type: ignore
|
49
|
-
stderr_write = sys.__stderr__.write # type: ignore
|
50
|
-
|
51
|
-
|
52
|
-
def _log(
|
53
|
-
msg_type: str,
|
54
|
-
log_type: str,
|
55
|
-
is_response: bool = False,
|
56
|
-
record: Optional["pb.Record"] = None,
|
57
|
-
result: Optional["pb.Result"] = None,
|
58
|
-
resource: Optional[str] = None,
|
59
|
-
) -> None:
|
60
|
-
prefix = "TRACELOG(1)"
|
61
|
-
tname = threading.current_thread().name
|
62
|
-
now = datetime.datetime.now()
|
63
|
-
ts = now.strftime("%H%M%S.%f")
|
64
|
-
arrow = "<-" if is_response else "->"
|
65
|
-
resource = resource or "unknown"
|
66
|
-
uuid = ""
|
67
|
-
data = record or result
|
68
|
-
record_id = ""
|
69
|
-
if data:
|
70
|
-
uuid = data.uuid or uuid
|
71
|
-
record_id = data._info._tracelog_id
|
72
|
-
uuid = uuid or "-"
|
73
|
-
record_id = record_id or "-"
|
74
|
-
relay = ""
|
75
|
-
if data and data.control and data.control.relay_id:
|
76
|
-
relay = data.control.relay_id
|
77
|
-
relay = relay or "-"
|
78
|
-
line = f"{prefix} {arrow} {ts} {record_id:16} {log_type:7} {resource:8} {tname:16} {msg_type:32} {uuid:32} {relay:32}"
|
79
|
-
if tracelog_mode == "stdout":
|
80
|
-
stdout_write(f"{line}\n")
|
81
|
-
elif tracelog_mode == "stderr":
|
82
|
-
stderr_write(f"{line}\n")
|
83
|
-
elif tracelog_mode == "logger":
|
84
|
-
logger.info(line)
|
85
|
-
|
86
|
-
|
87
|
-
def _record_msg_type(record: "pb.Record") -> str:
|
88
|
-
msg_type = str(record.WhichOneof("record_type"))
|
89
|
-
if msg_type == "request":
|
90
|
-
request = record.request
|
91
|
-
msg_type = str(request.WhichOneof("request_type"))
|
92
|
-
return msg_type
|
93
|
-
|
94
|
-
|
95
|
-
def _result_msg_type(result: "pb.Result") -> str:
|
96
|
-
msg_type = str(result.WhichOneof("result_type"))
|
97
|
-
if msg_type == "response":
|
98
|
-
response = result.response
|
99
|
-
msg_type = str(response.WhichOneof("response_type"))
|
100
|
-
return msg_type
|
101
|
-
|
102
|
-
|
103
|
-
def _log_message(
|
104
|
-
msg: "MessageType", log_type: str, resource: Optional[str] = None
|
105
|
-
) -> None:
|
106
|
-
record: Optional[pb.Record] = None
|
107
|
-
result: Optional[pb.Result] = None
|
108
|
-
is_response = False
|
109
|
-
msg_type: str
|
110
|
-
# Note: using strings to avoid an import
|
111
|
-
message_type_str = type(msg).__name__
|
112
|
-
if message_type_str == "Record":
|
113
|
-
record = cast("pb.Record", msg)
|
114
|
-
msg_type = _record_msg_type(record)
|
115
|
-
elif message_type_str == "Result":
|
116
|
-
is_response = True
|
117
|
-
result = cast("pb.Result", msg)
|
118
|
-
msg_type = _result_msg_type(result)
|
119
|
-
elif message_type_str == "ServerRequest":
|
120
|
-
server_request = cast("spb.ServerRequest", msg)
|
121
|
-
msg_type = str(server_request.WhichOneof("server_request_type"))
|
122
|
-
if msg_type == "record_publish":
|
123
|
-
record = server_request.record_publish
|
124
|
-
sub_msg_type = _record_msg_type(record)
|
125
|
-
msg_type = f"pub-{sub_msg_type}"
|
126
|
-
elif msg_type == "record_communicate":
|
127
|
-
record = server_request.record_communicate
|
128
|
-
sub_msg_type = _record_msg_type(record)
|
129
|
-
msg_type = f"comm-{sub_msg_type}"
|
130
|
-
# print("SRV", server_request)
|
131
|
-
elif message_type_str == "ServerResponse":
|
132
|
-
is_response = True
|
133
|
-
server_response = cast("spb.ServerResponse", msg)
|
134
|
-
msg_type = str(server_response.WhichOneof("server_response_type"))
|
135
|
-
if msg_type == "result_communicate":
|
136
|
-
result = server_response.result_communicate
|
137
|
-
sub_msg_type = _result_msg_type(result)
|
138
|
-
msg_type = f"comm-{sub_msg_type}"
|
139
|
-
else:
|
140
|
-
raise AssertionError(f"Unknown message type {message_type_str}")
|
141
|
-
_log(
|
142
|
-
msg_type,
|
143
|
-
is_response=is_response,
|
144
|
-
record=record,
|
145
|
-
result=result,
|
146
|
-
log_type=log_type,
|
147
|
-
resource=resource,
|
148
|
-
)
|
149
|
-
|
150
|
-
|
151
|
-
def _log_message_queue(msg: "MessageQueueType", q: "QueueType") -> None:
|
152
|
-
_annotate_message(msg)
|
153
|
-
resource = getattr(q, ANNOTATE_QUEUE_NAME, None)
|
154
|
-
_log_message(msg, "queue", resource=resource)
|
155
|
-
|
156
|
-
|
157
|
-
def _log_message_dequeue(msg: "MessageQueueType", q: "QueueType") -> None:
|
158
|
-
resource = getattr(q, ANNOTATE_QUEUE_NAME, None)
|
159
|
-
_log_message(msg, "dequeue", resource=resource)
|
160
|
-
|
161
|
-
|
162
|
-
def _log_message_send(msg: "MessageType", t: "TransportType") -> None:
|
163
|
-
_log_message(msg, "send")
|
164
|
-
|
165
|
-
|
166
|
-
def _log_message_recv(msg: "MessageType", t: "TransportType") -> None:
|
167
|
-
_log_message(msg, "recv")
|
168
|
-
|
169
|
-
|
170
|
-
def _log_message_process(msg: "MessageType") -> None:
|
171
|
-
_log_message(msg, "process")
|
172
|
-
|
173
|
-
|
174
|
-
def _log_message_link(src: "MessageType", dest: "MessageType") -> None:
|
175
|
-
_log_message(src, "source")
|
176
|
-
_log_message(dest, "dest")
|
177
|
-
|
178
|
-
|
179
|
-
def _log_message_assert(msg: "MessageType") -> None:
|
180
|
-
_log_message(msg, "assert")
|
181
|
-
|
182
|
-
|
183
|
-
def _annotate_queue(q: "QueueType", name: str) -> None:
|
184
|
-
setattr(q, ANNOTATE_QUEUE_NAME, name)
|
185
|
-
|
186
|
-
|
187
|
-
def _annotate_message(msg: "MessageQueueType") -> None:
|
188
|
-
record_id = secrets.token_hex(8)
|
189
|
-
msg._info._tracelog_id = record_id
|
190
|
-
|
191
|
-
|
192
|
-
#
|
193
|
-
# Default functions when logging is disabled
|
194
|
-
#
|
195
|
-
|
196
|
-
|
197
|
-
def log_message_queue(msg: "MessageQueueType", q: "QueueType") -> None:
|
198
|
-
return None
|
199
|
-
|
200
|
-
|
201
|
-
def log_message_dequeue(msg: "MessageQueueType", q: "QueueType") -> None:
|
202
|
-
return None
|
203
|
-
|
204
|
-
|
205
|
-
def log_message_send(msg: "MessageType", t: "TransportType") -> None:
|
206
|
-
return None
|
207
|
-
|
208
|
-
|
209
|
-
def log_message_recv(msg: "MessageType", t: "TransportType") -> None:
|
210
|
-
return None
|
211
|
-
|
212
|
-
|
213
|
-
def log_message_process(msg: "MessageType") -> None:
|
214
|
-
return None
|
215
|
-
|
216
|
-
|
217
|
-
def log_message_link(src: "MessageType", dest: "MessageType") -> None:
|
218
|
-
return None
|
219
|
-
|
220
|
-
|
221
|
-
def log_message_assert(msg: "MessageType") -> None:
|
222
|
-
return None
|
223
|
-
|
224
|
-
|
225
|
-
def annotate_queue(q: "QueueType", name: str) -> None:
|
226
|
-
return None
|
227
|
-
|
228
|
-
|
229
|
-
def annotate_message(msg: "MessageQueueType") -> None:
|
230
|
-
return None
|
231
|
-
|
232
|
-
|
233
|
-
def enable(log_mode: Optional[str] = None) -> None:
|
234
|
-
global tracelog_mode
|
235
|
-
if log_mode:
|
236
|
-
tracelog_mode = log_mode
|
237
|
-
|
238
|
-
global log_message_queue
|
239
|
-
global log_message_dequeue
|
240
|
-
global log_message_send
|
241
|
-
global log_message_recv
|
242
|
-
global log_message_process
|
243
|
-
global log_message_link
|
244
|
-
global log_message_assert
|
245
|
-
global annotate_queue
|
246
|
-
global annotate_message
|
247
|
-
log_message_queue = _log_message_queue
|
248
|
-
log_message_dequeue = _log_message_dequeue
|
249
|
-
log_message_send = _log_message_send
|
250
|
-
log_message_recv = _log_message_recv
|
251
|
-
log_message_process = _log_message_process
|
252
|
-
log_message_link = _log_message_link
|
253
|
-
log_message_assert = _log_message_assert
|
254
|
-
annotate_queue = _annotate_queue
|
255
|
-
annotate_message = _annotate_message
|
wandb/sdk/lib/wburls.py
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
"""Container for urls used in the wandb package.
|
2
|
-
|
3
|
-
Use this anytime a URL is displayed to the user.
|
4
|
-
|
5
|
-
Usage:
|
6
|
-
```python
|
7
|
-
from wandb.sdk.lib.wburls import wburls
|
8
|
-
|
9
|
-
print(f"This is a url {wburls.get('cli_launch')}")
|
10
|
-
```
|
11
|
-
"""
|
12
|
-
|
13
|
-
from typing import TYPE_CHECKING, Dict, Optional
|
14
|
-
|
15
|
-
if TYPE_CHECKING:
|
16
|
-
from ._wburls_generated import URLS
|
17
|
-
|
18
|
-
|
19
|
-
class WBURLs:
|
20
|
-
_urls_dict: Optional[Dict["URLS", str]]
|
21
|
-
|
22
|
-
def __init__(self) -> None:
|
23
|
-
self._urls_dict = None
|
24
|
-
|
25
|
-
def _get_urls(self) -> Dict["URLS", str]:
|
26
|
-
return dict(
|
27
|
-
cli_launch="https://wandb.me/launch",
|
28
|
-
doc_run="https://wandb.me/run",
|
29
|
-
doc_require="https://wandb.me/library-require",
|
30
|
-
doc_start_err="https://docs.wandb.ai/guides/track/tracking-faq#initstarterror-error-communicating-with-wandb-process-",
|
31
|
-
doc_artifacts_guide="https://docs.wandb.ai/guides/artifacts",
|
32
|
-
upgrade_server="https://wandb.me/server-upgrade",
|
33
|
-
multiprocess="http://wandb.me/init-multiprocess",
|
34
|
-
wandb_init="https://wandb.me/wandb-init",
|
35
|
-
wandb_server="https://wandb.me/wandb-server",
|
36
|
-
wandb_define_metric="https://wandb.me/define-metric",
|
37
|
-
wandb_core="https://wandb.me/wandb-core",
|
38
|
-
)
|
39
|
-
|
40
|
-
def get(self, s: "URLS") -> str:
|
41
|
-
if self._urls_dict is None:
|
42
|
-
self._urls_dict = self._get_urls()
|
43
|
-
return self._urls_dict[s]
|
44
|
-
|
45
|
-
|
46
|
-
wburls = WBURLs()
|
File without changes
|
File without changes
|
File without changes
|