wandb 0.15.10__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.
Files changed (46) hide show
  1. wandb/__init__.py +2 -1
  2. wandb/apis/public.py +51 -9
  3. wandb/apis/reports/blocks.py +1 -0
  4. wandb/cli/cli.py +14 -9
  5. wandb/env.py +11 -1
  6. wandb/integration/xgboost/xgboost.py +3 -3
  7. wandb/proto/v3/wandb_internal_pb2.py +300 -267
  8. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  9. wandb/proto/v3/wandb_telemetry_pb2.py +16 -16
  10. wandb/proto/v4/wandb_internal_pb2.py +260 -252
  11. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  12. wandb/proto/v4/wandb_telemetry_pb2.py +16 -16
  13. wandb/sdk/artifacts/artifact.py +9 -6
  14. wandb/sdk/artifacts/storage_handlers/s3_handler.py +12 -7
  15. wandb/sdk/data_types/image.py +1 -1
  16. wandb/sdk/internal/file_stream.py +2 -1
  17. wandb/sdk/internal/handler.py +24 -20
  18. wandb/sdk/internal/internal_api.py +9 -1
  19. wandb/sdk/internal/sender.py +4 -1
  20. wandb/sdk/internal/system/system_info.py +2 -2
  21. wandb/sdk/launch/__init__.py +5 -0
  22. wandb/sdk/launch/{launch.py → _launch.py} +53 -54
  23. wandb/sdk/launch/{launch_add.py → _launch_add.py} +34 -31
  24. wandb/sdk/launch/agent/agent.py +36 -18
  25. wandb/sdk/launch/agent/run_queue_item_file_saver.py +6 -4
  26. wandb/sdk/launch/runner/abstract.py +0 -2
  27. wandb/sdk/launch/runner/kubernetes_monitor.py +329 -0
  28. wandb/sdk/launch/runner/kubernetes_runner.py +44 -301
  29. wandb/sdk/launch/runner/local_container.py +5 -2
  30. wandb/sdk/launch/sweeps/scheduler.py +14 -10
  31. wandb/sdk/launch/sweeps/utils.py +5 -3
  32. wandb/sdk/launch/utils.py +3 -1
  33. wandb/sdk/lib/_settings_toposort_generated.py +5 -0
  34. wandb/sdk/lib/gql_request.py +3 -0
  35. wandb/sdk/lib/ipython.py +4 -0
  36. wandb/sdk/service/service.py +19 -6
  37. wandb/sdk/wandb_init.py +7 -2
  38. wandb/sdk/wandb_run.py +2 -5
  39. wandb/sdk/wandb_settings.py +48 -2
  40. wandb/util.py +1 -1
  41. {wandb-0.15.10.dist-info → wandb-0.15.11.dist-info}/METADATA +4 -1
  42. {wandb-0.15.10.dist-info → wandb-0.15.11.dist-info}/RECORD +46 -45
  43. {wandb-0.15.10.dist-info → wandb-0.15.11.dist-info}/LICENSE +0 -0
  44. {wandb-0.15.10.dist-info → wandb-0.15.11.dist-info}/WHEEL +0 -0
  45. {wandb-0.15.10.dist-info → wandb-0.15.11.dist-info}/entry_points.txt +0 -0
  46. {wandb-0.15.10.dist-info → wandb-0.15.11.dist-info}/top_level.txt +0 -0
wandb/__init__.py CHANGED
@@ -11,7 +11,8 @@ For scripts and interactive notebooks, see https://github.com/wandb/examples.
11
11
 
12
12
  For reference documentation, see https://docs.wandb.com/ref/python.
13
13
  """
14
- __version__ = "0.15.10"
14
+ __version__ = "0.15.11"
15
+ _minimum_nexus_version = "0.16.0b1"
15
16
 
16
17
  # Used with pypi checks and other messages related to pip
17
18
  _wandb_module = "wandb"
wandb/apis/public.py CHANGED
@@ -395,6 +395,9 @@ class Api:
395
395
  auth = None
396
396
  if not _thread_local_api_settings.cookies:
397
397
  auth = ("api", self.api_key)
398
+ proxies = self.settings.get("_proxies") or json.loads(
399
+ os.environ.get("WANDB__PROXIES", "{}")
400
+ )
398
401
  self._base_client = Client(
399
402
  transport=GraphQLSession(
400
403
  headers={
@@ -409,6 +412,7 @@ class Api:
409
412
  auth=auth,
410
413
  url="%s/graphql" % self.settings["base_url"],
411
414
  cookies=_thread_local_api_settings.cookies,
415
+ proxies=proxies,
412
416
  )
413
417
  )
414
418
  self._client = RetryingClient(self._base_client)
@@ -1992,11 +1996,18 @@ class Run(Attrs):
1992
1996
  withRuns=False,
1993
1997
  )
1994
1998
 
1995
- self._attrs["summaryMetrics"] = (
1996
- json.loads(self._attrs["summaryMetrics"])
1997
- if self._attrs.get("summaryMetrics")
1998
- else {}
1999
- )
1999
+ try:
2000
+ self._attrs["summaryMetrics"] = (
2001
+ json.loads(self._attrs["summaryMetrics"])
2002
+ if self._attrs.get("summaryMetrics")
2003
+ else {}
2004
+ )
2005
+ except json.decoder.JSONDecodeError:
2006
+ # ignore invalid utf-8 or control characters
2007
+ self._attrs["summaryMetrics"] = json.loads(
2008
+ self._attrs["summaryMetrics"],
2009
+ strict=False,
2010
+ )
2000
2011
  self._attrs["systemMetrics"] = (
2001
2012
  json.loads(self._attrs["systemMetrics"])
2002
2013
  if self._attrs.get("systemMetrics")
@@ -2619,8 +2630,6 @@ class QueuedRun:
2619
2630
  def wait_until_running(self):
2620
2631
  if self._run is not None:
2621
2632
  return self._run
2622
- if self.container_job:
2623
- raise LaunchError("Container jobs cannot be waited on")
2624
2633
 
2625
2634
  while True:
2626
2635
  # sleep here to hide an ugly warning
@@ -2672,6 +2681,7 @@ class RunQueue:
2672
2681
  self._default_resource_config = _default_resource_config
2673
2682
  self._type = None
2674
2683
  self._items = None
2684
+ self._id = None
2675
2685
 
2676
2686
  @property
2677
2687
  def name(self):
@@ -2703,6 +2713,12 @@ class RunQueue:
2703
2713
  self._get_default_resource_config()
2704
2714
  return self._default_resource_config
2705
2715
 
2716
+ @property
2717
+ def id(self) -> str:
2718
+ if self._id is None:
2719
+ self._get_metadata()
2720
+ return self._id
2721
+
2706
2722
  @property
2707
2723
  def items(self) -> List[QueuedRun]:
2708
2724
  """Up to the first 100 queued runs. Modifying this list will not modify the queue or any enqueued items!"""
@@ -2711,6 +2727,30 @@ class RunQueue:
2711
2727
  self._get_items()
2712
2728
  return self._items
2713
2729
 
2730
+ @normalize_exceptions
2731
+ def delete(self):
2732
+ """Delete the run queue from the wandb backend."""
2733
+ query = gql(
2734
+ """
2735
+ mutation DeleteRunQueue($id: ID!) {
2736
+ deleteRunQueues(input: {queueIDs: [$id]}) {
2737
+ success
2738
+ clientMutationId
2739
+ }
2740
+ }
2741
+ """
2742
+ )
2743
+ variable_values = {"id": self.id}
2744
+ res = self._client.execute(query, variable_values)
2745
+ if res["deleteRunQueues"]["success"]:
2746
+ self._id = None
2747
+ self._access = None
2748
+ self._default_resource_config_id = None
2749
+ self._default_resource_config = None
2750
+ self._items = None
2751
+ else:
2752
+ raise CommError(f"Failed to delete run queue {self.name}")
2753
+
2714
2754
  def __repr__(self):
2715
2755
  return f"<RunQueue {self._entity}/{self._name}>"
2716
2756
 
@@ -2721,6 +2761,7 @@ class RunQueue:
2721
2761
  query GetRunQueueMetadata($projectName: String!, $entityName: String!, $runQueue: String!) {
2722
2762
  project(name: $projectName, entityName: $entityName) {
2723
2763
  runQueue(name: $runQueue) {
2764
+ id
2724
2765
  access
2725
2766
  defaultResourceConfigID
2726
2767
  }
@@ -2734,6 +2775,7 @@ class RunQueue:
2734
2775
  "runQueue": self._name,
2735
2776
  }
2736
2777
  res = self._client.execute(query, variable_values)
2778
+ self._id = res["project"]["runQueue"]["id"]
2737
2779
  self._access = res["project"]["runQueue"]["access"]
2738
2780
  self._default_resource_config_id = res["project"]["runQueue"][
2739
2781
  "defaultResourceConfigID"
@@ -4830,7 +4872,7 @@ class Job:
4830
4872
  resource_args=None,
4831
4873
  project_queue=None,
4832
4874
  ):
4833
- from wandb.sdk.launch import launch_add
4875
+ from wandb.sdk.launch import _launch_add
4834
4876
 
4835
4877
  run_config = {}
4836
4878
  for key, item in config.items():
@@ -4850,7 +4892,7 @@ class Job:
4850
4892
  if isinstance(assigned_config_type, InvalidType):
4851
4893
  raise TypeError(self._input_types.explain(run_config))
4852
4894
 
4853
- queued_run = launch_add.launch_add(
4895
+ queued_run = _launch_add.launch_add(
4854
4896
  job=self._name,
4855
4897
  config={"overrides": {"run_config": run_config}},
4856
4898
  project=project or self._project,
@@ -23,4 +23,5 @@ from ._blocks import (
23
23
  WeaveBlockArtifact,
24
24
  WeaveBlockArtifactVersionedFile,
25
25
  WeaveBlockSummaryTable,
26
+ Twitter,
26
27
  )
wandb/cli/cli.py CHANGED
@@ -34,8 +34,8 @@ from wandb.apis import InternalApi, PublicApi
34
34
  from wandb.integration.magic import magic_install
35
35
  from wandb.sdk.artifacts.artifacts_cache import get_artifacts_cache
36
36
  from wandb.sdk.launch import utils as launch_utils
37
+ from wandb.sdk.launch._launch_add import _launch_add
37
38
  from wandb.sdk.launch.errors import ExecutionError, LaunchError
38
- from wandb.sdk.launch.launch_add import _launch_add
39
39
  from wandb.sdk.launch.sweeps import utils as sweep_utils
40
40
  from wandb.sdk.launch.sweeps.scheduler import Scheduler
41
41
  from wandb.sdk.lib import filesystem
@@ -1281,7 +1281,7 @@ def launch(
1281
1281
  logger.info(
1282
1282
  f"=== Launch called with kwargs {locals()} CLI Version: {wandb.__version__}==="
1283
1283
  )
1284
- from wandb.sdk.launch import launch as wandb_launch
1284
+ from wandb.sdk.launch._launch import _launch
1285
1285
 
1286
1286
  api = _get_cling_api()
1287
1287
  wandb._sentry.configure_scope(process_context="launch_cli")
@@ -1291,6 +1291,11 @@ def launch(
1291
1291
  "Cannot use both --async and --queue with wandb launch, see help for details."
1292
1292
  )
1293
1293
 
1294
+ if queue and docker_image and not project:
1295
+ raise LaunchError(
1296
+ "Cannot use --queue and --docker together without a project. Please specify a project with --project or -p."
1297
+ )
1298
+
1294
1299
  if resource_args is not None:
1295
1300
  resource_args = util.load_json_yaml_dict(resource_args)
1296
1301
  if resource_args is None:
@@ -1329,19 +1334,19 @@ def launch(
1329
1334
  if queue is None:
1330
1335
  # direct launch
1331
1336
  try:
1332
- run = wandb_launch.run(
1337
+ run = _launch(
1333
1338
  api,
1334
1339
  uri,
1335
1340
  job,
1336
- entry_point,
1337
- git_version,
1338
1341
  project=project,
1339
1342
  entity=entity,
1340
1343
  docker_image=docker_image,
1341
1344
  name=name,
1345
+ entry_point=entry_point,
1346
+ version=git_version,
1342
1347
  resource=resource,
1343
1348
  resource_args=resource_args,
1344
- config=config,
1349
+ launch_config=config,
1345
1350
  synchronous=(not run_async),
1346
1351
  run_id=run_id,
1347
1352
  repository=repository,
@@ -1444,11 +1449,11 @@ def launch_agent(
1444
1449
  "--url is not supported in this version, upgrade with: pip install -u wandb"
1445
1450
  )
1446
1451
 
1447
- from wandb.sdk.launch import launch as wandb_launch
1452
+ import wandb.sdk.launch._launch as _launch
1448
1453
 
1449
1454
  api = _get_cling_api()
1450
1455
  wandb._sentry.configure_scope(process_context="launch_agent")
1451
- agent_config, api = wandb_launch.resolve_agent_config(
1456
+ agent_config, api = _launch.resolve_agent_config(
1452
1457
  entity, project, max_jobs, queues, config
1453
1458
  )
1454
1459
  if agent_config.get("project") is None:
@@ -1465,7 +1470,7 @@ def launch_agent(
1465
1470
 
1466
1471
  wandb.termlog("Starting launch agent ✨")
1467
1472
  try:
1468
- wandb_launch.create_and_run_agent(api, agent_config)
1473
+ _launch.create_and_run_agent(api, agent_config)
1469
1474
  except Exception as e:
1470
1475
  wandb._sentry.exception(e)
1471
1476
  raise e
wandb/env.py CHANGED
@@ -74,6 +74,7 @@ JUPYTER = "WANDB_JUPYTER"
74
74
  CONFIG_DIR = "WANDB_CONFIG_DIR"
75
75
  DATA_DIR = "WANDB_DATA_DIR"
76
76
  ARTIFACT_DIR = "WANDB_ARTIFACT_DIR"
77
+ ARTIFACT_FETCH_FILE_URL_BATCH_SIZE = "WANDB_ARTIFACT_FETCH_FILE_URL_BATCH_SIZE"
77
78
  CACHE_DIR = "WANDB_CACHE_DIR"
78
79
  DISABLE_SSL = "WANDB_INSECURE_DISABLE_SSL"
79
80
  SERVICE = "WANDB_SERVICE"
@@ -122,6 +123,7 @@ def immutable_keys() -> List[str]:
122
123
  HOST,
123
124
  DATA_DIR,
124
125
  ARTIFACT_DIR,
126
+ ARTIFACT_FETCH_FILE_URL_BATCH_SIZE,
125
127
  CACHE_DIR,
126
128
  USE_V1_ARTIFACTS,
127
129
  DISABLE_SSL,
@@ -193,7 +195,7 @@ def get_docker(
193
195
  return env.get(DOCKER, default)
194
196
 
195
197
 
196
- def get_http_timeout(default: int = 30, env: Optional[Env] = None) -> int:
198
+ def get_http_timeout(default: int = 20, env: Optional[Env] = None) -> int:
197
199
  if env is None:
198
200
  env = os.environ
199
201
 
@@ -380,6 +382,14 @@ def get_artifact_dir(env: Optional[Env] = None) -> str:
380
382
  return val
381
383
 
382
384
 
385
+ def get_artifact_fetch_file_url_batch_size(env: Optional[Env] = None) -> int:
386
+ default_batch_size = 5000
387
+ if env is None:
388
+ env = os.environ
389
+ val = int(env.get(ARTIFACT_FETCH_FILE_URL_BATCH_SIZE, default_batch_size))
390
+ return val
391
+
392
+
383
393
  def get_cache_dir(env: Optional[Env] = None) -> Path:
384
394
  env = env or os.environ
385
395
  return Path(env.get(CACHE_DIR, appdirs.user_cache_dir("wandb")))
@@ -64,10 +64,10 @@ class WandbCallback(xgb.callback.TrainingCallback):
64
64
  Passing `WandbCallback` to XGBoost will:
65
65
 
66
66
  - log the booster model configuration to Weights & Biases
67
- - log evaluation metrics collected by XGBoost, such as rmse, accuracy etc to Weights & Biases
67
+ - log evaluation metrics collected by XGBoost, such as rmse, accuracy etc. to Weights & Biases
68
68
  - log training metric collected by XGBoost (if you provide training data to eval_set)
69
69
  - log the best score and the best iteration
70
- - save and upload your trained model to to Weights & Biases Artifacts (when `log_model = True`)
70
+ - save and upload your trained model to Weights & Biases Artifacts (when `log_model = True`)
71
71
  - log feature importance plot when `log_feature_importance=True` (default).
72
72
  - Capture the best eval metric in `wandb.summary` when `define_metric=True` (default).
73
73
 
@@ -81,6 +81,7 @@ class WandbCallback(xgb.callback.TrainingCallback):
81
81
  alpha=10,
82
82
  n_estimators=10,
83
83
  tree_method="hist",
84
+ callbacks=[WandbCallback()],
84
85
  )
85
86
 
86
87
  xg_reg = xgb.XGBRegressor(**bst_params)
@@ -88,7 +89,6 @@ class WandbCallback(xgb.callback.TrainingCallback):
88
89
  X_train,
89
90
  y_train,
90
91
  eval_set=[(X_test, y_test)],
91
- callbacks=[WandbCallback()],
92
92
  )
93
93
  ```
94
94
  """