wandb 0.22.2__py3-none-win_arm64.whl → 0.22.3__py3-none-win_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- wandb/__init__.py +1 -1
- wandb/__init__.pyi +2 -2
- wandb/_pydantic/__init__.py +8 -1
- wandb/_pydantic/base.py +54 -18
- wandb/_pydantic/field_types.py +8 -3
- wandb/_pydantic/pagination.py +46 -0
- wandb/_pydantic/utils.py +2 -2
- wandb/apis/public/api.py +24 -19
- wandb/apis/public/artifacts.py +259 -270
- wandb/apis/public/registries/_utils.py +40 -54
- wandb/apis/public/registries/registries_search.py +70 -85
- wandb/apis/public/registries/registry.py +173 -156
- wandb/apis/public/runs.py +27 -6
- wandb/apis/public/utils.py +43 -20
- wandb/automations/_generated/create_automation.py +2 -2
- wandb/automations/_generated/create_generic_webhook_integration.py +4 -4
- wandb/automations/_generated/delete_automation.py +2 -2
- wandb/automations/_generated/fragments.py +31 -52
- wandb/automations/_generated/generic_webhook_integrations_by_entity.py +3 -3
- wandb/automations/_generated/get_automations.py +3 -3
- wandb/automations/_generated/get_automations_by_entity.py +3 -3
- wandb/automations/_generated/input_types.py +9 -9
- wandb/automations/_generated/integrations_by_entity.py +3 -3
- wandb/automations/_generated/operations.py +6 -6
- wandb/automations/_generated/slack_integrations_by_entity.py +3 -3
- wandb/automations/_generated/update_automation.py +2 -2
- wandb/automations/_utils.py +3 -3
- wandb/automations/actions.py +3 -3
- wandb/automations/automations.py +6 -5
- wandb/bin/gpu_stats.exe +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/cli/beta.py +8 -2
- wandb/cli/beta_leet.py +2 -1
- wandb/cli/beta_sync.py +1 -1
- wandb/errors/term.py +8 -8
- wandb/jupyter.py +0 -51
- wandb/old/settings.py +6 -6
- wandb/proto/v3/wandb_internal_pb2.py +351 -352
- wandb/proto/v3/wandb_server_pb2.py +38 -37
- wandb/proto/v3/wandb_settings_pb2.py +2 -2
- wandb/proto/v3/wandb_sync_pb2.py +19 -6
- wandb/proto/v4/wandb_internal_pb2.py +351 -352
- wandb/proto/v4/wandb_server_pb2.py +38 -37
- wandb/proto/v4/wandb_settings_pb2.py +2 -2
- wandb/proto/v4/wandb_sync_pb2.py +10 -6
- wandb/proto/v5/wandb_internal_pb2.py +351 -352
- wandb/proto/v5/wandb_server_pb2.py +38 -37
- wandb/proto/v5/wandb_settings_pb2.py +2 -2
- wandb/proto/v5/wandb_sync_pb2.py +10 -6
- wandb/proto/v6/wandb_internal_pb2.py +351 -352
- wandb/proto/v6/wandb_server_pb2.py +38 -37
- wandb/proto/v6/wandb_settings_pb2.py +2 -2
- wandb/proto/v6/wandb_sync_pb2.py +10 -6
- wandb/sdk/artifacts/_generated/__init__.py +96 -40
- wandb/sdk/artifacts/_generated/add_aliases.py +3 -3
- wandb/sdk/artifacts/_generated/add_artifact_collection_tags.py +26 -0
- wandb/sdk/artifacts/_generated/artifact_by_id.py +2 -2
- wandb/sdk/artifacts/_generated/artifact_by_name.py +3 -3
- wandb/sdk/artifacts/_generated/artifact_collection_membership_file_urls.py +27 -8
- wandb/sdk/artifacts/_generated/artifact_collection_membership_files.py +27 -8
- wandb/sdk/artifacts/_generated/artifact_created_by.py +7 -20
- wandb/sdk/artifacts/_generated/artifact_file_urls.py +19 -6
- wandb/sdk/artifacts/_generated/artifact_membership_by_name.py +26 -0
- wandb/sdk/artifacts/_generated/artifact_type.py +5 -5
- wandb/sdk/artifacts/_generated/artifact_used_by.py +8 -17
- wandb/sdk/artifacts/_generated/artifact_version_files.py +19 -8
- wandb/sdk/artifacts/_generated/delete_aliases.py +3 -3
- wandb/sdk/artifacts/_generated/delete_artifact.py +4 -4
- wandb/sdk/artifacts/_generated/delete_artifact_collection_tags.py +23 -0
- wandb/sdk/artifacts/_generated/delete_artifact_portfolio.py +4 -4
- wandb/sdk/artifacts/_generated/delete_artifact_sequence.py +4 -4
- wandb/sdk/artifacts/_generated/delete_registry.py +21 -0
- wandb/sdk/artifacts/_generated/fetch_artifact_manifest.py +8 -20
- wandb/sdk/artifacts/_generated/fetch_linked_artifacts.py +13 -35
- wandb/sdk/artifacts/_generated/fetch_org_info_from_entity.py +28 -0
- wandb/sdk/artifacts/_generated/fetch_registries.py +18 -8
- wandb/sdk/{projects → artifacts}/_generated/fetch_registry.py +4 -4
- wandb/sdk/artifacts/_generated/fragments.py +183 -333
- wandb/sdk/artifacts/_generated/input_types.py +133 -7
- wandb/sdk/artifacts/_generated/link_artifact.py +5 -5
- wandb/sdk/artifacts/_generated/operations.py +1053 -548
- wandb/sdk/artifacts/_generated/project_artifact_collection.py +9 -77
- wandb/sdk/artifacts/_generated/project_artifact_collections.py +21 -9
- wandb/sdk/artifacts/_generated/project_artifact_type.py +3 -3
- wandb/sdk/artifacts/_generated/project_artifact_types.py +19 -6
- wandb/sdk/artifacts/_generated/project_artifacts.py +7 -8
- wandb/sdk/artifacts/_generated/registry_collections.py +21 -9
- wandb/sdk/artifacts/_generated/registry_versions.py +20 -9
- wandb/sdk/artifacts/_generated/rename_registry.py +25 -0
- wandb/sdk/artifacts/_generated/run_input_artifacts.py +5 -9
- wandb/sdk/artifacts/_generated/run_output_artifacts.py +5 -9
- wandb/sdk/artifacts/_generated/type_info.py +2 -2
- wandb/sdk/artifacts/_generated/unlink_artifact.py +3 -5
- wandb/sdk/artifacts/_generated/update_artifact.py +3 -3
- wandb/sdk/artifacts/_generated/update_artifact_collection_type.py +28 -0
- wandb/sdk/artifacts/_generated/update_artifact_portfolio.py +7 -16
- wandb/sdk/artifacts/_generated/update_artifact_sequence.py +7 -16
- wandb/sdk/artifacts/_generated/upsert_registry.py +25 -0
- wandb/sdk/artifacts/_gqlutils.py +170 -6
- wandb/sdk/artifacts/_models/__init__.py +9 -0
- wandb/sdk/artifacts/_models/artifact_collection.py +109 -0
- wandb/sdk/artifacts/_models/manifest.py +26 -0
- wandb/sdk/artifacts/_models/pagination.py +26 -0
- wandb/sdk/artifacts/_models/registry.py +100 -0
- wandb/sdk/artifacts/_validators.py +45 -27
- wandb/sdk/artifacts/artifact.py +220 -215
- wandb/sdk/artifacts/artifact_file_cache.py +1 -1
- wandb/sdk/artifacts/artifact_manifest.py +37 -32
- wandb/sdk/artifacts/artifact_manifest_entry.py +80 -125
- wandb/sdk/artifacts/artifact_manifests/artifact_manifest_v1.py +43 -61
- wandb/sdk/artifacts/storage_handlers/gcs_handler.py +8 -6
- wandb/sdk/data_types/image.py +2 -2
- wandb/sdk/interface/interface.py +72 -64
- wandb/sdk/interface/interface_queue.py +27 -18
- wandb/sdk/interface/interface_shared.py +61 -23
- wandb/sdk/interface/interface_sock.py +9 -5
- wandb/sdk/internal/_generated/server_features_query.py +4 -4
- wandb/sdk/launch/inputs/schema.py +13 -10
- wandb/sdk/lib/apikey.py +8 -12
- wandb/sdk/lib/asyncio_compat.py +1 -1
- wandb/sdk/lib/asyncio_manager.py +5 -5
- wandb/sdk/lib/console_capture.py +38 -30
- wandb/sdk/lib/progress.py +159 -64
- wandb/sdk/lib/retry.py +3 -2
- wandb/sdk/lib/service/service_connection.py +2 -2
- wandb/sdk/lib/wb_logging.py +2 -1
- wandb/sdk/mailbox/mailbox.py +1 -1
- wandb/sdk/wandb_init.py +10 -13
- wandb/sdk/wandb_run.py +9 -46
- wandb/sdk/wandb_settings.py +102 -19
- {wandb-0.22.2.dist-info → wandb-0.22.3.dist-info}/METADATA +2 -1
- {wandb-0.22.2.dist-info → wandb-0.22.3.dist-info}/RECORD +135 -134
- wandb/sdk/artifacts/_generated/artifact_via_membership_by_name.py +0 -26
- wandb/sdk/artifacts/_generated/create_artifact_collection_tag_assignments.py +0 -36
- wandb/sdk/artifacts/_generated/delete_artifact_collection_tag_assignments.py +0 -25
- wandb/sdk/artifacts/_generated/move_artifact_collection.py +0 -35
- wandb/sdk/projects/_generated/__init__.py +0 -26
- wandb/sdk/projects/_generated/delete_project.py +0 -22
- wandb/sdk/projects/_generated/enums.py +0 -4
- wandb/sdk/projects/_generated/fragments.py +0 -41
- wandb/sdk/projects/_generated/input_types.py +0 -13
- wandb/sdk/projects/_generated/operations.py +0 -88
- wandb/sdk/projects/_generated/rename_project.py +0 -27
- wandb/sdk/projects/_generated/upsert_registry_project.py +0 -27
- {wandb-0.22.2.dist-info → wandb-0.22.3.dist-info}/WHEEL +0 -0
- {wandb-0.22.2.dist-info → wandb-0.22.3.dist-info}/entry_points.txt +0 -0
- {wandb-0.22.2.dist-info → wandb-0.22.3.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/interface/interface.py
CHANGED
|
@@ -1,15 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
InterfaceBase: The abstract class
|
|
4
|
-
InterfaceShared: Common routines for socket and queue based implementations
|
|
5
|
-
InterfaceQueue: Use multiprocessing queues to send and receive messages
|
|
6
|
-
InterfaceSock: Use socket to send and receive messages
|
|
7
|
-
"""
|
|
8
|
-
|
|
1
|
+
import abc
|
|
9
2
|
import gzip
|
|
10
3
|
import logging
|
|
11
4
|
import time
|
|
12
|
-
from abc import abstractmethod
|
|
13
5
|
from pathlib import Path
|
|
14
6
|
from secrets import token_hex
|
|
15
7
|
from typing import (
|
|
@@ -86,11 +78,11 @@ def file_enum_to_policy(enum: "pb.FilesItem.PolicyType.V") -> "PolicyName":
|
|
|
86
78
|
return policy
|
|
87
79
|
|
|
88
80
|
|
|
89
|
-
class InterfaceBase:
|
|
90
|
-
"""Methods for sending
|
|
81
|
+
class InterfaceBase(abc.ABC):
|
|
82
|
+
"""Methods for sending run messages (Records) to the service.
|
|
91
83
|
|
|
92
84
|
None of the methods may be called from an asyncio context other than
|
|
93
|
-
deliver_async().
|
|
85
|
+
deliver_async() or those with a `nowait=True` argument.
|
|
94
86
|
"""
|
|
95
87
|
|
|
96
88
|
_drop: bool
|
|
@@ -98,7 +90,7 @@ class InterfaceBase:
|
|
|
98
90
|
def __init__(self) -> None:
|
|
99
91
|
self._drop = False
|
|
100
92
|
|
|
101
|
-
@abstractmethod
|
|
93
|
+
@abc.abstractmethod
|
|
102
94
|
async def deliver_async(
|
|
103
95
|
self,
|
|
104
96
|
record: pb.Record,
|
|
@@ -117,20 +109,19 @@ class InterfaceBase:
|
|
|
117
109
|
Returns:
|
|
118
110
|
A handle to wait for a response to the record.
|
|
119
111
|
"""
|
|
120
|
-
raise NotImplementedError
|
|
121
112
|
|
|
122
113
|
def publish_header(self) -> None:
|
|
123
114
|
header = pb.HeaderRecord()
|
|
124
115
|
self._publish_header(header)
|
|
125
116
|
|
|
126
|
-
@abstractmethod
|
|
117
|
+
@abc.abstractmethod
|
|
127
118
|
def _publish_header(self, header: pb.HeaderRecord) -> None:
|
|
128
119
|
raise NotImplementedError
|
|
129
120
|
|
|
130
121
|
def deliver_status(self) -> MailboxHandle[pb.Result]:
|
|
131
122
|
return self._deliver_status(pb.StatusRequest())
|
|
132
123
|
|
|
133
|
-
@abstractmethod
|
|
124
|
+
@abc.abstractmethod
|
|
134
125
|
def _deliver_status(
|
|
135
126
|
self,
|
|
136
127
|
status: pb.StatusRequest,
|
|
@@ -217,7 +208,7 @@ class InterfaceBase:
|
|
|
217
208
|
run_record = self._make_run(run)
|
|
218
209
|
self._publish_run(run_record)
|
|
219
210
|
|
|
220
|
-
@abstractmethod
|
|
211
|
+
@abc.abstractmethod
|
|
221
212
|
def _publish_run(self, run: pb.RunRecord) -> None:
|
|
222
213
|
raise NotImplementedError
|
|
223
214
|
|
|
@@ -225,7 +216,7 @@ class InterfaceBase:
|
|
|
225
216
|
cancel = pb.CancelRequest(cancel_slot=cancel_slot)
|
|
226
217
|
self._publish_cancel(cancel)
|
|
227
218
|
|
|
228
|
-
@abstractmethod
|
|
219
|
+
@abc.abstractmethod
|
|
229
220
|
def _publish_cancel(self, cancel: pb.CancelRequest) -> None:
|
|
230
221
|
raise NotImplementedError
|
|
231
222
|
|
|
@@ -239,11 +230,11 @@ class InterfaceBase:
|
|
|
239
230
|
|
|
240
231
|
self._publish_config(cfg)
|
|
241
232
|
|
|
242
|
-
@abstractmethod
|
|
233
|
+
@abc.abstractmethod
|
|
243
234
|
def _publish_config(self, cfg: pb.ConfigRecord) -> None:
|
|
244
235
|
raise NotImplementedError
|
|
245
236
|
|
|
246
|
-
@abstractmethod
|
|
237
|
+
@abc.abstractmethod
|
|
247
238
|
def _publish_metric(self, metric: pb.MetricRecord) -> None:
|
|
248
239
|
raise NotImplementedError
|
|
249
240
|
|
|
@@ -349,7 +340,7 @@ class InterfaceBase:
|
|
|
349
340
|
pb_summary_record = self._make_summary(summary_record, run=run)
|
|
350
341
|
self._publish_summary(pb_summary_record)
|
|
351
342
|
|
|
352
|
-
@abstractmethod
|
|
343
|
+
@abc.abstractmethod
|
|
353
344
|
def _publish_summary(self, summary: pb.SummaryRecord) -> None:
|
|
354
345
|
raise NotImplementedError
|
|
355
346
|
|
|
@@ -365,7 +356,7 @@ class InterfaceBase:
|
|
|
365
356
|
files = self._make_files(files_dict)
|
|
366
357
|
self._publish_files(files)
|
|
367
358
|
|
|
368
|
-
@abstractmethod
|
|
359
|
+
@abc.abstractmethod
|
|
369
360
|
def _publish_files(self, files: pb.FilesRecord) -> None:
|
|
370
361
|
raise NotImplementedError
|
|
371
362
|
|
|
@@ -375,7 +366,7 @@ class InterfaceBase:
|
|
|
375
366
|
python_packages.package.add(name=pkg.key, version=pkg.version)
|
|
376
367
|
self._publish_python_packages(python_packages)
|
|
377
368
|
|
|
378
|
-
@abstractmethod
|
|
369
|
+
@abc.abstractmethod
|
|
379
370
|
def _publish_python_packages(
|
|
380
371
|
self, python_packages: pb.PythonPackagesRequest
|
|
381
372
|
) -> None:
|
|
@@ -481,7 +472,7 @@ class InterfaceBase:
|
|
|
481
472
|
|
|
482
473
|
return self._deliver_link_artifact(link_artifact)
|
|
483
474
|
|
|
484
|
-
@abstractmethod
|
|
475
|
+
@abc.abstractmethod
|
|
485
476
|
def _deliver_link_artifact(
|
|
486
477
|
self, link_artifact: pb.LinkArtifactRequest
|
|
487
478
|
) -> MailboxHandle[pb.Result]:
|
|
@@ -588,7 +579,7 @@ class InterfaceBase:
|
|
|
588
579
|
|
|
589
580
|
self._publish_use_artifact(use_artifact)
|
|
590
581
|
|
|
591
|
-
@abstractmethod
|
|
582
|
+
@abc.abstractmethod
|
|
592
583
|
def _publish_use_artifact(self, proto_artifact: pb.UseArtifactRecord) -> None:
|
|
593
584
|
raise NotImplementedError
|
|
594
585
|
|
|
@@ -623,7 +614,7 @@ class InterfaceBase:
|
|
|
623
614
|
resp = self._deliver_artifact(log_artifact)
|
|
624
615
|
return resp
|
|
625
616
|
|
|
626
|
-
@abstractmethod
|
|
617
|
+
@abc.abstractmethod
|
|
627
618
|
def _deliver_artifact(
|
|
628
619
|
self,
|
|
629
620
|
log_artifact: pb.LogArtifactRequest,
|
|
@@ -647,7 +638,7 @@ class InterfaceBase:
|
|
|
647
638
|
resp = self._deliver_download_artifact(download_artifact)
|
|
648
639
|
return resp
|
|
649
640
|
|
|
650
|
-
@abstractmethod
|
|
641
|
+
@abc.abstractmethod
|
|
651
642
|
def _deliver_download_artifact(
|
|
652
643
|
self, download_artifact: pb.DownloadArtifactRequest
|
|
653
644
|
) -> MailboxHandle[pb.Result]:
|
|
@@ -675,7 +666,7 @@ class InterfaceBase:
|
|
|
675
666
|
proto_artifact.tags.extend(tags or [])
|
|
676
667
|
self._publish_artifact(proto_artifact)
|
|
677
668
|
|
|
678
|
-
@abstractmethod
|
|
669
|
+
@abc.abstractmethod
|
|
679
670
|
def _publish_artifact(self, proto_artifact: pb.ArtifactRecord) -> None:
|
|
680
671
|
raise NotImplementedError
|
|
681
672
|
|
|
@@ -686,18 +677,18 @@ class InterfaceBase:
|
|
|
686
677
|
tbrecord.root_dir = root_logdir
|
|
687
678
|
self._publish_tbdata(tbrecord)
|
|
688
679
|
|
|
689
|
-
@abstractmethod
|
|
680
|
+
@abc.abstractmethod
|
|
690
681
|
def _publish_tbdata(self, tbrecord: pb.TBRecord) -> None:
|
|
691
682
|
raise NotImplementedError
|
|
692
683
|
|
|
693
|
-
@abstractmethod
|
|
684
|
+
@abc.abstractmethod
|
|
694
685
|
def _publish_telemetry(self, telem: tpb.TelemetryRecord) -> None:
|
|
695
686
|
raise NotImplementedError
|
|
696
687
|
|
|
697
688
|
def publish_environment(self, environment: pb.EnvironmentRecord) -> None:
|
|
698
689
|
self._publish_environment(environment)
|
|
699
690
|
|
|
700
|
-
@abstractmethod
|
|
691
|
+
@abc.abstractmethod
|
|
701
692
|
def _publish_environment(self, environment: pb.EnvironmentRecord) -> None:
|
|
702
693
|
raise NotImplementedError
|
|
703
694
|
|
|
@@ -730,7 +721,7 @@ class InterfaceBase:
|
|
|
730
721
|
partial_history.action.flush = flush
|
|
731
722
|
self._publish_partial_history(partial_history)
|
|
732
723
|
|
|
733
|
-
@abstractmethod
|
|
724
|
+
@abc.abstractmethod
|
|
734
725
|
def _publish_partial_history(self, history: pb.PartialHistoryRequest) -> None:
|
|
735
726
|
raise NotImplementedError
|
|
736
727
|
|
|
@@ -753,7 +744,7 @@ class InterfaceBase:
|
|
|
753
744
|
item.value_json = json_dumps_safer_history(v)
|
|
754
745
|
self._publish_history(history)
|
|
755
746
|
|
|
756
|
-
@abstractmethod
|
|
747
|
+
@abc.abstractmethod
|
|
757
748
|
def _publish_history(self, history: pb.HistoryRecord) -> None:
|
|
758
749
|
raise NotImplementedError
|
|
759
750
|
|
|
@@ -761,11 +752,17 @@ class InterfaceBase:
|
|
|
761
752
|
preempt_rec = pb.RunPreemptingRecord()
|
|
762
753
|
self._publish_preempting(preempt_rec)
|
|
763
754
|
|
|
764
|
-
@abstractmethod
|
|
755
|
+
@abc.abstractmethod
|
|
765
756
|
def _publish_preempting(self, preempt_rec: pb.RunPreemptingRecord) -> None:
|
|
766
757
|
raise NotImplementedError
|
|
767
758
|
|
|
768
|
-
def publish_output(
|
|
759
|
+
def publish_output(
|
|
760
|
+
self,
|
|
761
|
+
name: str,
|
|
762
|
+
data: str,
|
|
763
|
+
*,
|
|
764
|
+
nowait: bool = False,
|
|
765
|
+
) -> None:
|
|
769
766
|
# from vendor.protobuf import google3.protobuf.timestamp
|
|
770
767
|
# ts = timestamp.Timestamp()
|
|
771
768
|
# ts.GetCurrentTime()
|
|
@@ -779,13 +776,19 @@ class InterfaceBase:
|
|
|
779
776
|
termwarn("unknown type")
|
|
780
777
|
o = pb.OutputRecord(output_type=otype, line=data)
|
|
781
778
|
o.timestamp.GetCurrentTime()
|
|
782
|
-
self._publish_output(o)
|
|
779
|
+
self._publish_output(o, nowait=nowait)
|
|
783
780
|
|
|
784
|
-
@abstractmethod
|
|
785
|
-
def _publish_output(self, outdata: pb.OutputRecord) -> None:
|
|
781
|
+
@abc.abstractmethod
|
|
782
|
+
def _publish_output(self, outdata: pb.OutputRecord, *, nowait: bool) -> None:
|
|
786
783
|
raise NotImplementedError
|
|
787
784
|
|
|
788
|
-
def publish_output_raw(
|
|
785
|
+
def publish_output_raw(
|
|
786
|
+
self,
|
|
787
|
+
name: str,
|
|
788
|
+
data: str,
|
|
789
|
+
*,
|
|
790
|
+
nowait: bool = False,
|
|
791
|
+
) -> None:
|
|
789
792
|
# from vendor.protobuf import google3.protobuf.timestamp
|
|
790
793
|
# ts = timestamp.Timestamp()
|
|
791
794
|
# ts.GetCurrentTime()
|
|
@@ -799,17 +802,22 @@ class InterfaceBase:
|
|
|
799
802
|
termwarn("unknown type")
|
|
800
803
|
o = pb.OutputRawRecord(output_type=otype, line=data)
|
|
801
804
|
o.timestamp.GetCurrentTime()
|
|
802
|
-
self._publish_output_raw(o)
|
|
805
|
+
self._publish_output_raw(o, nowait=nowait)
|
|
803
806
|
|
|
804
|
-
@abstractmethod
|
|
805
|
-
def _publish_output_raw(
|
|
807
|
+
@abc.abstractmethod
|
|
808
|
+
def _publish_output_raw(
|
|
809
|
+
self,
|
|
810
|
+
outdata: pb.OutputRawRecord,
|
|
811
|
+
*,
|
|
812
|
+
nowait: bool,
|
|
813
|
+
) -> None:
|
|
806
814
|
raise NotImplementedError
|
|
807
815
|
|
|
808
816
|
def publish_pause(self) -> None:
|
|
809
817
|
pause = pb.PauseRequest()
|
|
810
818
|
self._publish_pause(pause)
|
|
811
819
|
|
|
812
|
-
@abstractmethod
|
|
820
|
+
@abc.abstractmethod
|
|
813
821
|
def _publish_pause(self, pause: pb.PauseRequest) -> None:
|
|
814
822
|
raise NotImplementedError
|
|
815
823
|
|
|
@@ -817,7 +825,7 @@ class InterfaceBase:
|
|
|
817
825
|
resume = pb.ResumeRequest()
|
|
818
826
|
self._publish_resume(resume)
|
|
819
827
|
|
|
820
|
-
@abstractmethod
|
|
828
|
+
@abc.abstractmethod
|
|
821
829
|
def _publish_resume(self, resume: pb.ResumeRequest) -> None:
|
|
822
830
|
raise NotImplementedError
|
|
823
831
|
|
|
@@ -831,7 +839,7 @@ class InterfaceBase:
|
|
|
831
839
|
proto_alert.wait_duration = wait_duration
|
|
832
840
|
self._publish_alert(proto_alert)
|
|
833
841
|
|
|
834
|
-
@abstractmethod
|
|
842
|
+
@abc.abstractmethod
|
|
835
843
|
def _publish_alert(self, alert: pb.AlertRecord) -> None:
|
|
836
844
|
raise NotImplementedError
|
|
837
845
|
|
|
@@ -845,7 +853,7 @@ class InterfaceBase:
|
|
|
845
853
|
exit_data = self._make_exit(exit_code)
|
|
846
854
|
self._publish_exit(exit_data)
|
|
847
855
|
|
|
848
|
-
@abstractmethod
|
|
856
|
+
@abc.abstractmethod
|
|
849
857
|
def _publish_exit(self, exit_data: pb.RunExitRecord) -> None:
|
|
850
858
|
raise NotImplementedError
|
|
851
859
|
|
|
@@ -853,7 +861,7 @@ class InterfaceBase:
|
|
|
853
861
|
keepalive = pb.KeepaliveRequest()
|
|
854
862
|
self._publish_keepalive(keepalive)
|
|
855
863
|
|
|
856
|
-
@abstractmethod
|
|
864
|
+
@abc.abstractmethod
|
|
857
865
|
def _publish_keepalive(self, keepalive: pb.KeepaliveRequest) -> None:
|
|
858
866
|
raise NotImplementedError
|
|
859
867
|
|
|
@@ -908,7 +916,7 @@ class InterfaceBase:
|
|
|
908
916
|
|
|
909
917
|
return self._publish_job_input(request)
|
|
910
918
|
|
|
911
|
-
@abstractmethod
|
|
919
|
+
@abc.abstractmethod
|
|
912
920
|
def _publish_job_input(
|
|
913
921
|
self, request: pb.JobInputRequest
|
|
914
922
|
) -> MailboxHandle[pb.Result]:
|
|
@@ -918,7 +926,7 @@ class InterfaceBase:
|
|
|
918
926
|
probe_system_info = pb.ProbeSystemInfoRequest()
|
|
919
927
|
return self._publish_probe_system_info(probe_system_info)
|
|
920
928
|
|
|
921
|
-
@abstractmethod
|
|
929
|
+
@abc.abstractmethod
|
|
922
930
|
def _publish_probe_system_info(
|
|
923
931
|
self, probe_system_info: pb.ProbeSystemInfoRequest
|
|
924
932
|
) -> None:
|
|
@@ -942,7 +950,7 @@ class InterfaceBase:
|
|
|
942
950
|
# before a response is read.
|
|
943
951
|
logger.warning("handle abandoned while communicating shutdown")
|
|
944
952
|
|
|
945
|
-
@abstractmethod
|
|
953
|
+
@abc.abstractmethod
|
|
946
954
|
def _deliver_shutdown(self) -> MailboxHandle[pb.Result]:
|
|
947
955
|
raise NotImplementedError
|
|
948
956
|
|
|
@@ -956,13 +964,13 @@ class InterfaceBase:
|
|
|
956
964
|
sync = pb.SyncFinishRequest()
|
|
957
965
|
return self._deliver_finish_sync(sync)
|
|
958
966
|
|
|
959
|
-
@abstractmethod
|
|
967
|
+
@abc.abstractmethod
|
|
960
968
|
def _deliver_finish_sync(
|
|
961
969
|
self, sync: pb.SyncFinishRequest
|
|
962
970
|
) -> MailboxHandle[pb.Result]:
|
|
963
971
|
raise NotImplementedError
|
|
964
972
|
|
|
965
|
-
@abstractmethod
|
|
973
|
+
@abc.abstractmethod
|
|
966
974
|
def _deliver_run(self, run: pb.RunRecord) -> MailboxHandle[pb.Result]:
|
|
967
975
|
raise NotImplementedError
|
|
968
976
|
|
|
@@ -970,7 +978,7 @@ class InterfaceBase:
|
|
|
970
978
|
run_start = pb.RunStartRequest(run=self._make_run(run))
|
|
971
979
|
return self._deliver_run_start(run_start)
|
|
972
980
|
|
|
973
|
-
@abstractmethod
|
|
981
|
+
@abc.abstractmethod
|
|
974
982
|
def _deliver_run_start(
|
|
975
983
|
self, run_start: pb.RunStartRequest
|
|
976
984
|
) -> MailboxHandle[pb.Result]:
|
|
@@ -980,7 +988,7 @@ class InterfaceBase:
|
|
|
980
988
|
attach = pb.AttachRequest(attach_id=attach_id)
|
|
981
989
|
return self._deliver_attach(attach)
|
|
982
990
|
|
|
983
|
-
@abstractmethod
|
|
991
|
+
@abc.abstractmethod
|
|
984
992
|
def _deliver_attach(
|
|
985
993
|
self,
|
|
986
994
|
status: pb.AttachRequest,
|
|
@@ -991,7 +999,7 @@ class InterfaceBase:
|
|
|
991
999
|
status = pb.StopStatusRequest()
|
|
992
1000
|
return self._deliver_stop_status(status)
|
|
993
1001
|
|
|
994
|
-
@abstractmethod
|
|
1002
|
+
@abc.abstractmethod
|
|
995
1003
|
def _deliver_stop_status(
|
|
996
1004
|
self,
|
|
997
1005
|
status: pb.StopStatusRequest,
|
|
@@ -1002,7 +1010,7 @@ class InterfaceBase:
|
|
|
1002
1010
|
status = pb.NetworkStatusRequest()
|
|
1003
1011
|
return self._deliver_network_status(status)
|
|
1004
1012
|
|
|
1005
|
-
@abstractmethod
|
|
1013
|
+
@abc.abstractmethod
|
|
1006
1014
|
def _deliver_network_status(
|
|
1007
1015
|
self,
|
|
1008
1016
|
status: pb.NetworkStatusRequest,
|
|
@@ -1013,7 +1021,7 @@ class InterfaceBase:
|
|
|
1013
1021
|
internal_message = pb.InternalMessagesRequest()
|
|
1014
1022
|
return self._deliver_internal_messages(internal_message)
|
|
1015
1023
|
|
|
1016
|
-
@abstractmethod
|
|
1024
|
+
@abc.abstractmethod
|
|
1017
1025
|
def _deliver_internal_messages(
|
|
1018
1026
|
self, internal_message: pb.InternalMessagesRequest
|
|
1019
1027
|
) -> MailboxHandle[pb.Result]:
|
|
@@ -1023,7 +1031,7 @@ class InterfaceBase:
|
|
|
1023
1031
|
get_summary = pb.GetSummaryRequest()
|
|
1024
1032
|
return self._deliver_get_summary(get_summary)
|
|
1025
1033
|
|
|
1026
|
-
@abstractmethod
|
|
1034
|
+
@abc.abstractmethod
|
|
1027
1035
|
def _deliver_get_summary(
|
|
1028
1036
|
self,
|
|
1029
1037
|
get_summary: pb.GetSummaryRequest,
|
|
@@ -1034,7 +1042,7 @@ class InterfaceBase:
|
|
|
1034
1042
|
get_system_metrics = pb.GetSystemMetricsRequest()
|
|
1035
1043
|
return self._deliver_get_system_metrics(get_system_metrics)
|
|
1036
1044
|
|
|
1037
|
-
@abstractmethod
|
|
1045
|
+
@abc.abstractmethod
|
|
1038
1046
|
def _deliver_get_system_metrics(
|
|
1039
1047
|
self, get_summary: pb.GetSystemMetricsRequest
|
|
1040
1048
|
) -> MailboxHandle[pb.Result]:
|
|
@@ -1044,7 +1052,7 @@ class InterfaceBase:
|
|
|
1044
1052
|
exit_data = self._make_exit(exit_code)
|
|
1045
1053
|
return self._deliver_exit(exit_data)
|
|
1046
1054
|
|
|
1047
|
-
@abstractmethod
|
|
1055
|
+
@abc.abstractmethod
|
|
1048
1056
|
def _deliver_exit(
|
|
1049
1057
|
self,
|
|
1050
1058
|
exit_data: pb.RunExitRecord,
|
|
@@ -1055,7 +1063,7 @@ class InterfaceBase:
|
|
|
1055
1063
|
poll_exit = pb.PollExitRequest()
|
|
1056
1064
|
return self._deliver_poll_exit(poll_exit)
|
|
1057
1065
|
|
|
1058
|
-
@abstractmethod
|
|
1066
|
+
@abc.abstractmethod
|
|
1059
1067
|
def _deliver_poll_exit(
|
|
1060
1068
|
self,
|
|
1061
1069
|
poll_exit: pb.PollExitRequest,
|
|
@@ -1066,7 +1074,7 @@ class InterfaceBase:
|
|
|
1066
1074
|
run_finish_without_exit = pb.RunFinishWithoutExitRequest()
|
|
1067
1075
|
return self._deliver_finish_without_exit(run_finish_without_exit)
|
|
1068
1076
|
|
|
1069
|
-
@abstractmethod
|
|
1077
|
+
@abc.abstractmethod
|
|
1070
1078
|
def _deliver_finish_without_exit(
|
|
1071
1079
|
self, run_finish_without_exit: pb.RunFinishWithoutExitRequest
|
|
1072
1080
|
) -> MailboxHandle[pb.Result]:
|
|
@@ -1076,7 +1084,7 @@ class InterfaceBase:
|
|
|
1076
1084
|
sampled_history = pb.SampledHistoryRequest()
|
|
1077
1085
|
return self._deliver_request_sampled_history(sampled_history)
|
|
1078
1086
|
|
|
1079
|
-
@abstractmethod
|
|
1087
|
+
@abc.abstractmethod
|
|
1080
1088
|
def _deliver_request_sampled_history(
|
|
1081
1089
|
self, sampled_history: pb.SampledHistoryRequest
|
|
1082
1090
|
) -> MailboxHandle[pb.Result]:
|
|
@@ -1086,7 +1094,7 @@ class InterfaceBase:
|
|
|
1086
1094
|
run_status = pb.RunStatusRequest()
|
|
1087
1095
|
return self._deliver_request_run_status(run_status)
|
|
1088
1096
|
|
|
1089
|
-
@abstractmethod
|
|
1097
|
+
@abc.abstractmethod
|
|
1090
1098
|
def _deliver_request_run_status(
|
|
1091
1099
|
self, run_status: pb.RunStatusRequest
|
|
1092
1100
|
) -> MailboxHandle[pb.Result]:
|
|
@@ -1,12 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
See interface.py for how interface classes relate to each other.
|
|
4
|
-
|
|
5
|
-
"""
|
|
1
|
+
from __future__ import annotations
|
|
6
2
|
|
|
7
3
|
import logging
|
|
8
4
|
from multiprocessing.process import BaseProcess
|
|
9
|
-
from typing import TYPE_CHECKING
|
|
5
|
+
from typing import TYPE_CHECKING
|
|
10
6
|
|
|
11
7
|
from typing_extensions import override
|
|
12
8
|
|
|
@@ -23,11 +19,21 @@ logger = logging.getLogger("wandb")
|
|
|
23
19
|
|
|
24
20
|
|
|
25
21
|
class InterfaceQueue(InterfaceShared):
|
|
22
|
+
"""Legacy implementation of InterfaceShared.
|
|
23
|
+
|
|
24
|
+
This was used by legacy-service to pass messages back to itself before
|
|
25
|
+
the existence of wandb-core. It may be removed once legacy-service is
|
|
26
|
+
completely removed (including its use in `wandb sync`).
|
|
27
|
+
|
|
28
|
+
Since it was used by the internal service, it does not implement
|
|
29
|
+
the "deliver" methods, which are only used in the client.
|
|
30
|
+
"""
|
|
31
|
+
|
|
26
32
|
def __init__(
|
|
27
33
|
self,
|
|
28
|
-
record_q:
|
|
29
|
-
result_q:
|
|
30
|
-
process:
|
|
34
|
+
record_q: Queue[pb.Record] | None = None,
|
|
35
|
+
result_q: Queue[pb.Result] | None = None,
|
|
36
|
+
process: BaseProcess | None = None,
|
|
31
37
|
) -> None:
|
|
32
38
|
self.record_q = record_q
|
|
33
39
|
self.result_q = result_q
|
|
@@ -35,16 +41,19 @@ class InterfaceQueue(InterfaceShared):
|
|
|
35
41
|
super().__init__()
|
|
36
42
|
|
|
37
43
|
@override
|
|
38
|
-
|
|
39
|
-
self,
|
|
40
|
-
record: "pb.Record",
|
|
41
|
-
) -> "MailboxHandle[pb.Result]":
|
|
42
|
-
raise NotImplementedError
|
|
43
|
-
|
|
44
|
-
def _publish(self, record: "pb.Record", local: Optional[bool] = None) -> None:
|
|
44
|
+
def _publish(self, record: pb.Record, *, nowait: bool = False) -> None:
|
|
45
45
|
if self._process and not self._process.is_alive():
|
|
46
46
|
raise Exception("The wandb backend process has shutdown")
|
|
47
|
-
if local:
|
|
48
|
-
record.control.local = local
|
|
49
47
|
if self.record_q:
|
|
50
48
|
self.record_q.put(record)
|
|
49
|
+
|
|
50
|
+
@override
|
|
51
|
+
async def deliver_async(
|
|
52
|
+
self,
|
|
53
|
+
record: pb.Record,
|
|
54
|
+
) -> MailboxHandle[pb.Result]:
|
|
55
|
+
raise NotImplementedError
|
|
56
|
+
|
|
57
|
+
@override
|
|
58
|
+
def _deliver(self, record: pb.Record) -> MailboxHandle[pb.Result]:
|
|
59
|
+
raise NotImplementedError
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
See interface.py for how interface classes relate to each other.
|
|
4
|
-
|
|
5
|
-
"""
|
|
6
|
-
|
|
1
|
+
import abc
|
|
7
2
|
import logging
|
|
8
|
-
from abc import abstractmethod
|
|
9
3
|
from typing import Any, Optional, cast
|
|
10
4
|
|
|
5
|
+
from typing_extensions import override
|
|
6
|
+
|
|
11
7
|
from wandb.proto import wandb_internal_pb2 as pb
|
|
12
8
|
from wandb.proto import wandb_telemetry_pb2 as tpb
|
|
13
9
|
from wandb.sdk.mailbox import MailboxHandle
|
|
@@ -18,22 +14,70 @@ from .interface import InterfaceBase
|
|
|
18
14
|
logger = logging.getLogger("wandb")
|
|
19
15
|
|
|
20
16
|
|
|
21
|
-
class InterfaceShared(InterfaceBase):
|
|
17
|
+
class InterfaceShared(InterfaceBase, abc.ABC):
|
|
18
|
+
"""Partially implemented InterfaceBase.
|
|
19
|
+
|
|
20
|
+
There is little reason for this to exist separately from InterfaceBase,
|
|
21
|
+
which itself is not a pure abstract class and has no other direct
|
|
22
|
+
subclasses. Most methods are implemented in this class in terms of the
|
|
23
|
+
protected _publish and _deliver methods defined by subclasses.
|
|
24
|
+
"""
|
|
25
|
+
|
|
22
26
|
def __init__(self) -> None:
|
|
23
27
|
super().__init__()
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
@abc.abstractmethod
|
|
30
|
+
def _publish(
|
|
31
|
+
self,
|
|
32
|
+
record: pb.Record,
|
|
33
|
+
*,
|
|
34
|
+
nowait: bool = False,
|
|
35
|
+
) -> None:
|
|
36
|
+
"""Send a record to the internal service.
|
|
37
|
+
|
|
38
|
+
Args:
|
|
39
|
+
record: The record to send. This method assigns its stream ID.
|
|
40
|
+
nowait: If true, this does not block on socket IO and is safe
|
|
41
|
+
to call in W&B's asyncio thread, but it will also not slow
|
|
42
|
+
down even if the socket is blocked and allow data to accumulate
|
|
43
|
+
in the Python memory.
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
@abc.abstractmethod
|
|
47
|
+
def _deliver(self, record: pb.Record) -> "MailboxHandle[pb.Result]":
|
|
48
|
+
"""Send a record to the internal service and return a response handle.
|
|
49
|
+
|
|
50
|
+
Args:
|
|
51
|
+
record: The record to send. This method assigns its stream ID.
|
|
52
|
+
|
|
53
|
+
Returns:
|
|
54
|
+
A mailbox handle for waiting for a response.
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
@override
|
|
58
|
+
def _publish_output(
|
|
59
|
+
self,
|
|
60
|
+
outdata: pb.OutputRecord,
|
|
61
|
+
*,
|
|
62
|
+
nowait: bool = False,
|
|
63
|
+
) -> None:
|
|
26
64
|
rec = pb.Record()
|
|
27
65
|
rec.output.CopyFrom(outdata)
|
|
28
|
-
self._publish(rec)
|
|
29
|
-
|
|
30
|
-
def _publish_cancel(self, cancel: pb.CancelRequest) -> None:
|
|
31
|
-
rec = self._make_request(cancel=cancel)
|
|
32
|
-
self._publish(rec)
|
|
66
|
+
self._publish(rec, nowait=nowait)
|
|
33
67
|
|
|
34
|
-
|
|
68
|
+
@override
|
|
69
|
+
def _publish_output_raw(
|
|
70
|
+
self,
|
|
71
|
+
outdata: pb.OutputRawRecord,
|
|
72
|
+
*,
|
|
73
|
+
nowait: bool = False,
|
|
74
|
+
) -> None:
|
|
35
75
|
rec = pb.Record()
|
|
36
76
|
rec.output_raw.CopyFrom(outdata)
|
|
77
|
+
self._publish(rec, nowait=nowait)
|
|
78
|
+
|
|
79
|
+
def _publish_cancel(self, cancel: pb.CancelRequest) -> None:
|
|
80
|
+
rec = self._make_request(cancel=cancel)
|
|
37
81
|
self._publish(rec)
|
|
38
82
|
|
|
39
83
|
def _publish_tbdata(self, tbrecord: pb.TBRecord) -> None:
|
|
@@ -258,17 +302,11 @@ class InterfaceShared(InterfaceBase):
|
|
|
258
302
|
raise Exception("Invalid record")
|
|
259
303
|
return record
|
|
260
304
|
|
|
261
|
-
@abstractmethod
|
|
262
|
-
def _publish(self, record: pb.Record, local: Optional[bool] = None) -> None:
|
|
263
|
-
raise NotImplementedError
|
|
264
|
-
|
|
265
|
-
def _deliver(self, record: pb.Record) -> "MailboxHandle[pb.Result]":
|
|
266
|
-
raise NotImplementedError
|
|
267
|
-
|
|
268
305
|
def _publish_defer(self, state: "pb.DeferRequest.DeferState.V") -> None:
|
|
269
306
|
defer = pb.DeferRequest(state=state)
|
|
270
307
|
rec = self._make_request(defer=defer)
|
|
271
|
-
|
|
308
|
+
rec.control.local = True
|
|
309
|
+
self._publish(rec)
|
|
272
310
|
|
|
273
311
|
def publish_defer(self, state: int = 0) -> None:
|
|
274
312
|
self._publish_defer(cast("pb.DeferRequest.DeferState.V", state))
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
-
from typing import TYPE_CHECKING
|
|
4
|
+
from typing import TYPE_CHECKING
|
|
5
5
|
|
|
6
6
|
from typing_extensions import override
|
|
7
7
|
|
|
@@ -31,17 +31,21 @@ class InterfaceSock(InterfaceShared):
|
|
|
31
31
|
self._client = client
|
|
32
32
|
self._stream_id = stream_id
|
|
33
33
|
|
|
34
|
-
def _assign(self, record:
|
|
35
|
-
assert self._stream_id
|
|
34
|
+
def _assign(self, record: pb.Record) -> None:
|
|
36
35
|
record._info.stream_id = self._stream_id
|
|
37
36
|
|
|
38
37
|
@override
|
|
39
|
-
def _publish(self, record: pb.Record,
|
|
38
|
+
def _publish(self, record: pb.Record, *, nowait: bool = False) -> None:
|
|
40
39
|
self._assign(record)
|
|
41
40
|
request = spb.ServerRequest()
|
|
42
41
|
request.record_publish.CopyFrom(record)
|
|
43
|
-
self._asyncer.run(lambda: self._client.publish(request))
|
|
44
42
|
|
|
43
|
+
if nowait:
|
|
44
|
+
self._asyncer.run_soon(lambda: self._client.publish(request))
|
|
45
|
+
else:
|
|
46
|
+
self._asyncer.run(lambda: self._client.publish(request))
|
|
47
|
+
|
|
48
|
+
@override
|
|
45
49
|
def _deliver(self, record: pb.Record) -> MailboxHandle[pb.Result]:
|
|
46
50
|
return self._asyncer.run(lambda: self.deliver_async(record))
|
|
47
51
|
|
|
@@ -7,18 +7,18 @@ from typing import List, Optional
|
|
|
7
7
|
|
|
8
8
|
from pydantic import Field
|
|
9
9
|
|
|
10
|
-
from wandb._pydantic import
|
|
10
|
+
from wandb._pydantic import GQLResult
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
class ServerFeaturesQuery(
|
|
13
|
+
class ServerFeaturesQuery(GQLResult):
|
|
14
14
|
server_info: Optional[ServerFeaturesQueryServerInfo] = Field(alias="serverInfo")
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
class ServerFeaturesQueryServerInfo(
|
|
17
|
+
class ServerFeaturesQueryServerInfo(GQLResult):
|
|
18
18
|
features: List[Optional[ServerFeaturesQueryServerInfoFeatures]]
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
class ServerFeaturesQueryServerInfoFeatures(
|
|
21
|
+
class ServerFeaturesQueryServerInfoFeatures(GQLResult):
|
|
22
22
|
name: str
|
|
23
23
|
is_enabled: bool = Field(alias="isEnabled")
|
|
24
24
|
|