wandb 0.19.6rc4__py3-none-any.whl → 0.19.8__py3-none-any.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.
Files changed (81) hide show
  1. wandb/__init__.py +1 -1
  2. wandb/__init__.pyi +56 -6
  3. wandb/apis/public/_generated/__init__.py +21 -0
  4. wandb/apis/public/_generated/base.py +128 -0
  5. wandb/apis/public/_generated/enums.py +4 -0
  6. wandb/apis/public/_generated/input_types.py +4 -0
  7. wandb/apis/public/_generated/operations.py +15 -0
  8. wandb/apis/public/_generated/server_features_query.py +27 -0
  9. wandb/apis/public/_generated/typing_compat.py +14 -0
  10. wandb/apis/public/api.py +192 -6
  11. wandb/apis/public/artifacts.py +13 -45
  12. wandb/apis/public/registries.py +573 -0
  13. wandb/apis/public/utils.py +36 -0
  14. wandb/bin/gpu_stats +0 -0
  15. wandb/cli/cli.py +11 -20
  16. wandb/data_types.py +1 -1
  17. wandb/env.py +10 -0
  18. wandb/filesync/dir_watcher.py +2 -1
  19. wandb/proto/v3/wandb_internal_pb2.py +243 -222
  20. wandb/proto/v3/wandb_server_pb2.py +4 -4
  21. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  22. wandb/proto/v3/wandb_telemetry_pb2.py +10 -10
  23. wandb/proto/v4/wandb_internal_pb2.py +226 -222
  24. wandb/proto/v4/wandb_server_pb2.py +4 -4
  25. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  26. wandb/proto/v4/wandb_telemetry_pb2.py +10 -10
  27. wandb/proto/v5/wandb_internal_pb2.py +226 -222
  28. wandb/proto/v5/wandb_server_pb2.py +4 -4
  29. wandb/proto/v5/wandb_settings_pb2.py +2 -2
  30. wandb/proto/v5/wandb_telemetry_pb2.py +10 -10
  31. wandb/sdk/artifacts/_graphql_fragments.py +126 -0
  32. wandb/sdk/artifacts/artifact.py +51 -95
  33. wandb/sdk/backend/backend.py +17 -6
  34. wandb/sdk/data_types/helper_types/bounding_boxes_2d.py +14 -6
  35. wandb/sdk/data_types/helper_types/image_mask.py +12 -6
  36. wandb/sdk/data_types/saved_model.py +35 -46
  37. wandb/sdk/data_types/video.py +7 -16
  38. wandb/sdk/interface/interface.py +87 -49
  39. wandb/sdk/interface/interface_queue.py +5 -15
  40. wandb/sdk/interface/interface_relay.py +7 -22
  41. wandb/sdk/interface/interface_shared.py +65 -136
  42. wandb/sdk/interface/interface_sock.py +3 -21
  43. wandb/sdk/interface/router.py +42 -68
  44. wandb/sdk/interface/router_queue.py +13 -11
  45. wandb/sdk/interface/router_relay.py +26 -13
  46. wandb/sdk/interface/router_sock.py +12 -16
  47. wandb/sdk/internal/handler.py +4 -3
  48. wandb/sdk/internal/internal_api.py +12 -1
  49. wandb/sdk/internal/sender.py +3 -19
  50. wandb/sdk/lib/apikey.py +87 -26
  51. wandb/sdk/lib/asyncio_compat.py +210 -0
  52. wandb/sdk/lib/console_capture.py +172 -0
  53. wandb/sdk/lib/progress.py +78 -16
  54. wandb/sdk/lib/redirect.py +102 -76
  55. wandb/sdk/lib/service_connection.py +37 -17
  56. wandb/sdk/lib/sock_client.py +6 -56
  57. wandb/sdk/mailbox/__init__.py +23 -0
  58. wandb/sdk/mailbox/mailbox.py +135 -0
  59. wandb/sdk/mailbox/mailbox_handle.py +127 -0
  60. wandb/sdk/mailbox/response_handle.py +167 -0
  61. wandb/sdk/mailbox/wait_with_progress.py +135 -0
  62. wandb/sdk/service/server_sock.py +9 -3
  63. wandb/sdk/service/streams.py +75 -78
  64. wandb/sdk/verify/verify.py +54 -2
  65. wandb/sdk/wandb_init.py +72 -75
  66. wandb/sdk/wandb_login.py +7 -4
  67. wandb/sdk/wandb_metadata.py +65 -34
  68. wandb/sdk/wandb_require.py +14 -8
  69. wandb/sdk/wandb_run.py +90 -97
  70. wandb/sdk/wandb_settings.py +10 -4
  71. wandb/sdk/wandb_setup.py +19 -8
  72. wandb/sdk/wandb_sync.py +2 -10
  73. wandb/util.py +3 -1
  74. {wandb-0.19.6rc4.dist-info → wandb-0.19.8.dist-info}/METADATA +2 -2
  75. {wandb-0.19.6rc4.dist-info → wandb-0.19.8.dist-info}/RECORD +78 -65
  76. wandb/sdk/interface/message_future.py +0 -27
  77. wandb/sdk/interface/message_future_poll.py +0 -50
  78. wandb/sdk/lib/mailbox.py +0 -442
  79. {wandb-0.19.6rc4.dist-info → wandb-0.19.8.dist-info}/WHEEL +0 -0
  80. {wandb-0.19.6rc4.dist-info → wandb-0.19.8.dist-info}/entry_points.txt +0 -0
  81. {wandb-0.19.6rc4.dist-info → wandb-0.19.8.dist-info}/licenses/LICENSE +0 -0
@@ -1,8 +1,11 @@
1
1
  import re
2
2
  from enum import Enum
3
+ from typing import Optional
3
4
  from urllib.parse import urlparse
4
5
 
6
+ from wandb._iterutils import one
5
7
  from wandb.sdk.artifacts._validators import is_artifact_registry_project
8
+ from wandb.sdk.internal.internal_api import Api as InternalApi
6
9
 
7
10
 
8
11
  def parse_s3_url_to_s3_uri(url) -> str:
@@ -66,3 +69,36 @@ def parse_org_from_registry_path(path: str, path_type: PathType) -> str:
66
69
  if is_artifact_registry_project(project):
67
70
  return org
68
71
  return ""
72
+
73
+
74
+ def fetch_org_from_settings_or_entity(
75
+ settings: dict, default_entity: Optional[str] = None
76
+ ) -> str:
77
+ """Fetch the org from either the settings or deriving it from the entity.
78
+
79
+ Returns the org from the settings if available. If no org is passed in or set, the entity is used to fetch the org.
80
+
81
+ Args:
82
+ organization (str | None): The organization to fetch the org for.
83
+ settings (dict): The settings to fetch the org for.
84
+ default_entity (str | None): The default entity to fetch the org for.
85
+ """
86
+ if (organization := settings.get("organization")) is None:
87
+ # Fetch the org via the Entity. Won't work if default entity is a personal entity and belongs to multiple orgs
88
+ entity = settings.get("entity") or default_entity
89
+ if entity is None:
90
+ raise ValueError(
91
+ "No entity specified and can't fetch organization from the entity"
92
+ )
93
+ entity_orgs = InternalApi()._fetch_orgs_and_org_entities_from_entity(entity)
94
+ entity_org = one(
95
+ entity_orgs,
96
+ too_short=ValueError(
97
+ "No organizations found for entity. Please specify an organization in the settings."
98
+ ),
99
+ too_long=ValueError(
100
+ "Multiple organizations found for entity. Please specify an organization in the settings."
101
+ ),
102
+ )
103
+ organization = entity_org.display_name
104
+ return organization
wandb/bin/gpu_stats CHANGED
Binary file
wandb/cli/cli.py CHANGED
@@ -241,32 +241,21 @@ def login(key, host, cloud, relogin, anonymously, verify, no_offline=False):
241
241
  wandb_sdk.wandb_login._handle_host_wandb_setting(host, cloud)
242
242
  # A change in click or the test harness means key can be none...
243
243
  key = key[0] if key is not None and len(key) > 0 else None
244
- if key:
245
- relogin = True
244
+ relogin = True if key or relogin else False
246
245
 
247
- login_settings = dict(
248
- x_cli_only_mode=True,
249
- x_disable_viewer=relogin and not verify,
250
- anonymous=anon_mode,
251
- base_url=host,
252
- )
253
-
254
- try:
255
- wandb.setup(
256
- settings=wandb.Settings(
257
- **{k: v for k, v in login_settings.items() if v is not None}
258
- )
246
+ wandb.setup(
247
+ settings=wandb.Settings(
248
+ x_cli_only_mode=True,
249
+ x_disable_viewer=relogin and not verify,
259
250
  )
260
- except TypeError as e:
261
- wandb.termerror(str(e))
262
- sys.exit(1)
251
+ )
263
252
 
264
253
  wandb.login(
265
- relogin=relogin,
266
- key=key,
267
254
  anonymous=anon_mode,
268
- host=host,
269
255
  force=True,
256
+ host=host,
257
+ key=key,
258
+ relogin=relogin,
270
259
  verify=verify,
271
260
  )
272
261
 
@@ -2805,11 +2794,13 @@ def verify(host):
2805
2794
  wandb_verify.check_wandb_version(api)
2806
2795
  check_run_success = wandb_verify.check_run(api)
2807
2796
  check_artifacts_success = wandb_verify.check_artifacts()
2797
+ check_sweeps_success = wandb_verify.check_sweeps(api)
2808
2798
  if not (
2809
2799
  check_artifacts_success
2810
2800
  and check_run_success
2811
2801
  and large_post_success
2812
2802
  and url_success
2803
+ and check_sweeps_success
2813
2804
  ):
2814
2805
  sys.exit(1)
2815
2806
 
wandb/data_types.py CHANGED
@@ -6,7 +6,7 @@ flexible containers for information, like tables and HTML, and more.
6
6
  For more on logging media, see [our guide](https://docs.wandb.com/guides/track/log/media)
7
7
 
8
8
  For more on logging structured data for interactive dataset and model analysis,
9
- see [our guide to W&B Tables](https://docs.wandb.com/guides/tables/).
9
+ see [our guide to W&B Tables](https://docs.wandb.com/guides/models/tables/).
10
10
 
11
11
  All of these special data types are subclasses of WBValue. All the data types
12
12
  serialize to JSON, since that is what wandb uses to save the objects locally
wandb/env.py CHANGED
@@ -34,6 +34,7 @@ USERNAME = "WANDB_USERNAME"
34
34
  USER_EMAIL = "WANDB_USER_EMAIL"
35
35
  PROJECT = "WANDB_PROJECT"
36
36
  ENTITY = "WANDB_ENTITY"
37
+ ORGANIZATION = "WANDB_ORGANIZATION"
37
38
  BASE_URL = "WANDB_BASE_URL"
38
39
  APP_URL = "WANDB_APP_URL"
39
40
  PROGRAM = "WANDB_PROGRAM"
@@ -284,6 +285,15 @@ def get_entity(
284
285
  return env.get(ENTITY, default)
285
286
 
286
287
 
288
+ def get_organization(
289
+ default: str | None = None, env: MutableMapping | None = None
290
+ ) -> str | None:
291
+ if env is None:
292
+ env = os.environ
293
+
294
+ return env.get(ORGANIZATION, default)
295
+
296
+
287
297
  def get_base_url(
288
298
  default: str | None = None, env: MutableMapping | None = None
289
299
  ) -> str | None:
@@ -233,6 +233,7 @@ class DirWatcher:
233
233
  self._savename_file_policies[save_name] = policy
234
234
  else:
235
235
  self._user_file_policies[policy].add(path)
236
+
236
237
  for src_path in glob.glob(os.path.join(self._dir, path)):
237
238
  save_name = LogicalPath(os.path.relpath(src_path, self._dir))
238
239
  feh = self._get_file_event_handler(src_path, save_name)
@@ -285,7 +286,7 @@ class DirWatcher:
285
286
  # return LogicalPath(os.path.relpath(path, self._dir))
286
287
 
287
288
  def _on_file_modified(self, event: "wd_events.FileModifiedEvent") -> None:
288
- logger.info(f"file/dir modified: { event.src_path}")
289
+ logger.info(f"file/dir modified: {event.src_path}")
289
290
  if os.path.isdir(event.src_path):
290
291
  return None
291
292
  save_name = LogicalPath(os.path.relpath(event.src_path, self._dir))