wandb 0.17.3__py3-none-any.whl → 0.17.5__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. wandb/__init__.py +1 -1
  2. wandb/apis/internal.py +4 -0
  3. wandb/cli/cli.py +7 -6
  4. wandb/env.py +16 -0
  5. wandb/filesync/upload_job.py +1 -1
  6. wandb/proto/v3/wandb_internal_pb2.py +339 -328
  7. wandb/proto/v3/wandb_settings_pb2.py +2 -2
  8. wandb/proto/v4/wandb_internal_pb2.py +326 -323
  9. wandb/proto/v4/wandb_settings_pb2.py +2 -2
  10. wandb/proto/v5/wandb_internal_pb2.py +326 -323
  11. wandb/proto/v5/wandb_settings_pb2.py +2 -2
  12. wandb/sdk/artifacts/artifact.py +13 -24
  13. wandb/sdk/artifacts/artifact_file_cache.py +35 -13
  14. wandb/sdk/artifacts/storage_policies/wandb_storage_policy.py +11 -6
  15. wandb/sdk/interface/interface.py +12 -5
  16. wandb/sdk/interface/interface_shared.py +9 -7
  17. wandb/sdk/internal/handler.py +1 -1
  18. wandb/sdk/internal/internal_api.py +67 -14
  19. wandb/sdk/internal/sender.py +9 -2
  20. wandb/sdk/launch/agent/agent.py +3 -1
  21. wandb/sdk/launch/builder/kaniko_builder.py +30 -9
  22. wandb/sdk/launch/inputs/internal.py +79 -2
  23. wandb/sdk/launch/inputs/manage.py +21 -3
  24. wandb/sdk/launch/sweeps/scheduler.py +2 -0
  25. wandb/sdk/lib/_settings_toposort_generated.py +3 -0
  26. wandb/sdk/lib/credentials.py +141 -0
  27. wandb/sdk/lib/tracelog.py +2 -2
  28. wandb/sdk/wandb_init.py +12 -2
  29. wandb/sdk/wandb_login.py +6 -0
  30. wandb/sdk/wandb_manager.py +34 -21
  31. wandb/sdk/wandb_run.py +100 -75
  32. wandb/sdk/wandb_settings.py +13 -2
  33. wandb/sdk/wandb_setup.py +12 -13
  34. wandb/util.py +29 -11
  35. {wandb-0.17.3.dist-info → wandb-0.17.5.dist-info}/METADATA +1 -1
  36. {wandb-0.17.3.dist-info → wandb-0.17.5.dist-info}/RECORD +39 -38
  37. {wandb-0.17.3.dist-info → wandb-0.17.5.dist-info}/WHEEL +0 -0
  38. {wandb-0.17.3.dist-info → wandb-0.17.5.dist-info}/entry_points.txt +0 -0
  39. {wandb-0.17.3.dist-info → wandb-0.17.5.dist-info}/licenses/LICENSE +0 -0
wandb/__init__.py CHANGED
@@ -11,7 +11,7 @@ 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.17.3"
14
+ __version__ = "0.17.5"
15
15
 
16
16
 
17
17
  # Used with pypi checks and other messages related to pip
wandb/apis/internal.py CHANGED
@@ -43,6 +43,10 @@ class Api:
43
43
  def api_key(self):
44
44
  return self.api.api_key
45
45
 
46
+ @property
47
+ def is_authenticated(self):
48
+ return self.api.access_token is not None or self.api.api_key is not None
49
+
46
50
  @property
47
51
  def api_url(self):
48
52
  return self.api.api_url
wandb/cli/cli.py CHANGED
@@ -678,7 +678,7 @@ def sync(
678
678
  skip_console=None,
679
679
  ):
680
680
  api = _get_cling_api()
681
- if api.api_key is None:
681
+ if not api.is_authenticated:
682
682
  wandb.termlog("Login to W&B to sync offline runs")
683
683
  ctx.invoke(login, no_offline=True)
684
684
  api = _get_cling_api(reset=True)
@@ -916,7 +916,7 @@ def sweep(
916
916
  elif is_state_change_command == 1:
917
917
  sweep_id = config_yaml_or_sweep_id
918
918
  api = _get_cling_api()
919
- if api.api_key is None:
919
+ if not api.is_authenticated:
920
920
  wandb.termlog("Login to W&B to use the sweep feature")
921
921
  ctx.invoke(login, no_offline=True)
922
922
  api = _get_cling_api(reset=True)
@@ -959,7 +959,7 @@ def sweep(
959
959
  return ret
960
960
 
961
961
  api = _get_cling_api()
962
- if api.api_key is None:
962
+ if not api.is_authenticated:
963
963
  wandb.termlog("Login to W&B to use the sweep feature")
964
964
  ctx.invoke(login, no_offline=True)
965
965
  api = _get_cling_api(reset=True)
@@ -1136,7 +1136,7 @@ def launch_sweep(
1136
1136
  ):
1137
1137
  api = _get_cling_api()
1138
1138
  env = os.environ
1139
- if api.api_key is None:
1139
+ if not api.is_authenticated:
1140
1140
  wandb.termlog("Login to W&B to use the sweep feature")
1141
1141
  ctx.invoke(login, no_offline=True)
1142
1142
  api = _get_cling_api(reset=True)
@@ -1318,6 +1318,7 @@ def launch_sweep(
1318
1318
  launch_scheduler=launch_scheduler_with_queue,
1319
1319
  state="PENDING",
1320
1320
  prior_runs=prior_runs,
1321
+ template_variable_values=scheduler_args.get("template_variables", None),
1321
1322
  )
1322
1323
  sweep_utils.handle_sweep_config_violations(warnings)
1323
1324
  # Log nicely formatted sweep information
@@ -1817,7 +1818,7 @@ def launch_agent(
1817
1818
  @display_error
1818
1819
  def agent(ctx, project, entity, count, sweep_id):
1819
1820
  api = _get_cling_api()
1820
- if api.api_key is None:
1821
+ if not api.is_authenticated:
1821
1822
  wandb.termlog("Login to W&B to use the sweep agent feature")
1822
1823
  ctx.invoke(login, no_offline=True)
1823
1824
  api = _get_cling_api(reset=True)
@@ -1841,7 +1842,7 @@ def scheduler(
1841
1842
  sweep_id,
1842
1843
  ):
1843
1844
  api = InternalApi()
1844
- if api.api_key is None:
1845
+ if not api.is_authenticated:
1845
1846
  wandb.termlog("Login to W&B to use the sweep scheduler feature")
1846
1847
  ctx.invoke(login, no_offline=True)
1847
1848
  api = InternalApi(reset=True)
wandb/env.py CHANGED
@@ -52,6 +52,8 @@ SWEEP_ID = "WANDB_SWEEP_ID"
52
52
  HTTP_TIMEOUT = "WANDB_HTTP_TIMEOUT"
53
53
  FILE_PUSHER_TIMEOUT = "WANDB_FILE_PUSHER_TIMEOUT"
54
54
  API_KEY = "WANDB_API_KEY"
55
+ IDENTITY_TOKEN_FILE = "WANDB_IDENTITY_TOKEN_FILE"
56
+ CREDENTIALS_FILE = "WANDB_CREDENTIALS_FILE"
55
57
  JOB_TYPE = "WANDB_JOB_TYPE"
56
58
  DISABLE_CODE = "WANDB_DISABLE_CODE"
57
59
  DISABLE_GIT = "WANDB_DISABLE_GIT"
@@ -132,6 +134,8 @@ def immutable_keys() -> List[str]:
132
134
  CACHE_DIR,
133
135
  USE_V1_ARTIFACTS,
134
136
  DISABLE_SSL,
137
+ IDENTITY_TOKEN_FILE,
138
+ CREDENTIALS_FILE,
135
139
  ]
136
140
 
137
141
 
@@ -481,6 +485,18 @@ def get_launch_trace_id(env: Optional[Env] = None) -> Optional[str]:
481
485
  return val
482
486
 
483
487
 
488
+ def get_credentials_file(default: str, env: Optional[Env] = None) -> Path:
489
+ """Retrieve the path for the credentials file used to save access tokens.
490
+
491
+ The credentials file path can be set via an environment variable, otherwise
492
+ the default path is used.
493
+ """
494
+ if env is None:
495
+ env = os.environ
496
+ credentials_file = env.get(CREDENTIALS_FILE, default)
497
+ return Path(credentials_file)
498
+
499
+
484
500
  def strtobool(val: str) -> bool:
485
501
  """Convert a string representation of truth to true or false.
486
502
 
@@ -110,7 +110,7 @@ class UploadJob:
110
110
  logger.info("Skipped uploading %s", self.save_path)
111
111
  self._stats.set_file_deduped(self.save_name)
112
112
  else:
113
- extra_headers = {}
113
+ extra_headers = self._api._extra_http_headers
114
114
  for upload_header in upload_headers:
115
115
  key, val = upload_header.split(":", 1)
116
116
  extra_headers[key] = val