wandb 0.21.0__py3-none-win_amd64.whl → 0.21.1__py3-none-win_amd64.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 +16 -14
- wandb/__init__.pyi +427 -450
- wandb/agents/pyagent.py +41 -12
- wandb/analytics/sentry.py +7 -2
- wandb/apis/importers/mlflow.py +1 -1
- wandb/apis/public/__init__.py +1 -1
- wandb/apis/public/api.py +526 -360
- wandb/apis/public/artifacts.py +204 -8
- wandb/apis/public/automations.py +19 -3
- wandb/apis/public/files.py +172 -33
- wandb/apis/public/history.py +67 -15
- wandb/apis/public/integrations.py +25 -2
- wandb/apis/public/jobs.py +90 -2
- wandb/apis/public/projects.py +130 -79
- wandb/apis/public/query_generator.py +11 -1
- wandb/apis/public/registries/registries_search.py +7 -15
- wandb/apis/public/reports.py +83 -5
- wandb/apis/public/runs.py +299 -105
- wandb/apis/public/sweeps.py +222 -22
- wandb/apis/public/teams.py +41 -4
- wandb/apis/public/users.py +45 -4
- wandb/beta/workflows.py +66 -30
- wandb/bin/gpu_stats.exe +0 -0
- wandb/bin/wandb-core +0 -0
- wandb/cli/cli.py +80 -1
- wandb/env.py +8 -0
- wandb/errors/errors.py +4 -1
- wandb/integration/lightning/fabric/logger.py +3 -4
- wandb/integration/metaflow/__init__.py +6 -0
- wandb/integration/metaflow/data_pandas.py +74 -0
- wandb/integration/metaflow/errors.py +13 -0
- wandb/integration/metaflow/metaflow.py +205 -190
- wandb/integration/openai/fine_tuning.py +1 -2
- wandb/jupyter.py +5 -5
- wandb/plot/custom_chart.py +30 -7
- wandb/proto/v3/wandb_internal_pb2.py +280 -280
- wandb/proto/v3/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v4/wandb_internal_pb2.py +280 -280
- wandb/proto/v4/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v5/wandb_internal_pb2.py +280 -280
- wandb/proto/v5/wandb_telemetry_pb2.py +4 -4
- wandb/proto/v6/wandb_internal_pb2.py +280 -280
- wandb/proto/v6/wandb_telemetry_pb2.py +4 -4
- wandb/proto/wandb_deprecated.py +6 -0
- wandb/sdk/artifacts/_internal_artifact.py +19 -8
- wandb/sdk/artifacts/_validators.py +8 -0
- wandb/sdk/artifacts/artifact.py +106 -75
- wandb/sdk/data_types/audio.py +38 -10
- wandb/sdk/data_types/base_types/media.py +6 -56
- wandb/sdk/data_types/graph.py +48 -14
- wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +1 -3
- wandb/sdk/data_types/helper_types/image_mask.py +1 -3
- wandb/sdk/data_types/histogram.py +34 -21
- wandb/sdk/data_types/html.py +35 -12
- wandb/sdk/data_types/image.py +104 -68
- wandb/sdk/data_types/molecule.py +32 -19
- wandb/sdk/data_types/object_3d.py +36 -17
- wandb/sdk/data_types/plotly.py +18 -5
- wandb/sdk/data_types/saved_model.py +4 -6
- wandb/sdk/data_types/table.py +59 -30
- wandb/sdk/data_types/video.py +53 -26
- wandb/sdk/integration_utils/auto_logging.py +2 -2
- wandb/sdk/internal/internal_api.py +6 -0
- wandb/sdk/internal/job_builder.py +6 -0
- wandb/sdk/launch/agent/agent.py +8 -1
- wandb/sdk/launch/agent/run_queue_item_file_saver.py +2 -2
- wandb/sdk/launch/create_job.py +3 -1
- wandb/sdk/launch/inputs/internal.py +3 -4
- wandb/sdk/launch/inputs/schema.py +1 -0
- wandb/sdk/launch/runner/kubernetes_monitor.py +1 -0
- wandb/sdk/launch/runner/kubernetes_runner.py +328 -1
- wandb/sdk/launch/sweeps/scheduler.py +2 -3
- wandb/sdk/lib/asyncio_compat.py +3 -0
- wandb/sdk/lib/deprecate.py +1 -7
- wandb/sdk/lib/disabled.py +1 -1
- wandb/sdk/lib/hashutil.py +14 -1
- wandb/sdk/lib/module.py +7 -13
- wandb/sdk/lib/progress.py +0 -19
- wandb/sdk/lib/sock_client.py +0 -4
- wandb/sdk/wandb_init.py +66 -91
- wandb/sdk/wandb_login.py +18 -14
- wandb/sdk/wandb_metric.py +2 -0
- wandb/sdk/wandb_run.py +406 -414
- wandb/sdk/wandb_settings.py +130 -2
- wandb/sdk/wandb_setup.py +28 -28
- wandb/sdk/wandb_sweep.py +14 -13
- wandb/sdk/wandb_watch.py +4 -6
- wandb/sync/sync.py +10 -0
- wandb/util.py +57 -0
- wandb/wandb_run.py +1 -2
- {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/METADATA +1 -1
- {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/RECORD +95 -95
- wandb/vendor/pynvml/__init__.py +0 -0
- wandb/vendor/pynvml/pynvml.py +0 -4779
- {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/WHEEL +0 -0
- {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/entry_points.txt +0 -0
- {wandb-0.21.0.dist-info → wandb-0.21.1.dist-info}/licenses/LICENSE +0 -0
wandb/apis/public/artifacts.py
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
"""Public API
|
1
|
+
"""W&B Public API for Artifact objects.
|
2
|
+
|
3
|
+
This module provides classes for interacting with W&B artifacts and their
|
4
|
+
collections.
|
5
|
+
"""
|
2
6
|
|
3
7
|
from __future__ import annotations
|
4
8
|
|
@@ -67,6 +71,11 @@ if TYPE_CHECKING:
|
|
67
71
|
|
68
72
|
|
69
73
|
class ArtifactTypes(Paginator["ArtifactType"]):
|
74
|
+
"""An lazy iterator of `ArtifactType` objects for a specific project.
|
75
|
+
|
76
|
+
<!-- lazydoc-ignore-init: internal -->
|
77
|
+
"""
|
78
|
+
|
70
79
|
QUERY = gql(PROJECT_ARTIFACT_TYPES_GQL)
|
71
80
|
|
72
81
|
last_response: ArtifactTypesFragment | None
|
@@ -101,25 +110,45 @@ class ArtifactTypes(Paginator["ArtifactType"]):
|
|
101
110
|
|
102
111
|
@property
|
103
112
|
def _length(self) -> None:
|
113
|
+
"""Returns `None`.
|
114
|
+
|
115
|
+
<!-- lazydoc-ignore: internal -->
|
116
|
+
"""
|
104
117
|
# TODO
|
105
118
|
return None
|
106
119
|
|
107
120
|
@property
|
108
121
|
def more(self) -> bool:
|
122
|
+
"""Returns whether there are more artifact types to fetch.
|
123
|
+
|
124
|
+
<!-- lazydoc-ignore: internal -->
|
125
|
+
"""
|
109
126
|
if self.last_response is None:
|
110
127
|
return True
|
111
128
|
return self.last_response.page_info.has_next_page
|
112
129
|
|
113
130
|
@property
|
114
131
|
def cursor(self) -> str | None:
|
132
|
+
"""Returns the cursor for the next page of results.
|
133
|
+
|
134
|
+
<!-- lazydoc-ignore: internal -->
|
135
|
+
"""
|
115
136
|
if self.last_response is None:
|
116
137
|
return None
|
117
138
|
return self.last_response.edges[-1].cursor
|
118
139
|
|
119
140
|
def update_variables(self) -> None:
|
141
|
+
"""Update the cursor variable for pagination.
|
142
|
+
|
143
|
+
<!-- lazydoc-ignore: internal -->
|
144
|
+
"""
|
120
145
|
self.variables.update({"cursor": self.cursor})
|
121
146
|
|
122
147
|
def convert_objects(self) -> list[ArtifactType]:
|
148
|
+
"""Convert the raw response data into a list of ArtifactType objects.
|
149
|
+
|
150
|
+
<!-- lazydoc-ignore: internal -->
|
151
|
+
"""
|
123
152
|
if self.last_response is None:
|
124
153
|
return []
|
125
154
|
|
@@ -137,6 +166,19 @@ class ArtifactTypes(Paginator["ArtifactType"]):
|
|
137
166
|
|
138
167
|
|
139
168
|
class ArtifactType:
|
169
|
+
"""An artifact object that satisfies query based on the specified type.
|
170
|
+
|
171
|
+
Args:
|
172
|
+
client: The client instance to use for querying W&B.
|
173
|
+
entity: The entity (user or team) that owns the project.
|
174
|
+
project: The name of the project to query for artifact types.
|
175
|
+
type_name: The name of the artifact type.
|
176
|
+
attrs: Optional mapping of attributes to initialize the artifact type. If not provided,
|
177
|
+
the object will load its attributes from W&B upon initialization.
|
178
|
+
|
179
|
+
<!-- lazydoc-ignore-init: internal -->
|
180
|
+
"""
|
181
|
+
|
140
182
|
def __init__(
|
141
183
|
self,
|
142
184
|
client: Client,
|
@@ -154,6 +196,10 @@ class ArtifactType:
|
|
154
196
|
self.load()
|
155
197
|
|
156
198
|
def load(self) -> Mapping[str, Any]:
|
199
|
+
"""Load the artifact type attributes from W&B.
|
200
|
+
|
201
|
+
<!-- lazydoc-ignore: internal -->
|
202
|
+
"""
|
157
203
|
data: Mapping[str, Any] | None = self.client.execute(
|
158
204
|
gql(PROJECT_ARTIFACT_TYPE_GQL),
|
159
205
|
variable_values={
|
@@ -171,18 +217,30 @@ class ArtifactType:
|
|
171
217
|
|
172
218
|
@property
|
173
219
|
def id(self) -> str:
|
220
|
+
"""The unique identifier of the artifact type."""
|
174
221
|
return self._attrs["id"]
|
175
222
|
|
176
223
|
@property
|
177
224
|
def name(self) -> str:
|
225
|
+
"""The name of the artifact type."""
|
178
226
|
return self._attrs["name"]
|
179
227
|
|
180
228
|
@normalize_exceptions
|
181
229
|
def collections(self, per_page: int = 50) -> ArtifactCollections:
|
182
|
-
"""
|
230
|
+
"""Get all artifact collections associated with this artifact type.
|
231
|
+
|
232
|
+
Args:
|
233
|
+
per_page (int): The number of artifact collections to fetch per page.
|
234
|
+
Default is 50.
|
235
|
+
"""
|
183
236
|
return ArtifactCollections(self.client, self.entity, self.project, self.type)
|
184
237
|
|
185
238
|
def collection(self, name: str) -> ArtifactCollection:
|
239
|
+
"""Get a specific artifact collection by name.
|
240
|
+
|
241
|
+
Args:
|
242
|
+
name (str): The name of the artifact collection to retrieve.
|
243
|
+
"""
|
186
244
|
return ArtifactCollection(
|
187
245
|
self.client, self.entity, self.project, name, self.type
|
188
246
|
)
|
@@ -192,6 +250,18 @@ class ArtifactType:
|
|
192
250
|
|
193
251
|
|
194
252
|
class ArtifactCollections(SizedPaginator["ArtifactCollection"]):
|
253
|
+
"""Artifact collections of a specific type in a project.
|
254
|
+
|
255
|
+
Args:
|
256
|
+
client: The client instance to use for querying W&B.
|
257
|
+
entity: The entity (user or team) that owns the project.
|
258
|
+
project: The name of the project to query for artifact collections.
|
259
|
+
type_name: The name of the artifact type for which to fetch collections.
|
260
|
+
per_page: The number of artifact collections to fetch per page. Default is 50.
|
261
|
+
|
262
|
+
<!-- lazydoc-ignore-init: internal -->
|
263
|
+
"""
|
264
|
+
|
195
265
|
last_response: ArtifactCollectionsFragment | None
|
196
266
|
|
197
267
|
def __init__(
|
@@ -241,29 +311,48 @@ class ArtifactCollections(SizedPaginator["ArtifactCollection"]):
|
|
241
311
|
|
242
312
|
@property
|
243
313
|
def _length(self) -> int:
|
314
|
+
"""Returns the total number of artifact collections.
|
315
|
+
|
316
|
+
<!-- lazydoc-ignore: internal -->
|
317
|
+
"""
|
244
318
|
if self.last_response is None:
|
245
319
|
self._load_page()
|
246
320
|
return self.last_response.total_count
|
247
321
|
|
248
322
|
@property
|
249
323
|
def more(self):
|
324
|
+
"""Returns whether there are more artifacts to fetch.
|
325
|
+
|
326
|
+
<!-- lazydoc-ignore: internal -->
|
327
|
+
"""
|
250
328
|
if self.last_response is None:
|
251
329
|
return True
|
252
330
|
return self.last_response.page_info.has_next_page
|
253
331
|
|
254
332
|
@property
|
255
333
|
def cursor(self):
|
334
|
+
"""Returns the cursor for the next page of results.
|
335
|
+
|
336
|
+
<!-- lazydoc-ignore: internal -->
|
337
|
+
"""
|
256
338
|
if self.last_response is None:
|
257
339
|
return None
|
258
340
|
return self.last_response.edges[-1].cursor
|
259
341
|
|
260
342
|
def update_variables(self) -> None:
|
343
|
+
"""Update the cursor variable for pagination.
|
344
|
+
|
345
|
+
<!-- lazydoc-ignore: internal -->
|
346
|
+
"""
|
261
347
|
self.variables.update({"cursor": self.cursor})
|
262
348
|
|
263
349
|
def convert_objects(self) -> list[ArtifactCollection]:
|
350
|
+
"""Convert the raw response data into a list of ArtifactCollection objects.
|
351
|
+
|
352
|
+
<!-- lazydoc-ignore: internal -->
|
353
|
+
"""
|
264
354
|
if self.last_response is None:
|
265
355
|
return []
|
266
|
-
|
267
356
|
return [
|
268
357
|
ArtifactCollection(
|
269
358
|
client=self.client,
|
@@ -278,6 +367,22 @@ class ArtifactCollections(SizedPaginator["ArtifactCollection"]):
|
|
278
367
|
|
279
368
|
|
280
369
|
class ArtifactCollection:
|
370
|
+
"""An artifact collection that represents a group of related artifacts.
|
371
|
+
|
372
|
+
Args:
|
373
|
+
client: The client instance to use for querying W&B.
|
374
|
+
entity: The entity (user or team) that owns the project.
|
375
|
+
project: The name of the project to query for artifact collections.
|
376
|
+
name: The name of the artifact collection.
|
377
|
+
type: The type of the artifact collection (e.g., "dataset", "model").
|
378
|
+
organization: Optional organization name if applicable.
|
379
|
+
attrs: Optional mapping of attributes to initialize the artifact collection.
|
380
|
+
If not provided, the object will load its attributes from W&B upon
|
381
|
+
initialization.
|
382
|
+
|
383
|
+
<!-- lazydoc-ignore-init: internal -->
|
384
|
+
"""
|
385
|
+
|
281
386
|
def __init__(
|
282
387
|
self,
|
283
388
|
client: Client,
|
@@ -310,11 +415,12 @@ class ArtifactCollection:
|
|
310
415
|
|
311
416
|
@property
|
312
417
|
def id(self) -> str:
|
418
|
+
"""The unique identifier of the artifact collection."""
|
313
419
|
return self._attrs["id"]
|
314
420
|
|
315
421
|
@normalize_exceptions
|
316
422
|
def artifacts(self, per_page: int = 50) -> Artifacts:
|
317
|
-
"""
|
423
|
+
"""Get all artifacts in the collection."""
|
318
424
|
return Artifacts(
|
319
425
|
client=self.client,
|
320
426
|
entity=self.entity,
|
@@ -331,9 +437,14 @@ class ArtifactCollection:
|
|
331
437
|
|
332
438
|
@property
|
333
439
|
def created_at(self) -> str:
|
440
|
+
"""The creation date of the artifact collection."""
|
334
441
|
return self._created_at
|
335
442
|
|
336
443
|
def load(self):
|
444
|
+
"""Load the artifact collection attributes from W&B.
|
445
|
+
|
446
|
+
<!-- lazydoc-ignore: internal -->
|
447
|
+
"""
|
337
448
|
if server_supports_artifact_collections_gql_edges(self.client):
|
338
449
|
rename_fields = None
|
339
450
|
else:
|
@@ -425,6 +536,7 @@ class ArtifactCollection:
|
|
425
536
|
|
426
537
|
@description.setter
|
427
538
|
def description(self, description: str | None) -> None:
|
539
|
+
"""Set the description of the artifact collection."""
|
428
540
|
self._description = description
|
429
541
|
|
430
542
|
@property
|
@@ -434,6 +546,7 @@ class ArtifactCollection:
|
|
434
546
|
|
435
547
|
@tags.setter
|
436
548
|
def tags(self, tags: list[str]) -> None:
|
549
|
+
"""Set the tags associated with the artifact collection."""
|
437
550
|
if any(not re.match(r"^[-\w]+([ ]+[-\w]+)*$", tag) for tag in tags):
|
438
551
|
raise ValueError(
|
439
552
|
"Tags must only contain alphanumeric characters or underscores separated by spaces or hyphens"
|
@@ -447,15 +560,17 @@ class ArtifactCollection:
|
|
447
560
|
|
448
561
|
@name.setter
|
449
562
|
def name(self, name: str) -> None:
|
563
|
+
"""Set the name of the artifact collection."""
|
450
564
|
self._name = validate_artifact_name(name)
|
451
565
|
|
452
566
|
@property
|
453
567
|
def type(self):
|
454
|
-
"""
|
568
|
+
"""Returns the type of the artifact collection."""
|
455
569
|
return self._type
|
456
570
|
|
457
571
|
@type.setter
|
458
572
|
def type(self, type: list[str]) -> None:
|
573
|
+
"""Set the type of the artifact collection."""
|
459
574
|
if not self.is_sequence():
|
460
575
|
raise ValueError(
|
461
576
|
"Type can only be changed if the artifact collection is a sequence."
|
@@ -543,9 +658,23 @@ class ArtifactCollection:
|
|
543
658
|
|
544
659
|
|
545
660
|
class Artifacts(SizedPaginator["Artifact"]):
|
546
|
-
"""An iterable collection of artifact versions associated with a project
|
547
|
-
|
548
|
-
|
661
|
+
"""An iterable collection of artifact versions associated with a project.
|
662
|
+
|
663
|
+
Optionally pass in filters to narrow down the results based on specific criteria.
|
664
|
+
|
665
|
+
Args:
|
666
|
+
client: The client instance to use for querying W&B.
|
667
|
+
entity: The entity (user or team) that owns the project.
|
668
|
+
project: The name of the project to query for artifacts.
|
669
|
+
collection_name: The name of the artifact collection to query.
|
670
|
+
type: The type of the artifacts to query. Common examples include
|
671
|
+
"dataset" or "model".
|
672
|
+
filters: Optional mapping of filters to apply to the query.
|
673
|
+
order: Optional string to specify the order of the results.
|
674
|
+
per_page: The number of artifact versions to fetch per page. Default is 50.
|
675
|
+
tags: Optional string or list of strings to filter artifacts by tags.
|
676
|
+
|
677
|
+
<!-- lazydoc-ignore-init: internal -->
|
549
678
|
"""
|
550
679
|
|
551
680
|
last_response: ArtifactsFragment | None
|
@@ -609,23 +738,39 @@ class Artifacts(SizedPaginator["Artifact"]):
|
|
609
738
|
|
610
739
|
@property
|
611
740
|
def _length(self) -> int:
|
741
|
+
"""Returns the total number of artifacts in the collection.
|
742
|
+
|
743
|
+
<!-- lazydoc-ignore: internal -->
|
744
|
+
"""
|
612
745
|
if self.last_response is None:
|
613
746
|
self._load_page()
|
614
747
|
return self.last_response.total_count
|
615
748
|
|
616
749
|
@property
|
617
750
|
def more(self) -> bool:
|
751
|
+
"""Returns whether there are more files to fetch.
|
752
|
+
|
753
|
+
<!-- lazydoc-ignore: internal -->
|
754
|
+
"""
|
618
755
|
if self.last_response is None:
|
619
756
|
return True
|
620
757
|
return self.last_response.page_info.has_next_page
|
621
758
|
|
622
759
|
@property
|
623
760
|
def cursor(self) -> str | None:
|
761
|
+
"""Returns the cursor for the next page of results.
|
762
|
+
|
763
|
+
<!-- lazydoc-ignore: internal -->
|
764
|
+
"""
|
624
765
|
if self.last_response is None:
|
625
766
|
return None
|
626
767
|
return self.last_response.edges[-1].cursor
|
627
768
|
|
628
769
|
def convert_objects(self) -> list[Artifact]:
|
770
|
+
"""Convert the raw response data into a list of wandb.Artifact objects.
|
771
|
+
|
772
|
+
<!-- lazydoc-ignore: internal -->
|
773
|
+
"""
|
629
774
|
if self.last_response is None:
|
630
775
|
return []
|
631
776
|
|
@@ -645,6 +790,11 @@ class Artifacts(SizedPaginator["Artifact"]):
|
|
645
790
|
|
646
791
|
|
647
792
|
class RunArtifacts(SizedPaginator["Artifact"]):
|
793
|
+
"""An iterable collection of artifacts associated with a specific run.
|
794
|
+
|
795
|
+
<!-- lazydoc-ignore-init: internal -->
|
796
|
+
"""
|
797
|
+
|
648
798
|
last_response: (
|
649
799
|
RunOutputArtifactsProjectRunOutputArtifacts
|
650
800
|
| RunInputArtifactsProjectRunInputArtifacts
|
@@ -699,23 +849,39 @@ class RunArtifacts(SizedPaginator["Artifact"]):
|
|
699
849
|
|
700
850
|
@property
|
701
851
|
def _length(self) -> int:
|
852
|
+
"""Returns the total number of artifacts in the collection.
|
853
|
+
|
854
|
+
<!-- lazydoc-ignore: internal -->
|
855
|
+
"""
|
702
856
|
if self.last_response is None:
|
703
857
|
self._load_page()
|
704
858
|
return self.last_response.total_count
|
705
859
|
|
706
860
|
@property
|
707
861
|
def more(self) -> bool:
|
862
|
+
"""Returns whether there are more artifacts to fetch.
|
863
|
+
|
864
|
+
<!-- lazydoc-ignore: internal -->
|
865
|
+
"""
|
708
866
|
if self.last_response is None:
|
709
867
|
return True
|
710
868
|
return self.last_response.page_info.has_next_page
|
711
869
|
|
712
870
|
@property
|
713
871
|
def cursor(self) -> str | None:
|
872
|
+
"""Returns the cursor for the next page of results.
|
873
|
+
|
874
|
+
<!-- lazydoc-ignore: internal -->
|
875
|
+
"""
|
714
876
|
if self.last_response is None:
|
715
877
|
return None
|
716
878
|
return self.last_response.edges[-1].cursor
|
717
879
|
|
718
880
|
def convert_objects(self) -> list[Artifact]:
|
881
|
+
"""Convert the raw response data into a list of wandb.Artifact objects.
|
882
|
+
|
883
|
+
<!-- lazydoc-ignore: internal -->
|
884
|
+
"""
|
719
885
|
if self.last_response is None:
|
720
886
|
return []
|
721
887
|
|
@@ -735,6 +901,11 @@ class RunArtifacts(SizedPaginator["Artifact"]):
|
|
735
901
|
|
736
902
|
|
737
903
|
class ArtifactFiles(SizedPaginator["public.File"]):
|
904
|
+
"""A paginator for files in an artifact.
|
905
|
+
|
906
|
+
<!-- lazydoc-ignore-init: internal -->
|
907
|
+
"""
|
908
|
+
|
738
909
|
last_response: FilesFragment | None
|
739
910
|
|
740
911
|
def __init__(
|
@@ -796,30 +967,51 @@ class ArtifactFiles(SizedPaginator["public.File"]):
|
|
796
967
|
|
797
968
|
@property
|
798
969
|
def path(self) -> list[str]:
|
970
|
+
"""Returns the path of the artifact."""
|
799
971
|
return [self.artifact.entity, self.artifact.project, self.artifact.name]
|
800
972
|
|
801
973
|
@property
|
802
974
|
def _length(self) -> int:
|
803
975
|
if self.last_response is None:
|
804
976
|
self._load_page()
|
977
|
+
"""Returns the total number of files in the artifact.
|
978
|
+
|
979
|
+
<!-- lazydoc-ignore: internal -->
|
980
|
+
"""
|
805
981
|
return self.artifact.file_count
|
806
982
|
|
807
983
|
@property
|
808
984
|
def more(self) -> bool:
|
985
|
+
"""Returns whether there are more files to fetch.
|
986
|
+
|
987
|
+
<!-- lazydoc-ignore: internal -->
|
988
|
+
"""
|
809
989
|
if self.last_response is None:
|
810
990
|
return True
|
811
991
|
return self.last_response.page_info.has_next_page
|
812
992
|
|
813
993
|
@property
|
814
994
|
def cursor(self) -> str | None:
|
995
|
+
"""Returns the cursor for the next page of results.
|
996
|
+
|
997
|
+
<!-- lazydoc-ignore: internal -->
|
998
|
+
"""
|
815
999
|
if self.last_response is None:
|
816
1000
|
return None
|
817
1001
|
return self.last_response.edges[-1].cursor
|
818
1002
|
|
819
1003
|
def update_variables(self) -> None:
|
1004
|
+
"""Update the variables dictionary with the cursor.
|
1005
|
+
|
1006
|
+
<!-- lazydoc-ignore: internal -->
|
1007
|
+
"""
|
820
1008
|
self.variables.update({"fileLimit": self.per_page, "fileCursor": self.cursor})
|
821
1009
|
|
822
1010
|
def convert_objects(self) -> list[public.File]:
|
1011
|
+
"""Convert the raw response data into a list of public.File objects.
|
1012
|
+
|
1013
|
+
<!-- lazydoc-ignore: internal -->
|
1014
|
+
"""
|
823
1015
|
if self.last_response is None:
|
824
1016
|
return []
|
825
1017
|
|
@@ -840,6 +1032,10 @@ class ArtifactFiles(SizedPaginator["public.File"]):
|
|
840
1032
|
def server_supports_artifact_collections_gql_edges(
|
841
1033
|
client: RetryingClient, warn: bool = False
|
842
1034
|
) -> bool:
|
1035
|
+
"""Check if W&B server supports GraphQL edges for artifact collections.
|
1036
|
+
|
1037
|
+
<!-- lazydoc-ignore-function: internal -->
|
1038
|
+
"""
|
843
1039
|
# TODO: Validate this version
|
844
1040
|
# Edges were merged into core on Mar 2, 2022: https://github.com/wandb/core/commit/81c90b29eaacfe0a96dc1ebd83c53560ca763e8b
|
845
1041
|
# CLI version was bumped to "0.12.11" on Mar 3, 2022: https://github.com/wandb/core/commit/328396fa7c89a2178d510a1be9c0d4451f350d7b
|
wandb/apis/public/automations.py
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
"""W&B Public API for Automation objects."""
|
2
|
+
|
1
3
|
from __future__ import annotations
|
2
4
|
|
3
5
|
from itertools import chain
|
@@ -15,6 +17,11 @@ if TYPE_CHECKING:
|
|
15
17
|
|
16
18
|
|
17
19
|
class Automations(Paginator["Automation"]):
|
20
|
+
"""An lazy iterator of `Automation` objects.
|
21
|
+
|
22
|
+
<!-- lazydoc-ignore-init: internal -->
|
23
|
+
"""
|
24
|
+
|
18
25
|
last_response: ProjectConnectionFields | None
|
19
26
|
_query: Document
|
20
27
|
|
@@ -32,14 +39,20 @@ class Automations(Paginator["Automation"]):
|
|
32
39
|
|
33
40
|
@property
|
34
41
|
def more(self) -> bool:
|
35
|
-
"""Whether there are more items to fetch.
|
42
|
+
"""Whether there are more items to fetch.
|
43
|
+
|
44
|
+
<!-- lazydoc-ignore: internal -->
|
45
|
+
"""
|
36
46
|
if self.last_response is None:
|
37
47
|
return True
|
38
48
|
return self.last_response.page_info.has_next_page
|
39
49
|
|
40
50
|
@property
|
41
51
|
def cursor(self) -> str | None:
|
42
|
-
"""The start cursor to use for the next page.
|
52
|
+
"""The start cursor to use for the next page.
|
53
|
+
|
54
|
+
<!-- lazydoc-ignore: internal -->
|
55
|
+
"""
|
43
56
|
if self.last_response is None:
|
44
57
|
return None
|
45
58
|
return self.last_response.page_info.end_cursor
|
@@ -59,7 +72,10 @@ class Automations(Paginator["Automation"]):
|
|
59
72
|
raise ValueError("Unexpected response data") from e
|
60
73
|
|
61
74
|
def convert_objects(self) -> Iterable[Automation]:
|
62
|
-
"""Parse the page data into a list of objects.
|
75
|
+
"""Parse the page data into a list of objects.
|
76
|
+
|
77
|
+
<!-- lazydoc-ignore: internal -->
|
78
|
+
"""
|
63
79
|
from wandb.automations import Automation
|
64
80
|
|
65
81
|
page = self.last_response
|