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
@@ -1,61 +0,0 @@
|
|
1
|
-
"""S3 bucket storage policy."""
|
2
|
-
from typing import TYPE_CHECKING, Dict, Optional, Sequence, Union
|
3
|
-
|
4
|
-
from wandb.sdk.artifacts.artifact_manifest_entry import ArtifactManifestEntry
|
5
|
-
from wandb.sdk.artifacts.storage_handlers.local_file_handler import LocalFileHandler
|
6
|
-
from wandb.sdk.artifacts.storage_handlers.multi_handler import MultiHandler
|
7
|
-
from wandb.sdk.artifacts.storage_handlers.s3_handler import S3Handler
|
8
|
-
from wandb.sdk.artifacts.storage_handlers.tracking_handler import TrackingHandler
|
9
|
-
from wandb.sdk.artifacts.storage_policy import StoragePolicy
|
10
|
-
|
11
|
-
if TYPE_CHECKING:
|
12
|
-
from wandb.sdk.artifacts.artifact import Artifact
|
13
|
-
from wandb.sdk.lib.paths import FilePathStr, URIStr
|
14
|
-
|
15
|
-
|
16
|
-
# Don't use this yet!
|
17
|
-
class __S3BucketPolicy(StoragePolicy): # noqa: N801
|
18
|
-
@classmethod
|
19
|
-
def name(cls) -> str:
|
20
|
-
return "wandb-s3-bucket-policy-v1"
|
21
|
-
|
22
|
-
@classmethod
|
23
|
-
def from_config(cls, config: Dict[str, str]) -> "__S3BucketPolicy":
|
24
|
-
if "bucket" not in config:
|
25
|
-
raise ValueError("Bucket name not found in config")
|
26
|
-
return cls(config["bucket"])
|
27
|
-
|
28
|
-
def __init__(self, bucket: str) -> None:
|
29
|
-
self._bucket = bucket
|
30
|
-
s3 = S3Handler(bucket)
|
31
|
-
local = LocalFileHandler()
|
32
|
-
|
33
|
-
self._handler = MultiHandler(
|
34
|
-
handlers=[
|
35
|
-
s3,
|
36
|
-
local,
|
37
|
-
],
|
38
|
-
default_handler=TrackingHandler(),
|
39
|
-
)
|
40
|
-
|
41
|
-
def config(self) -> Dict[str, str]:
|
42
|
-
return {"bucket": self._bucket}
|
43
|
-
|
44
|
-
def load_path(
|
45
|
-
self,
|
46
|
-
manifest_entry: ArtifactManifestEntry,
|
47
|
-
local: bool = False,
|
48
|
-
) -> Union[URIStr, FilePathStr]:
|
49
|
-
return self._handler.load_path(manifest_entry, local=local)
|
50
|
-
|
51
|
-
def store_path(
|
52
|
-
self,
|
53
|
-
artifact: "Artifact",
|
54
|
-
path: Union[URIStr, FilePathStr],
|
55
|
-
name: Optional[str] = None,
|
56
|
-
checksum: bool = True,
|
57
|
-
max_objects: Optional[int] = None,
|
58
|
-
) -> Sequence[ArtifactManifestEntry]:
|
59
|
-
return self._handler.store_path(
|
60
|
-
artifact, path, name=name, checksum=checksum, max_objects=max_objects
|
61
|
-
)
|
@@ -1,460 +0,0 @@
|
|
1
|
-
"""Backend Sender - Send to internal process.
|
2
|
-
|
3
|
-
Manage backend sender.
|
4
|
-
|
5
|
-
"""
|
6
|
-
|
7
|
-
import logging
|
8
|
-
from typing import TYPE_CHECKING, Any, Optional
|
9
|
-
|
10
|
-
import grpc
|
11
|
-
|
12
|
-
from wandb.proto import wandb_internal_pb2 as pb
|
13
|
-
from wandb.proto import wandb_server_pb2_grpc as pbgrpc
|
14
|
-
from wandb.proto import wandb_telemetry_pb2 as tpb
|
15
|
-
|
16
|
-
from ..lib.mailbox import Mailbox, MailboxHandle
|
17
|
-
from .interface import InterfaceBase
|
18
|
-
from .message_future import MessageFuture
|
19
|
-
from .message_future_poll import MessageFuturePoll
|
20
|
-
|
21
|
-
if TYPE_CHECKING:
|
22
|
-
from ..wandb_run import Run
|
23
|
-
|
24
|
-
|
25
|
-
logger = logging.getLogger("wandb")
|
26
|
-
|
27
|
-
|
28
|
-
class InterfaceGrpc(InterfaceBase):
|
29
|
-
_stub: Optional[pbgrpc.InternalServiceStub]
|
30
|
-
_stream_id: Optional[str]
|
31
|
-
_mailbox: Mailbox
|
32
|
-
|
33
|
-
def __init__(self, mailbox: Mailbox) -> None:
|
34
|
-
super().__init__()
|
35
|
-
self._stub = None
|
36
|
-
self._process_check = None
|
37
|
-
self._stream_id = None
|
38
|
-
self._mailbox = mailbox
|
39
|
-
|
40
|
-
def _hack_set_run(self, run: "Run") -> None:
|
41
|
-
super()._hack_set_run(run)
|
42
|
-
assert run._run_id
|
43
|
-
self._stream_id = run._run_id
|
44
|
-
|
45
|
-
def _connect(self, stub: pbgrpc.InternalServiceStub) -> None:
|
46
|
-
self._stub = stub
|
47
|
-
|
48
|
-
def _assign(self, record: Any) -> None:
|
49
|
-
assert self._stream_id
|
50
|
-
record._info.stream_id = self._stream_id
|
51
|
-
|
52
|
-
def _communicate_check_version(
|
53
|
-
self, check_version: pb.CheckVersionRequest
|
54
|
-
) -> Optional[pb.CheckVersionResponse]:
|
55
|
-
assert self._stub
|
56
|
-
self._assign(check_version)
|
57
|
-
run_result = self._stub.CheckVersion(check_version)
|
58
|
-
return run_result # type: ignore
|
59
|
-
|
60
|
-
def _communicate_attach(
|
61
|
-
self, attach: pb.AttachRequest
|
62
|
-
) -> Optional[pb.AttachResponse]:
|
63
|
-
assert self._stub
|
64
|
-
self._assign(attach)
|
65
|
-
resp = self._stub.Attach(attach)
|
66
|
-
return resp # type: ignore
|
67
|
-
|
68
|
-
def _communicate_run(
|
69
|
-
self, run: pb.RunRecord, timeout: Optional[int] = None
|
70
|
-
) -> Optional[pb.RunUpdateResult]:
|
71
|
-
assert self._stub
|
72
|
-
self._assign(run)
|
73
|
-
run_result = self._stub.RunUpdate(run)
|
74
|
-
return run_result # type: ignore
|
75
|
-
|
76
|
-
def _publish_run(self, run: pb.RunRecord) -> None:
|
77
|
-
assert self._stub
|
78
|
-
self._assign(run)
|
79
|
-
_ = self._stub.RunUpdate(run)
|
80
|
-
|
81
|
-
def _publish_cancel(self, cancel: pb.CancelRequest) -> None:
|
82
|
-
assert self._stub
|
83
|
-
self._assign(cancel)
|
84
|
-
_ = self._stub.Cancel(cancel)
|
85
|
-
|
86
|
-
def _publish_config(self, cfg: pb.ConfigRecord) -> None:
|
87
|
-
assert self._stub
|
88
|
-
self._assign(cfg)
|
89
|
-
_ = self._stub.Config(cfg)
|
90
|
-
|
91
|
-
def _publish_metric(self, metric: pb.MetricRecord) -> None:
|
92
|
-
assert self._stub
|
93
|
-
self._assign(metric)
|
94
|
-
_ = self._stub.Metric(metric)
|
95
|
-
|
96
|
-
def _publish_summary(self, summary: pb.SummaryRecord) -> None:
|
97
|
-
assert self._stub
|
98
|
-
self._assign(summary)
|
99
|
-
_ = self._stub.Summary(summary)
|
100
|
-
|
101
|
-
def _communicate_get_summary(
|
102
|
-
self, get_summary: pb.GetSummaryRequest
|
103
|
-
) -> Optional[pb.GetSummaryResponse]:
|
104
|
-
assert self._stub
|
105
|
-
self._assign(get_summary)
|
106
|
-
try:
|
107
|
-
resp = self._stub.GetSummary(get_summary)
|
108
|
-
except grpc.RpcError as e:
|
109
|
-
logger.info(f"GET SUMMARY TIMEOUT: {e}")
|
110
|
-
resp = pb.GetSummaryResponse()
|
111
|
-
return resp # type: ignore
|
112
|
-
|
113
|
-
def _publish_telemetry(self, telem: tpb.TelemetryRecord) -> None:
|
114
|
-
assert self._stub
|
115
|
-
self._assign(telem)
|
116
|
-
_ = self._stub.Telemetry(telem)
|
117
|
-
|
118
|
-
def _publish_partial_history(
|
119
|
-
self, partial_history: pb.PartialHistoryRequest
|
120
|
-
) -> None:
|
121
|
-
assert self._stub
|
122
|
-
self._assign(partial_history)
|
123
|
-
_ = self._stub.PartialLog(partial_history)
|
124
|
-
|
125
|
-
def _publish_history(self, history: pb.HistoryRecord) -> None:
|
126
|
-
assert self._stub
|
127
|
-
self._assign(history)
|
128
|
-
_ = self._stub.Log(history)
|
129
|
-
|
130
|
-
def _publish_preempting(self, preempt_rec: pb.RunPreemptingRecord) -> None:
|
131
|
-
assert self._stub
|
132
|
-
self._assign(preempt_rec)
|
133
|
-
_ = self._stub.RunPreempting(preempt_rec)
|
134
|
-
|
135
|
-
def _publish_output(self, outdata: pb.OutputRecord) -> None:
|
136
|
-
assert self._stub
|
137
|
-
self._assign(outdata)
|
138
|
-
_ = self._stub.Output(outdata)
|
139
|
-
|
140
|
-
def _publish_output_raw(self, outdata: pb.OutputRawRecord) -> None:
|
141
|
-
assert self._stub
|
142
|
-
self._assign(outdata)
|
143
|
-
_ = self._stub.OutputRaw(outdata)
|
144
|
-
|
145
|
-
def _communicate_shutdown(self) -> None:
|
146
|
-
assert self._stub
|
147
|
-
shutdown = pb.ShutdownRequest()
|
148
|
-
self._assign(shutdown)
|
149
|
-
_ = self._stub.Shutdown(shutdown)
|
150
|
-
|
151
|
-
def _communicate_run_start(
|
152
|
-
self, run_start: pb.RunStartRequest
|
153
|
-
) -> Optional[pb.RunStartResponse]:
|
154
|
-
assert self._stub
|
155
|
-
self._assign(run_start)
|
156
|
-
try:
|
157
|
-
run_start_response = self._stub.RunStart(run_start)
|
158
|
-
except grpc.RpcError as e:
|
159
|
-
logger.info(f"RUNSTART TIMEOUT: {e}")
|
160
|
-
run_start_response = pb.RunStartResponse()
|
161
|
-
return run_start_response # type: ignore
|
162
|
-
|
163
|
-
def _publish_files(self, files: pb.FilesRecord) -> None:
|
164
|
-
assert self._stub
|
165
|
-
self._assign(files)
|
166
|
-
_ = self._stub.Files(files)
|
167
|
-
|
168
|
-
def _publish_artifact(self, proto_artifact: pb.ArtifactRecord) -> None:
|
169
|
-
assert self._stub
|
170
|
-
self._assign(proto_artifact)
|
171
|
-
_ = self._stub.Artifact(proto_artifact)
|
172
|
-
|
173
|
-
def _publish_link_artifact(self, link_artifact: pb.LinkArtifactRecord) -> None:
|
174
|
-
assert self._stub
|
175
|
-
self._assign(link_artifact)
|
176
|
-
_ = self._stub.LinkArtifact(link_artifact)
|
177
|
-
|
178
|
-
def _publish_use_artifact(self, use_artifact: pb.UseArtifactRecord) -> None:
|
179
|
-
assert self._stub
|
180
|
-
self._assign(use_artifact)
|
181
|
-
_ = self._stub.UseArtifact(use_artifact)
|
182
|
-
|
183
|
-
def _communicate_artifact(
|
184
|
-
self, log_artifact: pb.LogArtifactRequest
|
185
|
-
) -> MessageFuture:
|
186
|
-
art_send = pb.ArtifactSendRequest()
|
187
|
-
art_send.artifact.CopyFrom(log_artifact.artifact)
|
188
|
-
|
189
|
-
assert self._stub
|
190
|
-
self._assign(art_send)
|
191
|
-
art_send_resp = self._stub.ArtifactSend(art_send)
|
192
|
-
|
193
|
-
xid = art_send_resp.xid
|
194
|
-
future = MessageFuturePoll(self._future_poll_artifact, xid)
|
195
|
-
return future
|
196
|
-
|
197
|
-
def _future_poll_artifact(self, xid: str) -> Optional[pb.Result]:
|
198
|
-
art_poll = pb.ArtifactPollRequest(xid=xid)
|
199
|
-
|
200
|
-
assert self._stub
|
201
|
-
self._assign(art_poll)
|
202
|
-
art_poll_resp = self._stub.ArtifactPoll(art_poll)
|
203
|
-
|
204
|
-
if not art_poll_resp.ready:
|
205
|
-
return None
|
206
|
-
|
207
|
-
# emulate log_artifact response for old _communicate_artifact() protocol
|
208
|
-
result = pb.Result()
|
209
|
-
result.response.log_artifact_response.artifact_id = art_poll_resp.artifact_id
|
210
|
-
result.response.log_artifact_response.error_message = (
|
211
|
-
art_poll_resp.error_message
|
212
|
-
)
|
213
|
-
return result
|
214
|
-
|
215
|
-
def _communicate_artifact_send(
|
216
|
-
self, art_send: pb.ArtifactSendRequest
|
217
|
-
) -> Optional[pb.ArtifactSendResponse]:
|
218
|
-
# NOTE: Not used in grpc interface now
|
219
|
-
raise NotImplementedError
|
220
|
-
|
221
|
-
def _communicate_artifact_poll(
|
222
|
-
self, art_send: pb.ArtifactPollRequest
|
223
|
-
) -> Optional[pb.ArtifactPollResponse]:
|
224
|
-
# NOTE: Not used in grpc interface now
|
225
|
-
raise NotImplementedError
|
226
|
-
|
227
|
-
def _publish_artifact_done(self, artifact_done: pb.ArtifactDoneRequest) -> None:
|
228
|
-
# NOTE: Not used in grpc interface now
|
229
|
-
raise NotImplementedError
|
230
|
-
|
231
|
-
def _communicate_status(
|
232
|
-
self, status: pb.StatusRequest
|
233
|
-
) -> Optional[pb.StatusResponse]:
|
234
|
-
assert self._stub
|
235
|
-
self._assign(status)
|
236
|
-
status_response = self._stub.Status(status)
|
237
|
-
return status_response # type: ignore
|
238
|
-
|
239
|
-
def _communicate_network_status(
|
240
|
-
self, status: pb.NetworkStatusRequest
|
241
|
-
) -> Optional[pb.NetworkStatusResponse]:
|
242
|
-
assert self._stub
|
243
|
-
self._assign(status)
|
244
|
-
# TODO: implement
|
245
|
-
return None
|
246
|
-
|
247
|
-
def _deliver_network_status(self, status: pb.NetworkStatusRequest) -> MailboxHandle:
|
248
|
-
assert self._stub
|
249
|
-
self._assign(status)
|
250
|
-
network_status_response = pb.NetworkStatusResponse()
|
251
|
-
response = pb.Response(network_status_response=network_status_response)
|
252
|
-
result = pb.Result(response=response)
|
253
|
-
handle = self._deliver(result)
|
254
|
-
return handle
|
255
|
-
|
256
|
-
def _deliver_stop_status(self, status: pb.StopStatusRequest) -> MailboxHandle:
|
257
|
-
assert self._stub
|
258
|
-
self._assign(status)
|
259
|
-
stop_status_response = pb.StopStatusResponse()
|
260
|
-
response = pb.Response(stop_status_response=stop_status_response)
|
261
|
-
result = pb.Result(response=response)
|
262
|
-
handle = self._deliver(result)
|
263
|
-
return handle
|
264
|
-
|
265
|
-
def _communicate_stop_status(
|
266
|
-
self, status: pb.StopStatusRequest
|
267
|
-
) -> Optional[pb.StopStatusResponse]:
|
268
|
-
assert self._stub
|
269
|
-
self._assign(status)
|
270
|
-
# TODO: implement
|
271
|
-
return None
|
272
|
-
|
273
|
-
def _publish_alert(self, alert: pb.AlertRecord) -> None:
|
274
|
-
assert self._stub
|
275
|
-
self._assign(alert)
|
276
|
-
_ = self._stub.Alert(alert)
|
277
|
-
|
278
|
-
def _publish_tbdata(self, tbrecord: pb.TBRecord) -> None:
|
279
|
-
assert self._stub
|
280
|
-
self._assign(tbrecord)
|
281
|
-
_ = self._stub.TBSend(tbrecord)
|
282
|
-
|
283
|
-
def _publish_exit(self, exit_data: pb.RunExitRecord) -> None:
|
284
|
-
assert self._stub
|
285
|
-
self._assign(exit_data)
|
286
|
-
_ = self._stub.RunExit(exit_data)
|
287
|
-
return None
|
288
|
-
|
289
|
-
def _communicate_poll_exit(
|
290
|
-
self, poll_exit: pb.PollExitRequest
|
291
|
-
) -> Optional[pb.PollExitResponse]:
|
292
|
-
assert self._stub
|
293
|
-
self._assign(poll_exit)
|
294
|
-
try:
|
295
|
-
ret = self._stub.PollExit(poll_exit)
|
296
|
-
except grpc.RpcError as e:
|
297
|
-
logger.info(f"POLL EXIT TIMEOUT: {e}")
|
298
|
-
ret = pb.PollExitResponse()
|
299
|
-
return ret # type: ignore
|
300
|
-
|
301
|
-
def _publish_keepalive(self, keepalive: pb.KeepaliveRequest) -> None:
|
302
|
-
assert self._stub
|
303
|
-
self._assign(keepalive)
|
304
|
-
_ = self._stub.Keepalive(keepalive)
|
305
|
-
return None
|
306
|
-
|
307
|
-
def _communicate_server_info(
|
308
|
-
self, server_info: pb.ServerInfoRequest
|
309
|
-
) -> Optional[pb.ServerInfoResponse]:
|
310
|
-
assert self._stub
|
311
|
-
self._assign(server_info)
|
312
|
-
ret = self._stub.ServerInfo(server_info)
|
313
|
-
return ret # type: ignore
|
314
|
-
|
315
|
-
def _communicate_sampled_history(
|
316
|
-
self, sampled_history: pb.SampledHistoryRequest
|
317
|
-
) -> Optional[pb.SampledHistoryResponse]:
|
318
|
-
assert self._stub
|
319
|
-
self._assign(sampled_history)
|
320
|
-
ret = self._stub.SampledHistory(sampled_history)
|
321
|
-
return ret # type: ignore
|
322
|
-
|
323
|
-
def _publish_header(self, header: pb.HeaderRecord) -> None:
|
324
|
-
assert self._stub
|
325
|
-
# TODO: implement?
|
326
|
-
|
327
|
-
def _publish_pause(self, pause: pb.PauseRequest) -> None:
|
328
|
-
assert self._stub
|
329
|
-
self._assign(pause)
|
330
|
-
_ = self._stub.Pause(pause)
|
331
|
-
|
332
|
-
def _publish_resume(self, resume: pb.ResumeRequest) -> None:
|
333
|
-
assert self._stub
|
334
|
-
self._assign(resume)
|
335
|
-
_ = self._stub.Resume(resume)
|
336
|
-
|
337
|
-
def _deliver(self, result: pb.Result) -> MailboxHandle:
|
338
|
-
# TODO: rework grpc implementation to be asynchronous?
|
339
|
-
# for now we will just emulate the mailbox protocol
|
340
|
-
handle = self._mailbox.get_handle()
|
341
|
-
mailbox_slot = handle.address
|
342
|
-
result.control.mailbox_slot = mailbox_slot
|
343
|
-
self._mailbox.deliver(result)
|
344
|
-
return handle
|
345
|
-
|
346
|
-
def _deliver_run(self, run: pb.RunRecord) -> MailboxHandle:
|
347
|
-
assert self._stub
|
348
|
-
self._assign(run)
|
349
|
-
run_result = self._stub.RunUpdate(run)
|
350
|
-
result = pb.Result(run_result=run_result)
|
351
|
-
handle = self._deliver(result)
|
352
|
-
return handle
|
353
|
-
|
354
|
-
def _deliver_check_version(
|
355
|
-
self, check_version: pb.CheckVersionRequest
|
356
|
-
) -> MailboxHandle:
|
357
|
-
assert self._stub
|
358
|
-
self._assign(check_version)
|
359
|
-
check_version_response = self._stub.CheckVersion(check_version)
|
360
|
-
response = pb.Response(check_version_response=check_version_response)
|
361
|
-
result = pb.Result(response=response)
|
362
|
-
handle = self._deliver(result)
|
363
|
-
return handle
|
364
|
-
|
365
|
-
def _deliver_attach(self, attach: pb.AttachRequest) -> MailboxHandle:
|
366
|
-
assert self._stub
|
367
|
-
self._assign(attach)
|
368
|
-
attach_response = self._stub.Attach(attach)
|
369
|
-
response = pb.Response(attach_response=attach_response)
|
370
|
-
result = pb.Result(response=response)
|
371
|
-
handle = self._deliver(result)
|
372
|
-
return handle
|
373
|
-
|
374
|
-
def _deliver_get_summary(self, get_summary: pb.GetSummaryRequest) -> MailboxHandle:
|
375
|
-
assert self._stub
|
376
|
-
self._assign(get_summary)
|
377
|
-
try:
|
378
|
-
get_summary_response = self._stub.GetSummary(get_summary)
|
379
|
-
except grpc.RpcError as e:
|
380
|
-
logger.info(f"GET SUMMARY TIMEOUT: {e}")
|
381
|
-
get_summary_response = pb.GetSummaryResponse()
|
382
|
-
response = pb.Response(get_summary_response=get_summary_response)
|
383
|
-
result = pb.Result(response=response)
|
384
|
-
handle = self._deliver(result)
|
385
|
-
return handle
|
386
|
-
|
387
|
-
def _deliver_exit(self, run_exit: pb.RunExitRecord) -> MailboxHandle:
|
388
|
-
assert self._stub
|
389
|
-
self._assign(run_exit)
|
390
|
-
exit_result = self._stub.RunExit(run_exit)
|
391
|
-
result = pb.Result(exit_result=exit_result)
|
392
|
-
handle = self._deliver(result)
|
393
|
-
return handle
|
394
|
-
|
395
|
-
def _deliver_poll_exit(self, poll_exit: pb.PollExitRequest) -> MailboxHandle:
|
396
|
-
assert self._stub
|
397
|
-
self._assign(poll_exit)
|
398
|
-
poll_exit_response = self._stub.PollExit(poll_exit)
|
399
|
-
response = pb.Response(poll_exit_response=poll_exit_response)
|
400
|
-
result = pb.Result(response=response)
|
401
|
-
handle = self._deliver(result)
|
402
|
-
return handle
|
403
|
-
|
404
|
-
def _deliver_request_server_info(
|
405
|
-
self, server_info: pb.ServerInfoRequest
|
406
|
-
) -> MailboxHandle:
|
407
|
-
assert self._stub
|
408
|
-
self._assign(server_info)
|
409
|
-
server_info_response = self._stub.ServerInfo(server_info)
|
410
|
-
response = pb.Response(server_info_response=server_info_response)
|
411
|
-
result = pb.Result(response=response)
|
412
|
-
handle = self._deliver(result)
|
413
|
-
return handle
|
414
|
-
|
415
|
-
def _deliver_request_sampled_history(
|
416
|
-
self, sampled_history: pb.SampledHistoryRequest
|
417
|
-
) -> MailboxHandle:
|
418
|
-
assert self._stub
|
419
|
-
self._assign(sampled_history)
|
420
|
-
sampled_history_response = self._stub.SampledHistory(sampled_history)
|
421
|
-
response = pb.Response(sampled_history_response=sampled_history_response)
|
422
|
-
result = pb.Result(response=response)
|
423
|
-
handle = self._deliver(result)
|
424
|
-
return handle
|
425
|
-
|
426
|
-
def _deliver_request_run_status(
|
427
|
-
self, run_status: pb.RunStatusRequest
|
428
|
-
) -> MailboxHandle:
|
429
|
-
assert self._stub
|
430
|
-
self._assign(run_status)
|
431
|
-
run_status_response = self._stub.RunStatus(run_status)
|
432
|
-
response = pb.Response(run_status_response=run_status_response)
|
433
|
-
result = pb.Result(response=response)
|
434
|
-
handle = self._deliver(result)
|
435
|
-
return handle
|
436
|
-
|
437
|
-
def _deliver_run_start(self, run_start: pb.RunStartRequest) -> MailboxHandle:
|
438
|
-
assert self._stub
|
439
|
-
self._assign(run_start)
|
440
|
-
try:
|
441
|
-
run_start_response = self._stub.RunStart(run_start)
|
442
|
-
except grpc.RpcError as e:
|
443
|
-
logger.info(f"RUNSTART TIMEOUT: {e}")
|
444
|
-
run_start_response = pb.RunStartResponse()
|
445
|
-
response = pb.Response(run_start_response=run_start_response)
|
446
|
-
result = pb.Result(response=response)
|
447
|
-
handle = self._deliver(result)
|
448
|
-
return handle
|
449
|
-
|
450
|
-
def _deliver_request_job_info(self, job_info: pb.JobInfoRequest) -> MailboxHandle:
|
451
|
-
assert self._stub
|
452
|
-
self._assign(job_info)
|
453
|
-
job_info_response = self._stub.JobInfo(job_info)
|
454
|
-
response = pb.Response(job_info_response=job_info_response)
|
455
|
-
result = pb.Result(response=response)
|
456
|
-
handle = self._deliver(result)
|
457
|
-
return handle
|
458
|
-
|
459
|
-
def join(self) -> None:
|
460
|
-
super().join()
|