wandb 0.15.9__py3-none-any.whl → 0.15.11__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- wandb/__init__.py +5 -1
- wandb/apis/public.py +137 -17
- wandb/apis/reports/_panels.py +1 -1
- wandb/apis/reports/blocks.py +1 -0
- wandb/apis/reports/report.py +27 -5
- wandb/cli/cli.py +52 -41
- wandb/docker/__init__.py +17 -0
- wandb/docker/auth.py +1 -1
- wandb/env.py +24 -4
- wandb/filesync/step_checksum.py +3 -3
- wandb/integration/openai/openai.py +3 -0
- wandb/integration/ultralytics/__init__.py +9 -0
- wandb/integration/ultralytics/bbox_utils.py +196 -0
- wandb/integration/ultralytics/callback.py +458 -0
- wandb/integration/ultralytics/classification_utils.py +66 -0
- wandb/integration/ultralytics/mask_utils.py +141 -0
- wandb/integration/ultralytics/pose_utils.py +92 -0
- wandb/integration/xgboost/xgboost.py +3 -3
- wandb/integration/yolov8/__init__.py +0 -7
- wandb/integration/yolov8/yolov8.py +22 -3
- wandb/old/settings.py +7 -0
- wandb/plot/line_series.py +0 -1
- wandb/proto/v3/wandb_internal_pb2.py +353 -300
- wandb/proto/v3/wandb_server_pb2.py +37 -41
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v3/wandb_telemetry_pb2.py +16 -16
- wandb/proto/v4/wandb_internal_pb2.py +272 -260
- wandb/proto/v4/wandb_server_pb2.py +37 -40
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_telemetry_pb2.py +16 -16
- wandb/proto/wandb_internal_codegen.py +7 -31
- wandb/sdk/artifacts/artifact.py +321 -189
- wandb/sdk/artifacts/artifact_cache.py +14 -0
- wandb/sdk/artifacts/artifact_manifest.py +5 -4
- wandb/sdk/artifacts/artifact_manifest_entry.py +37 -9
- wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +1 -9
- wandb/sdk/artifacts/artifact_saver.py +13 -50
- wandb/sdk/artifacts/artifact_ttl.py +6 -0
- wandb/sdk/artifacts/artifacts_cache.py +119 -93
- wandb/sdk/artifacts/staging.py +25 -0
- wandb/sdk/artifacts/storage_handlers/s3_handler.py +12 -7
- wandb/sdk/artifacts/storage_handlers/wb_local_artifact_handler.py +2 -3
- wandb/sdk/artifacts/storage_policies/__init__.py +4 -0
- wandb/sdk/artifacts/storage_policies/register.py +1 -0
- wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +4 -3
- wandb/sdk/artifacts/storage_policy.py +4 -2
- wandb/sdk/backend/backend.py +0 -16
- wandb/sdk/data_types/image.py +3 -1
- wandb/sdk/integration_utils/auto_logging.py +38 -13
- wandb/sdk/interface/interface.py +16 -135
- wandb/sdk/interface/interface_shared.py +9 -147
- wandb/sdk/interface/interface_sock.py +0 -26
- wandb/sdk/internal/file_pusher.py +20 -3
- wandb/sdk/internal/file_stream.py +3 -1
- wandb/sdk/internal/handler.py +53 -70
- wandb/sdk/internal/internal_api.py +220 -130
- wandb/sdk/internal/job_builder.py +41 -37
- wandb/sdk/internal/sender.py +7 -25
- wandb/sdk/internal/system/assets/disk.py +144 -11
- wandb/sdk/internal/system/system_info.py +6 -2
- wandb/sdk/launch/__init__.py +5 -0
- wandb/sdk/launch/{launch.py → _launch.py} +53 -54
- wandb/sdk/launch/{launch_add.py → _launch_add.py} +34 -31
- wandb/sdk/launch/_project_spec.py +13 -2
- wandb/sdk/launch/agent/agent.py +103 -59
- wandb/sdk/launch/agent/run_queue_item_file_saver.py +6 -4
- wandb/sdk/launch/builder/build.py +19 -1
- wandb/sdk/launch/builder/docker_builder.py +5 -1
- wandb/sdk/launch/builder/kaniko_builder.py +5 -1
- wandb/sdk/launch/create_job.py +20 -5
- wandb/sdk/launch/loader.py +14 -5
- wandb/sdk/launch/runner/abstract.py +0 -2
- wandb/sdk/launch/runner/kubernetes_monitor.py +329 -0
- wandb/sdk/launch/runner/kubernetes_runner.py +66 -209
- wandb/sdk/launch/runner/local_container.py +5 -2
- wandb/sdk/launch/runner/local_process.py +4 -1
- wandb/sdk/launch/sweeps/scheduler.py +43 -25
- wandb/sdk/launch/sweeps/utils.py +5 -3
- wandb/sdk/launch/utils.py +3 -1
- wandb/sdk/lib/_settings_toposort_generate.py +3 -9
- wandb/sdk/lib/_settings_toposort_generated.py +27 -3
- wandb/sdk/lib/_wburls_generated.py +1 -0
- wandb/sdk/lib/filenames.py +27 -6
- wandb/sdk/lib/filesystem.py +181 -7
- wandb/sdk/lib/fsm.py +5 -3
- wandb/sdk/lib/gql_request.py +3 -0
- wandb/sdk/lib/ipython.py +7 -0
- wandb/sdk/lib/wburls.py +1 -0
- wandb/sdk/service/port_file.py +2 -15
- wandb/sdk/service/server.py +7 -55
- wandb/sdk/service/service.py +56 -26
- wandb/sdk/service/service_base.py +1 -1
- wandb/sdk/service/streams.py +11 -5
- wandb/sdk/verify/verify.py +2 -2
- wandb/sdk/wandb_init.py +8 -2
- wandb/sdk/wandb_manager.py +4 -14
- wandb/sdk/wandb_run.py +143 -53
- wandb/sdk/wandb_settings.py +148 -35
- wandb/testing/relay.py +85 -38
- wandb/util.py +87 -4
- wandb/wandb_torch.py +24 -38
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/METADATA +48 -23
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/RECORD +107 -103
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/WHEEL +1 -1
- wandb/proto/v3/wandb_server_pb2_grpc.py +0 -1422
- wandb/proto/v4/wandb_server_pb2_grpc.py +0 -1422
- wandb/proto/wandb_server_pb2_grpc.py +0 -8
- wandb/sdk/artifacts/storage_policies/s3_bucket_policy.py +0 -61
- wandb/sdk/interface/interface_grpc.py +0 -460
- wandb/sdk/service/server_grpc.py +0 -444
- wandb/sdk/service/service_grpc.py +0 -73
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/LICENSE +0 -0
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/entry_points.txt +0 -0
- {wandb-0.15.9.dist-info → wandb-0.15.11.dist-info}/top_level.txt +0 -0
wandb/sdk/service/server_grpc.py
DELETED
@@ -1,444 +0,0 @@
|
|
1
|
-
"""grpc server.
|
2
|
-
|
3
|
-
Implement grpc servicer.
|
4
|
-
"""
|
5
|
-
|
6
|
-
from typing import TYPE_CHECKING
|
7
|
-
|
8
|
-
import grpc
|
9
|
-
|
10
|
-
import wandb
|
11
|
-
from wandb.proto import wandb_internal_pb2 as pb
|
12
|
-
from wandb.proto import wandb_server_pb2 as spb
|
13
|
-
from wandb.proto import wandb_server_pb2_grpc as spb_grpc
|
14
|
-
from wandb.proto import wandb_telemetry_pb2 as tpb
|
15
|
-
from wandb.sdk.internal.settings_static import SettingsStatic
|
16
|
-
|
17
|
-
from .. import lib as wandb_lib
|
18
|
-
from .streams import StreamMux
|
19
|
-
|
20
|
-
if TYPE_CHECKING:
|
21
|
-
|
22
|
-
class GrpcServerType:
|
23
|
-
def __init__(self) -> None:
|
24
|
-
pass
|
25
|
-
|
26
|
-
def stop(self, num: int) -> None:
|
27
|
-
pass
|
28
|
-
|
29
|
-
|
30
|
-
class WandbServicer(spb_grpc.InternalServiceServicer):
|
31
|
-
"""Provides methods that implement functionality of route guide server."""
|
32
|
-
|
33
|
-
_server: "GrpcServerType"
|
34
|
-
_mux: StreamMux
|
35
|
-
|
36
|
-
def __init__(self, server: "GrpcServerType", mux: StreamMux) -> None:
|
37
|
-
self._server = server
|
38
|
-
self._mux = mux
|
39
|
-
|
40
|
-
def RunUpdate( # noqa: N802
|
41
|
-
self, run_data: pb.RunRecord, context: grpc.ServicerContext
|
42
|
-
) -> pb.RunUpdateResult:
|
43
|
-
if not run_data.run_id:
|
44
|
-
run_data.run_id = wandb_lib.runid.generate_id()
|
45
|
-
# Record telemetry info about grpc server
|
46
|
-
run_data.telemetry.feature.grpc = True
|
47
|
-
run_data.telemetry.cli_version = wandb.__version__
|
48
|
-
stream_id = run_data._info.stream_id
|
49
|
-
iface = self._mux.get_stream(stream_id).interface
|
50
|
-
result = iface._communicate_run(run_data)
|
51
|
-
assert result # TODO: handle errors
|
52
|
-
return result
|
53
|
-
|
54
|
-
def RunStart( # noqa: N802
|
55
|
-
self, run_start: pb.RunStartRequest, context: grpc.ServicerContext
|
56
|
-
) -> pb.RunStartResponse:
|
57
|
-
# initiate run (stats and metadata probing)
|
58
|
-
stream_id = run_start._info.stream_id
|
59
|
-
iface = self._mux.get_stream(stream_id).interface
|
60
|
-
result = iface._communicate_run_start(run_start)
|
61
|
-
assert result # TODO: handle errors
|
62
|
-
return result
|
63
|
-
|
64
|
-
def CheckVersion( # noqa: N802
|
65
|
-
self, check_version: pb.CheckVersionRequest, context: grpc.ServicerContext
|
66
|
-
) -> pb.CheckVersionResponse:
|
67
|
-
# result = self._servicer._interface._communicate_check_version(check_version)
|
68
|
-
# assert result # TODO: handle errors
|
69
|
-
result = pb.CheckVersionResponse()
|
70
|
-
return result
|
71
|
-
|
72
|
-
def Attach( # noqa: N802
|
73
|
-
self, attach: pb.AttachRequest, context: grpc.ServicerContext
|
74
|
-
) -> pb.AttachResponse:
|
75
|
-
stream_id = attach._info.stream_id
|
76
|
-
iface = self._mux.get_stream(stream_id).interface
|
77
|
-
result = iface._communicate_attach(attach)
|
78
|
-
assert result # TODO: handle errors
|
79
|
-
return result
|
80
|
-
|
81
|
-
def PollExit( # noqa: N802
|
82
|
-
self, poll_exit: pb.PollExitRequest, context: grpc.ServicerContext
|
83
|
-
) -> pb.PollExitResponse:
|
84
|
-
stream_id = poll_exit._info.stream_id
|
85
|
-
iface = self._mux.get_stream(stream_id).interface
|
86
|
-
result = iface.communicate_poll_exit()
|
87
|
-
assert result # TODO: handle errors
|
88
|
-
return result
|
89
|
-
|
90
|
-
def ServerInfo( # noqa: N802
|
91
|
-
self, server_info: pb.ServerInfoRequest, context: grpc.ServicerContext
|
92
|
-
) -> pb.ServerInfoResponse:
|
93
|
-
stream_id = server_info._info.stream_id
|
94
|
-
iface = self._mux.get_stream(stream_id).interface
|
95
|
-
result = iface.communicate_server_info()
|
96
|
-
assert result # TODO: handle errors
|
97
|
-
return result
|
98
|
-
|
99
|
-
def GetSummary( # noqa: N802
|
100
|
-
self, get_summary: pb.GetSummaryRequest, context: grpc.ServicerContext
|
101
|
-
) -> pb.GetSummaryResponse:
|
102
|
-
stream_id = get_summary._info.stream_id
|
103
|
-
iface = self._mux.get_stream(stream_id).interface
|
104
|
-
result = iface.communicate_get_summary()
|
105
|
-
assert result # TODO: handle errors
|
106
|
-
return result
|
107
|
-
|
108
|
-
def SampledHistory( # noqa: N802
|
109
|
-
self, sampled_history: pb.SampledHistoryRequest, context: grpc.ServicerContext
|
110
|
-
) -> pb.SampledHistoryResponse:
|
111
|
-
stream_id = sampled_history._info.stream_id
|
112
|
-
iface = self._mux.get_stream(stream_id).interface
|
113
|
-
result = iface.communicate_sampled_history()
|
114
|
-
assert result # TODO: handle errors
|
115
|
-
return result
|
116
|
-
|
117
|
-
def JobInfo( # noqa: N802
|
118
|
-
self, job_info: pb.JobInfoRequest, context: grpc.ServicerContext
|
119
|
-
) -> pb.JobInfoResponse:
|
120
|
-
stream_id = job_info._info.stream_id
|
121
|
-
iface = self._mux.get_stream(stream_id).interface
|
122
|
-
result = iface._deliver_request_job_info(job_info)
|
123
|
-
response = result.wait(timeout=-1)
|
124
|
-
assert response
|
125
|
-
return response.response.job_info_response
|
126
|
-
|
127
|
-
def Shutdown( # noqa: N802
|
128
|
-
self, shutdown: pb.ShutdownRequest, context: grpc.ServicerContext
|
129
|
-
) -> pb.ShutdownResponse:
|
130
|
-
stream_id = shutdown._info.stream_id
|
131
|
-
iface = self._mux.get_stream(stream_id).interface
|
132
|
-
iface._communicate_shutdown()
|
133
|
-
result = pb.ShutdownResponse()
|
134
|
-
return result
|
135
|
-
|
136
|
-
def RunExit( # noqa: N802
|
137
|
-
self, exit_data: pb.RunExitRecord, context: grpc.ServicerContext
|
138
|
-
) -> pb.RunExitResult:
|
139
|
-
stream_id = exit_data._info.stream_id
|
140
|
-
iface = self._mux.get_stream(stream_id).interface
|
141
|
-
iface.publish_exit(exit_data.exit_code)
|
142
|
-
result = pb.RunExitResult()
|
143
|
-
return result
|
144
|
-
|
145
|
-
def RunPreempting( # noqa: N802
|
146
|
-
self, preempt: pb.RunPreemptingRecord, context: grpc.ServicerContext
|
147
|
-
) -> pb.RunPreemptingResult:
|
148
|
-
stream_id = preempt._info.stream_id
|
149
|
-
iface = self._mux.get_stream(stream_id).interface
|
150
|
-
iface._publish_preempting(preempt)
|
151
|
-
result = pb.RunPreemptingResult()
|
152
|
-
return result
|
153
|
-
|
154
|
-
def Artifact( # noqa: N802
|
155
|
-
self, art_data: pb.ArtifactRecord, context: grpc.ServicerContext
|
156
|
-
) -> pb.ArtifactResult:
|
157
|
-
stream_id = art_data._info.stream_id
|
158
|
-
iface = self._mux.get_stream(stream_id).interface
|
159
|
-
iface._publish_artifact(art_data)
|
160
|
-
result = pb.ArtifactResult()
|
161
|
-
return result
|
162
|
-
|
163
|
-
def LinkArtifact( # noqa: N802
|
164
|
-
self,
|
165
|
-
link_artifact: pb.LinkArtifactRecord,
|
166
|
-
context: grpc.ServicerContext,
|
167
|
-
) -> pb.LinkArtifactResult:
|
168
|
-
stream_id = link_artifact._info.stream_id
|
169
|
-
iface = self._mux.get_stream(stream_id).interface
|
170
|
-
iface._publish_link_artifact(link_artifact)
|
171
|
-
result = pb.LinkArtifactResult()
|
172
|
-
return result
|
173
|
-
|
174
|
-
def UseArtifact( # noqa: N802
|
175
|
-
self, use_artifact: pb.UseArtifactRecord, context: grpc.ServicerContext
|
176
|
-
) -> pb.UseArtifactResult:
|
177
|
-
stream_id = use_artifact._info.stream_id
|
178
|
-
iface = self._mux.get_stream(stream_id).interface
|
179
|
-
iface._publish_use_artifact(use_artifact)
|
180
|
-
result = pb.UseArtifactResult()
|
181
|
-
return result
|
182
|
-
|
183
|
-
def ArtifactSend( # noqa: N802
|
184
|
-
self, art_send: pb.ArtifactSendRequest, context: grpc.ServicerContext
|
185
|
-
) -> pb.ArtifactSendResponse:
|
186
|
-
stream_id = art_send._info.stream_id
|
187
|
-
iface = self._mux.get_stream(stream_id).interface
|
188
|
-
resp = iface._communicate_artifact_send(art_send)
|
189
|
-
assert resp
|
190
|
-
return resp
|
191
|
-
|
192
|
-
def ArtifactPoll( # noqa: N802
|
193
|
-
self, art_poll: pb.ArtifactPollRequest, context: grpc.ServicerContext
|
194
|
-
) -> pb.ArtifactPollResponse:
|
195
|
-
stream_id = art_poll._info.stream_id
|
196
|
-
iface = self._mux.get_stream(stream_id).interface
|
197
|
-
resp = iface._communicate_artifact_poll(art_poll)
|
198
|
-
assert resp
|
199
|
-
return resp
|
200
|
-
|
201
|
-
def Cancel( # noqa: N802
|
202
|
-
self, cancel: pb.CancelRequest, context: grpc.ServicerContext
|
203
|
-
) -> pb.CancelResponse:
|
204
|
-
stream_id = cancel._info.stream_id
|
205
|
-
iface = self._mux.get_stream(stream_id).interface
|
206
|
-
iface._publish_cancel(cancel)
|
207
|
-
response = pb.CancelResponse()
|
208
|
-
return response
|
209
|
-
|
210
|
-
def Keepalive( # noqa: N802
|
211
|
-
self, keepalive: pb.KeepaliveRequest, context: grpc.ServicerContext
|
212
|
-
) -> pb.KeepaliveResponse:
|
213
|
-
stream_id = keepalive._info.stream_id
|
214
|
-
iface = self._mux.get_stream(stream_id).interface
|
215
|
-
iface._publish_keepalive(keepalive)
|
216
|
-
response = pb.KeepaliveResponse()
|
217
|
-
return response
|
218
|
-
|
219
|
-
def TBSend( # noqa: N802
|
220
|
-
self, tb_data: pb.TBRecord, context: grpc.ServicerContext
|
221
|
-
) -> pb.TBResult:
|
222
|
-
stream_id = tb_data._info.stream_id
|
223
|
-
iface = self._mux.get_stream(stream_id).interface
|
224
|
-
iface._publish_tbdata(tb_data)
|
225
|
-
result = pb.TBResult()
|
226
|
-
return result
|
227
|
-
|
228
|
-
def PartialLog( # noqa: N802
|
229
|
-
self, partial_history: pb.PartialHistoryRequest, context: grpc.ServicerContext
|
230
|
-
) -> pb.PartialHistoryResponse:
|
231
|
-
stream_id = partial_history._info.stream_id
|
232
|
-
iface = self._mux.get_stream(stream_id).interface
|
233
|
-
iface._publish_partial_history(partial_history)
|
234
|
-
# make up a response even though this was async
|
235
|
-
result = pb.PartialHistoryResponse()
|
236
|
-
return result
|
237
|
-
|
238
|
-
def Log( # noqa: N802
|
239
|
-
self, history: pb.HistoryRecord, context: grpc.ServicerContext
|
240
|
-
) -> pb.HistoryResult:
|
241
|
-
stream_id = history._info.stream_id
|
242
|
-
iface = self._mux.get_stream(stream_id).interface
|
243
|
-
iface._publish_history(history)
|
244
|
-
# make up a response even though this was async
|
245
|
-
result = pb.HistoryResult()
|
246
|
-
return result
|
247
|
-
|
248
|
-
def Summary( # noqa: N802
|
249
|
-
self, summary: pb.SummaryRecord, context: grpc.ServicerContext
|
250
|
-
) -> pb.SummaryResult:
|
251
|
-
stream_id = summary._info.stream_id
|
252
|
-
iface = self._mux.get_stream(stream_id).interface
|
253
|
-
iface._publish_summary(summary)
|
254
|
-
# make up a response even though this was async
|
255
|
-
result = pb.SummaryResult()
|
256
|
-
return result
|
257
|
-
|
258
|
-
def Telemetry( # noqa: N802
|
259
|
-
self, telem: tpb.TelemetryRecord, context: grpc.ServicerContext
|
260
|
-
) -> tpb.TelemetryResult:
|
261
|
-
stream_id = telem._info.stream_id
|
262
|
-
iface = self._mux.get_stream(stream_id).interface
|
263
|
-
iface._publish_telemetry(telem)
|
264
|
-
# make up a response even though this was async
|
265
|
-
result = tpb.TelemetryResult()
|
266
|
-
return result
|
267
|
-
|
268
|
-
def Output( # noqa: N802
|
269
|
-
self, output_data: pb.OutputRecord, context: grpc.ServicerContext
|
270
|
-
) -> pb.OutputResult:
|
271
|
-
stream_id = output_data._info.stream_id
|
272
|
-
iface = self._mux.get_stream(stream_id).interface
|
273
|
-
iface._publish_output(output_data)
|
274
|
-
# make up a response even though this was async
|
275
|
-
result = pb.OutputResult()
|
276
|
-
return result
|
277
|
-
|
278
|
-
def OutputRaw( # noqa: N802
|
279
|
-
self, output_data: pb.OutputRawRecord, context: grpc.ServicerContext
|
280
|
-
) -> pb.OutputRawResult:
|
281
|
-
stream_id = output_data._info.stream_id
|
282
|
-
iface = self._mux.get_stream(stream_id).interface
|
283
|
-
iface._publish_output_raw(output_data)
|
284
|
-
# make up a response even though this was async
|
285
|
-
result = pb.OutputRawResult()
|
286
|
-
return result
|
287
|
-
|
288
|
-
def Files( # noqa: N802
|
289
|
-
self, files_data: pb.FilesRecord, context: grpc.ServicerContext
|
290
|
-
) -> pb.FilesResult:
|
291
|
-
stream_id = files_data._info.stream_id
|
292
|
-
iface = self._mux.get_stream(stream_id).interface
|
293
|
-
iface._publish_files(files_data)
|
294
|
-
# make up a response even though this was async
|
295
|
-
result = pb.FilesResult()
|
296
|
-
return result
|
297
|
-
|
298
|
-
def Config( # noqa: N802
|
299
|
-
self, config_data: pb.ConfigRecord, context: grpc.ServicerContext
|
300
|
-
) -> pb.ConfigResult:
|
301
|
-
stream_id = config_data._info.stream_id
|
302
|
-
iface = self._mux.get_stream(stream_id).interface
|
303
|
-
iface._publish_config(config_data)
|
304
|
-
# make up a response even though this was async
|
305
|
-
result = pb.ConfigResult()
|
306
|
-
return result
|
307
|
-
|
308
|
-
def Metric( # noqa: N802
|
309
|
-
self, metric: pb.MetricRecord, context: grpc.ServicerContext
|
310
|
-
) -> pb.MetricResult:
|
311
|
-
stream_id = metric._info.stream_id
|
312
|
-
iface = self._mux.get_stream(stream_id).interface
|
313
|
-
iface._publish_metric(metric)
|
314
|
-
# make up a response even though this was async
|
315
|
-
result = pb.MetricResult()
|
316
|
-
return result
|
317
|
-
|
318
|
-
def Pause( # noqa: N802
|
319
|
-
self, pause: pb.PauseRequest, context: grpc.ServicerContext
|
320
|
-
) -> pb.PauseResponse:
|
321
|
-
stream_id = pause._info.stream_id
|
322
|
-
iface = self._mux.get_stream(stream_id).interface
|
323
|
-
iface._publish_pause(pause)
|
324
|
-
# make up a response even though this was async
|
325
|
-
result = pb.PauseResponse()
|
326
|
-
return result
|
327
|
-
|
328
|
-
def Resume( # noqa: N802
|
329
|
-
self, resume: pb.ResumeRequest, context: grpc.ServicerContext
|
330
|
-
) -> pb.ResumeResponse:
|
331
|
-
stream_id = resume._info.stream_id
|
332
|
-
iface = self._mux.get_stream(stream_id).interface
|
333
|
-
iface._publish_resume(resume)
|
334
|
-
# make up a response even though this was async
|
335
|
-
result = pb.ResumeResponse()
|
336
|
-
return result
|
337
|
-
|
338
|
-
def Alert( # noqa: N802
|
339
|
-
self, alert: pb.AlertRecord, context: grpc.ServicerContext
|
340
|
-
) -> pb.AlertResult:
|
341
|
-
stream_id = alert._info.stream_id
|
342
|
-
iface = self._mux.get_stream(stream_id).interface
|
343
|
-
iface._publish_alert(alert)
|
344
|
-
# make up a response even though this was async
|
345
|
-
result = pb.AlertResult()
|
346
|
-
return result
|
347
|
-
|
348
|
-
def RunStatus( # noqa: N802
|
349
|
-
self, run_status: pb.RunStatusRequest, context: grpc.ServicerContext
|
350
|
-
) -> pb.RunStatusResponse:
|
351
|
-
stream_id = run_status._info.stream_id
|
352
|
-
iface = self._mux.get_stream(stream_id).interface
|
353
|
-
handle = iface._deliver_request_run_status(run_status)
|
354
|
-
result = handle.wait(timeout=-1)
|
355
|
-
assert result
|
356
|
-
return result.response.run_status_response
|
357
|
-
|
358
|
-
def Status( # noqa: N802
|
359
|
-
self, status: pb.StatusRequest, context: grpc.ServicerContext
|
360
|
-
) -> pb.StatusResponse:
|
361
|
-
stream_id = status._info.stream_id
|
362
|
-
iface = self._mux.get_stream(stream_id).interface
|
363
|
-
result = iface._communicate_status(status)
|
364
|
-
assert result
|
365
|
-
return result
|
366
|
-
|
367
|
-
def ServerShutdown( # noqa: N802
|
368
|
-
self,
|
369
|
-
request: spb.ServerShutdownRequest,
|
370
|
-
context: grpc.ServicerContext,
|
371
|
-
) -> spb.ServerShutdownResponse:
|
372
|
-
result = spb.ServerShutdownResponse()
|
373
|
-
self._server.stop(5)
|
374
|
-
return result
|
375
|
-
|
376
|
-
def ServerStatus( # noqa: N802
|
377
|
-
self,
|
378
|
-
request: spb.ServerStatusRequest,
|
379
|
-
context: grpc.ServicerContext,
|
380
|
-
) -> spb.ServerStatusResponse:
|
381
|
-
result = spb.ServerStatusResponse()
|
382
|
-
return result
|
383
|
-
|
384
|
-
def ServerInformInit( # noqa: N802
|
385
|
-
self,
|
386
|
-
request: spb.ServerInformInitRequest,
|
387
|
-
context: grpc.ServicerContext,
|
388
|
-
) -> spb.ServerInformInitResponse:
|
389
|
-
stream_id = request._info.stream_id
|
390
|
-
settings = SettingsStatic(request.settings)
|
391
|
-
self._mux.add_stream(stream_id, settings=settings)
|
392
|
-
result = spb.ServerInformInitResponse()
|
393
|
-
return result
|
394
|
-
|
395
|
-
def ServerInformStart( # noqa: N802
|
396
|
-
self,
|
397
|
-
request: spb.ServerInformStartRequest,
|
398
|
-
context: grpc.ServicerContext,
|
399
|
-
) -> spb.ServerInformStartResponse:
|
400
|
-
stream_id = request._info.stream_id
|
401
|
-
settings = SettingsStatic(request.settings)
|
402
|
-
self._mux.update_stream(stream_id, settings=settings)
|
403
|
-
self._mux.start_stream(stream_id)
|
404
|
-
result = spb.ServerInformStartResponse()
|
405
|
-
return result
|
406
|
-
|
407
|
-
def ServerInformFinish( # noqa: N802
|
408
|
-
self,
|
409
|
-
request: spb.ServerInformFinishRequest,
|
410
|
-
context: grpc.ServicerContext,
|
411
|
-
) -> spb.ServerInformFinishResponse:
|
412
|
-
stream_id = request._info.stream_id
|
413
|
-
self._mux.del_stream(stream_id)
|
414
|
-
result = spb.ServerInformFinishResponse()
|
415
|
-
return result
|
416
|
-
|
417
|
-
def ServerInformAttach( # noqa: N802
|
418
|
-
self,
|
419
|
-
request: spb.ServerInformAttachRequest,
|
420
|
-
context: grpc.ServicerContext,
|
421
|
-
) -> spb.ServerInformAttachResponse:
|
422
|
-
stream_id = request._info.stream_id
|
423
|
-
result = spb.ServerInformAttachResponse()
|
424
|
-
result.settings.CopyFrom(self._mux._streams[stream_id]._settings._proto)
|
425
|
-
return result
|
426
|
-
|
427
|
-
def ServerInformDetach( # noqa: N802
|
428
|
-
self,
|
429
|
-
request: spb.ServerInformDetachRequest,
|
430
|
-
context: grpc.ServicerContext,
|
431
|
-
) -> spb.ServerInformDetachResponse:
|
432
|
-
# TODO
|
433
|
-
result = spb.ServerInformDetachResponse()
|
434
|
-
return result
|
435
|
-
|
436
|
-
def ServerInformTeardown( # noqa: N802
|
437
|
-
self,
|
438
|
-
request: spb.ServerInformTeardownRequest,
|
439
|
-
context: grpc.ServicerContext,
|
440
|
-
) -> spb.ServerInformTeardownResponse:
|
441
|
-
exit_code = request.exit_code
|
442
|
-
self._mux.teardown(exit_code)
|
443
|
-
result = spb.ServerInformTeardownResponse()
|
444
|
-
return result
|
@@ -1,73 +0,0 @@
|
|
1
|
-
"""grpc service.
|
2
|
-
|
3
|
-
Implement ServiceInterface for grpc transport.
|
4
|
-
"""
|
5
|
-
|
6
|
-
from typing import TYPE_CHECKING, Optional
|
7
|
-
|
8
|
-
import grpc
|
9
|
-
|
10
|
-
from wandb.proto import wandb_server_pb2 as spb
|
11
|
-
from wandb.proto import wandb_server_pb2_grpc as pbgrpc
|
12
|
-
|
13
|
-
from .service_base import ServiceInterface
|
14
|
-
|
15
|
-
if TYPE_CHECKING:
|
16
|
-
from wandb.sdk.wandb_settings import Settings
|
17
|
-
|
18
|
-
|
19
|
-
class ServiceGrpcInterface(ServiceInterface):
|
20
|
-
_stub: Optional[pbgrpc.InternalServiceStub]
|
21
|
-
|
22
|
-
def __init__(self) -> None:
|
23
|
-
self._stub = None
|
24
|
-
|
25
|
-
def get_transport(self) -> str:
|
26
|
-
return "grpc"
|
27
|
-
|
28
|
-
def _svc_connect(self, port: int) -> None:
|
29
|
-
channel = grpc.insecure_channel(f"localhost:{port}")
|
30
|
-
stub = pbgrpc.InternalServiceStub(channel)
|
31
|
-
self._stub = stub
|
32
|
-
# TODO: make sure service is up
|
33
|
-
|
34
|
-
def _get_stub(self) -> pbgrpc.InternalServiceStub:
|
35
|
-
assert self._stub
|
36
|
-
return self._stub
|
37
|
-
|
38
|
-
def _svc_inform_init(self, settings: "Settings", run_id: str) -> None:
|
39
|
-
inform_init = spb.ServerInformInitRequest()
|
40
|
-
inform_init.settings.CopyFrom(settings.to_proto())
|
41
|
-
inform_init._info.stream_id = run_id
|
42
|
-
|
43
|
-
assert self._stub
|
44
|
-
_ = self._stub.ServerInformInit(inform_init)
|
45
|
-
|
46
|
-
def _svc_inform_start(self, settings: "Settings", run_id: str) -> None:
|
47
|
-
inform_start = spb.ServerInformStartRequest()
|
48
|
-
inform_start.settings.CopyFrom(settings.to_proto())
|
49
|
-
inform_start._info.stream_id = run_id
|
50
|
-
|
51
|
-
assert self._stub
|
52
|
-
_ = self._stub.ServerInformStart(inform_start)
|
53
|
-
|
54
|
-
def _svc_inform_finish(self, run_id: Optional[str] = None) -> None:
|
55
|
-
assert run_id
|
56
|
-
inform_finish = spb.ServerInformFinishRequest()
|
57
|
-
inform_finish._info.stream_id = run_id
|
58
|
-
|
59
|
-
assert self._stub
|
60
|
-
_ = self._stub.ServerInformFinish(inform_finish)
|
61
|
-
|
62
|
-
def _svc_inform_attach(self, attach_id: str) -> spb.ServerInformAttachResponse:
|
63
|
-
assert self._stub
|
64
|
-
|
65
|
-
inform_attach = spb.ServerInformAttachRequest()
|
66
|
-
inform_attach._info.stream_id = attach_id
|
67
|
-
return self._stub.ServerInformAttach(inform_attach) # type: ignore
|
68
|
-
|
69
|
-
def _svc_inform_teardown(self, exit_code: int) -> None:
|
70
|
-
inform_teardown = spb.ServerInformTeardownRequest(exit_code=exit_code)
|
71
|
-
|
72
|
-
assert self._stub
|
73
|
-
_ = self._stub.ServerInformTeardown(inform_teardown)
|
File without changes
|
File without changes
|
File without changes
|