wandb 0.19.1rc1__py3-none-any.whl → 0.19.3__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. wandb/__init__.py +1 -7
  2. wandb/__init__.pyi +15 -7
  3. wandb/agents/pyagent.py +1 -1
  4. wandb/apis/importers/wandb.py +1 -1
  5. wandb/apis/public/files.py +1 -1
  6. wandb/apis/public/jobs.py +1 -1
  7. wandb/apis/public/runs.py +2 -7
  8. wandb/apis/reports/v1/__init__.py +1 -1
  9. wandb/apis/reports/v2/__init__.py +1 -1
  10. wandb/apis/workspaces/__init__.py +1 -1
  11. wandb/bin/gpu_stats +0 -0
  12. wandb/cli/beta.py +7 -4
  13. wandb/cli/cli.py +5 -7
  14. wandb/docker/__init__.py +4 -4
  15. wandb/integration/fastai/__init__.py +4 -6
  16. wandb/integration/keras/keras.py +5 -3
  17. wandb/integration/metaflow/metaflow.py +14 -16
  18. wandb/integration/prodigy/prodigy.py +3 -11
  19. wandb/integration/sagemaker/__init__.py +5 -3
  20. wandb/integration/sagemaker/config.py +17 -8
  21. wandb/integration/sagemaker/files.py +0 -1
  22. wandb/integration/sagemaker/resources.py +47 -18
  23. wandb/integration/torch/wandb_torch.py +1 -1
  24. wandb/proto/v3/wandb_internal_pb2.py +273 -235
  25. wandb/proto/v4/wandb_internal_pb2.py +222 -214
  26. wandb/proto/v5/wandb_internal_pb2.py +222 -214
  27. wandb/sdk/artifacts/artifact.py +3 -9
  28. wandb/sdk/backend/backend.py +1 -1
  29. wandb/sdk/data_types/base_types/wb_value.py +1 -1
  30. wandb/sdk/data_types/graph.py +2 -2
  31. wandb/sdk/data_types/saved_model.py +1 -1
  32. wandb/sdk/data_types/video.py +1 -1
  33. wandb/sdk/interface/interface.py +25 -25
  34. wandb/sdk/interface/interface_shared.py +21 -5
  35. wandb/sdk/internal/handler.py +19 -1
  36. wandb/sdk/internal/internal.py +1 -1
  37. wandb/sdk/internal/internal_api.py +4 -5
  38. wandb/sdk/internal/sample.py +2 -2
  39. wandb/sdk/internal/sender.py +1 -2
  40. wandb/sdk/internal/settings_static.py +3 -1
  41. wandb/sdk/internal/system/assets/disk.py +4 -4
  42. wandb/sdk/internal/system/assets/gpu.py +1 -1
  43. wandb/sdk/internal/system/assets/memory.py +1 -1
  44. wandb/sdk/internal/system/system_info.py +1 -1
  45. wandb/sdk/internal/system/system_monitor.py +3 -1
  46. wandb/sdk/internal/tb_watcher.py +1 -1
  47. wandb/sdk/launch/_project_spec.py +3 -3
  48. wandb/sdk/launch/builder/abstract.py +1 -1
  49. wandb/sdk/lib/apikey.py +2 -3
  50. wandb/sdk/lib/fsm.py +1 -1
  51. wandb/sdk/lib/gitlib.py +1 -1
  52. wandb/sdk/lib/gql_request.py +1 -1
  53. wandb/sdk/lib/interrupt.py +37 -0
  54. wandb/sdk/lib/lazyloader.py +1 -1
  55. wandb/sdk/lib/progress.py +7 -1
  56. wandb/sdk/lib/service_connection.py +1 -1
  57. wandb/sdk/lib/telemetry.py +1 -1
  58. wandb/sdk/service/_startup_debug.py +1 -1
  59. wandb/sdk/service/server_sock.py +3 -2
  60. wandb/sdk/service/service.py +1 -1
  61. wandb/sdk/service/streams.py +19 -17
  62. wandb/sdk/verify/verify.py +13 -13
  63. wandb/sdk/wandb_init.py +316 -246
  64. wandb/sdk/wandb_login.py +1 -1
  65. wandb/sdk/wandb_metadata.py +547 -0
  66. wandb/sdk/wandb_run.py +134 -39
  67. wandb/sdk/wandb_settings.py +7 -63
  68. wandb/sdk/wandb_setup.py +83 -82
  69. wandb/sdk/wandb_sweep.py +2 -2
  70. wandb/sdk/wandb_sync.py +15 -18
  71. wandb/sync/sync.py +10 -10
  72. wandb/util.py +11 -3
  73. wandb/wandb_agent.py +11 -16
  74. wandb/wandb_controller.py +7 -7
  75. {wandb-0.19.1rc1.dist-info → wandb-0.19.3.dist-info}/METADATA +5 -3
  76. {wandb-0.19.1rc1.dist-info → wandb-0.19.3.dist-info}/RECORD +79 -77
  77. {wandb-0.19.1rc1.dist-info → wandb-0.19.3.dist-info}/WHEEL +1 -1
  78. {wandb-0.19.1rc1.dist-info → wandb-0.19.3.dist-info}/entry_points.txt +0 -0
  79. {wandb-0.19.1rc1.dist-info → wandb-0.19.3.dist-info}/licenses/LICENSE +0 -0
wandb/sdk/wandb_setup.py CHANGED
@@ -20,6 +20,7 @@ import threading
20
20
  from typing import TYPE_CHECKING, Any, Union
21
21
 
22
22
  import wandb
23
+ import wandb.integration.sagemaker as sagemaker
23
24
  from wandb.sdk.lib import import_hooks
24
25
 
25
26
  from . import wandb_settings
@@ -61,29 +62,19 @@ class _EarlyLogger:
61
62
  def log(self, level: str, msg: str, *args: Any, **kwargs: Any) -> None:
62
63
  self._log.append((level, msg, args, kwargs))
63
64
 
64
- def _flush(self) -> None:
65
- assert self is not logger
66
- assert logger is not None
65
+ def _flush(self, new_logger: Logger) -> None:
66
+ assert self is not new_logger
67
67
  for level, msg, args, kwargs in self._log:
68
- logger.log(level, msg, *args, **kwargs)
68
+ new_logger.log(level, msg, *args, **kwargs)
69
69
  for msg, args, kwargs in self._exception:
70
- logger.exception(msg, *args, **kwargs)
70
+ new_logger.exception(msg, *args, **kwargs)
71
71
 
72
72
 
73
73
  Logger = Union[logging.Logger, _EarlyLogger]
74
74
 
75
- # logger will be configured to be either a standard logger instance or _EarlyLogger
76
- logger: Logger | None = None
77
75
 
78
-
79
- def _set_logger(log_object: Logger) -> None:
80
- """Configure module logger."""
81
- global logger
82
- logger = log_object
83
-
84
-
85
- class _WandbSetup__WandbSetup: # noqa: N801
86
- """Inner class of _WandbSetup."""
76
+ class _WandbSetup:
77
+ """W&B library singleton."""
87
78
 
88
79
  def __init__(
89
80
  self,
@@ -104,48 +95,52 @@ class _WandbSetup__WandbSetup: # noqa: N801
104
95
 
105
96
  # TODO(jhr): defer strict checks until settings are fully initialized
106
97
  # and logging is ready
107
- self._early_logger = _EarlyLogger()
108
- _set_logger(self._early_logger)
98
+ self._logger: Logger = _EarlyLogger()
109
99
 
110
- self._settings = self._settings_setup(settings, self._early_logger)
100
+ self._settings = self._settings_setup(settings)
111
101
 
112
- wandb.termsetup(self._settings, logger)
102
+ wandb.termsetup(self._settings, None)
113
103
 
114
104
  self._check()
115
105
  self._setup()
116
106
 
117
107
  def _settings_setup(
118
108
  self,
119
- settings: Settings | None = None,
120
- early_logger: _EarlyLogger | None = None,
109
+ settings: Settings | None,
121
110
  ) -> wandb_settings.Settings:
122
111
  s = wandb_settings.Settings()
123
112
 
124
113
  # the pid of the process to monitor for system stats
125
114
  pid = os.getpid()
126
- if early_logger:
127
- early_logger.info(f"Current SDK version is {wandb.__version__}")
128
- early_logger.info(f"Configure stats pid to {pid}")
115
+ self._logger.info(f"Current SDK version is {wandb.__version__}")
116
+ self._logger.info(f"Configure stats pid to {pid}")
129
117
  s.x_stats_pid = pid
130
118
 
131
119
  # load settings from the system config
132
- if s.settings_system and early_logger:
133
- early_logger.info(f"Loading settings from {s.settings_system}")
120
+ if s.settings_system:
121
+ self._logger.info(f"Loading settings from {s.settings_system}")
134
122
  s.update_from_system_config_file()
135
123
 
136
124
  # load settings from the workspace config
137
- if s.settings_workspace and early_logger:
138
- early_logger.info(f"Loading settings from {s.settings_workspace}")
125
+ if s.settings_workspace:
126
+ self._logger.info(f"Loading settings from {s.settings_workspace}")
139
127
  s.update_from_workspace_config_file()
140
128
 
141
129
  # load settings from the environment variables
142
- if early_logger:
143
- early_logger.info("Loading settings from environment variables")
130
+ self._logger.info("Loading settings from environment variables")
144
131
  s.update_from_env_vars(self._environ)
145
132
 
146
133
  # infer settings from the system environment
147
134
  s.update_from_system_environment()
148
135
 
136
+ # load SageMaker settings
137
+ check_sagemaker_env = not s.sagemaker_disable
138
+ if settings and settings.sagemaker_disable:
139
+ check_sagemaker_env = False
140
+ if check_sagemaker_env and sagemaker.is_using_sagemaker():
141
+ self._logger.info("Loading SageMaker settings")
142
+ sagemaker.set_global_settings(s)
143
+
149
144
  # load settings from the passed init/setup settings
150
145
  if settings:
151
146
  s.update_from_settings(settings)
@@ -165,13 +160,15 @@ class _WandbSetup__WandbSetup: # noqa: N801
165
160
  self._settings.update_from_dict(user_settings)
166
161
 
167
162
  def _early_logger_flush(self, new_logger: Logger) -> None:
168
- if not self._early_logger:
163
+ if self._logger is new_logger:
169
164
  return
170
- _set_logger(new_logger)
171
- self._early_logger._flush()
172
165
 
173
- def _get_logger(self) -> Logger | None:
174
- return logger
166
+ if isinstance(self._logger, _EarlyLogger):
167
+ self._logger._flush(new_logger)
168
+ self._logger = new_logger
169
+
170
+ def _get_logger(self) -> Logger:
171
+ return self._logger
175
172
 
176
173
  @property
177
174
  def settings(self) -> wandb_settings.Settings:
@@ -236,16 +233,11 @@ class _WandbSetup__WandbSetup: # noqa: N801
236
233
  if threading.current_thread() is not threading.main_thread():
237
234
  pass
238
235
  elif threading.current_thread().name != "MainThread":
239
- print("bad thread2", threading.current_thread().name)
236
+ wandb.termwarn(f"bad thread2: {threading.current_thread().name}")
240
237
  if getattr(sys, "frozen", False):
241
- print("frozen, could be trouble")
238
+ wandb.termwarn("frozen, could be trouble")
242
239
 
243
240
  def _setup(self) -> None:
244
- if not self._settings._noop and not self._settings.x_disable_service:
245
- from wandb.sdk.lib import service_connection
246
-
247
- self._connection = service_connection.connect_to_service(self._settings)
248
-
249
241
  sweep_path = self._settings.sweep_param_path
250
242
  if sweep_path:
251
243
  self._sweep_config = config_util.dict_from_config_file(
@@ -278,53 +270,61 @@ class _WandbSetup__WandbSetup: # noqa: N801
278
270
  if internal_exit_code != 0:
279
271
  sys.exit(internal_exit_code)
280
272
 
281
- @property
282
- def service(self) -> ServiceConnection | None:
283
- """Returns a connection to the service process, if it exists."""
273
+ def ensure_service(self) -> ServiceConnection:
274
+ """Returns a connection to the service process creating it if needed."""
275
+ if self._connection:
276
+ return self._connection
277
+
278
+ from wandb.sdk.lib import service_connection
279
+
280
+ self._connection = service_connection.connect_to_service(self._settings)
284
281
  return self._connection
285
282
 
283
+ def assert_service(self) -> ServiceConnection:
284
+ """Returns a connection to the service process, asserting it exists.
286
285
 
287
- class _WandbSetup:
288
- """Wandb singleton class.
286
+ Unlike ensure_service(), this will not start up a service process
287
+ if it didn't already exist.
288
+ """
289
+ if not self._connection:
290
+ raise AssertionError("Expected service process to exist.")
289
291
 
290
- Note: This is a process local singleton.
291
- (Forked processes will get a new copy of the object)
292
- """
292
+ return self._connection
293
293
 
294
- _instance: _WandbSetup__WandbSetup | None = None
295
294
 
296
- def __init__(self, settings: Settings | None = None) -> None:
297
- pid = os.getpid()
298
- if _WandbSetup._instance and _WandbSetup._instance._pid == pid:
299
- _WandbSetup._instance._update(settings=settings)
300
- return
301
- _WandbSetup._instance = _WandbSetup__WandbSetup(settings=settings, pid=pid)
295
+ _singleton: _WandbSetup | None = None
296
+ """The W&B library singleton, or None if not yet set up.
302
297
 
303
- @property
304
- def service(self) -> ServiceConnection | None:
305
- """Returns a connection to the service process, if it exists."""
306
- if not self._instance:
307
- return None
308
- return self._instance.service
298
+ The value is invalid and must not be used if `os.getpid() != _singleton._pid`.
299
+ """
309
300
 
310
- def __getattr__(self, name: str) -> Any:
311
- return getattr(self._instance, name)
312
301
 
302
+ def singleton() -> _WandbSetup | None:
303
+ """Returns the W&B singleton if it exists for the current process.
313
304
 
314
- def _setup(
315
- settings: Settings | None = None,
316
- _reset: bool = False,
317
- ) -> _WandbSetup | None:
318
- """Set up library context."""
319
- if _reset:
320
- teardown()
305
+ Unlike setup(), this does not create the singleton if it doesn't exist.
306
+ """
307
+ if _singleton and _singleton._pid == os.getpid():
308
+ return _singleton
309
+ else:
321
310
  return None
322
311
 
323
- wl = _WandbSetup(settings=settings)
324
- return wl
325
312
 
313
+ def _setup(settings: Settings | None = None) -> _WandbSetup:
314
+ """Set up library context."""
315
+ global _singleton
316
+
317
+ pid = os.getpid()
326
318
 
327
- def setup(settings: Settings | None = None) -> _WandbSetup | None:
319
+ if _singleton and _singleton._pid == pid:
320
+ _singleton._update(settings=settings)
321
+ return _singleton
322
+ else:
323
+ _singleton = _WandbSetup(settings=settings, pid=pid)
324
+ return _singleton
325
+
326
+
327
+ def setup(settings: Settings | None = None) -> _WandbSetup:
328
328
  """Prepares W&B for use in the current process and its children.
329
329
 
330
330
  You can usually ignore this as it is implicitly called by `wandb.init()`.
@@ -380,8 +380,7 @@ def setup(settings: Settings | None = None) -> _WandbSetup | None:
380
380
  wandb.teardown()
381
381
  ```
382
382
  """
383
- ret = _setup(settings=settings)
384
- return ret
383
+ return _setup(settings=settings)
385
384
 
386
385
 
387
386
  def teardown(exit_code: int | None = None) -> None:
@@ -395,8 +394,10 @@ def teardown(exit_code: int | None = None) -> None:
395
394
  in an `atexit` hook, but this is not reliable in certain setups
396
395
  such as when using Python's `multiprocessing` module.
397
396
  """
398
- setup_instance = _WandbSetup._instance
399
- _WandbSetup._instance = None
397
+ global _singleton
398
+
399
+ orig_singleton = _singleton
400
+ _singleton = None
400
401
 
401
- if setup_instance:
402
- setup_instance._teardown(exit_code=exit_code)
402
+ if orig_singleton:
403
+ orig_singleton._teardown(exit_code=exit_code)
wandb/sdk/wandb_sweep.py CHANGED
@@ -85,10 +85,10 @@ def sweep(
85
85
  api = InternalApi()
86
86
  sweep_id, warnings = api.upsert_sweep(sweep, prior_runs=prior_runs)
87
87
  handle_sweep_config_violations(warnings)
88
- print("Create sweep with ID:", sweep_id)
88
+ print("Create sweep with ID:", sweep_id) # noqa: T201
89
89
  sweep_url = _get_sweep_url(api, sweep_id)
90
90
  if sweep_url:
91
- print("Sweep URL:", sweep_url)
91
+ print("Sweep URL:", sweep_url) # noqa: T201
92
92
  return sweep_id
93
93
 
94
94
 
wandb/sdk/wandb_sync.py CHANGED
@@ -1,6 +1,7 @@
1
1
  import pathlib
2
2
  from typing import TYPE_CHECKING, Optional
3
3
 
4
+ from wandb import util
4
5
  from wandb.errors.term import termerror, termlog
5
6
 
6
7
  from . import wandb_setup
@@ -21,26 +22,31 @@ def _sync(
21
22
  append: Optional[bool] = None,
22
23
  skip_console: Optional[bool] = None,
23
24
  ) -> "wandb_internal_pb2.SyncResponse":
24
- p = pathlib.Path(path)
25
-
26
25
  wl = wandb_setup.setup()
27
26
  assert wl is not None
28
27
 
29
28
  stream_id = generate_id()
30
29
 
31
30
  settings = wl.settings.to_proto()
31
+ p = pathlib.Path(path)
32
+
32
33
  # update sync_file setting to point to the passed path
33
34
  settings.sync_file.value = str(p.absolute())
34
35
  settings.sync_dir.value = str(p.parent.absolute())
35
36
  settings.files_dir.value = str(p.parent.absolute() / "files")
36
- settings._sync.value = True
37
- settings.run_id.value = stream_id # TODO: remove this
37
+ settings.x_sync.value = True
38
+ if run_id:
39
+ settings.run_id.value = run_id
40
+ if entity:
41
+ settings.entity.value = entity
42
+ if project:
43
+ settings.project.value = project
44
+ if skip_console:
45
+ settings.console.value = "off"
38
46
  if append:
39
47
  settings.resume.value = "allow"
40
48
 
41
- service = wl.service
42
- assert service
43
-
49
+ service = wl.ensure_service()
44
50
  service.inform_init(settings=settings, run_id=stream_id)
45
51
 
46
52
  mailbox = Mailbox()
@@ -55,21 +61,12 @@ def _sync(
55
61
  backend.interface._stream_id = stream_id # type: ignore
56
62
 
57
63
  mailbox.enable_keepalive()
58
-
59
- # TODO: let's add extra sync messages here so we get the url in the beginning
60
- handle = backend.interface.deliver_sync(
61
- start_offset=0,
62
- final_offset=-1,
63
- entity=entity,
64
- project=project,
65
- run_id=run_id,
66
- skip_output_raw=skip_console,
67
- )
64
+ handle = backend.interface.deliver_finish_sync()
68
65
  result = handle.wait(timeout=-1)
69
66
  assert result and result.response
70
67
  response = result.response.sync_response
71
68
  if response.url:
72
- termlog(f"Synced {p} to {response.url}")
69
+ termlog(f"Synced {p} to {util.app_url(response.url)}")
73
70
  # create a .synced file in the directory if mark_synced is true
74
71
  if mark_synced:
75
72
  with open(f"{p}.synced", "w"):
wandb/sync/sync.py CHANGED
@@ -81,9 +81,9 @@ class SyncThread(threading.Thread):
81
81
  record_type = pb.WhichOneof("record_type")
82
82
  if self._view:
83
83
  if self._verbose:
84
- print("Record:", pb)
84
+ print("Record:", pb) # noqa: T201
85
85
  else:
86
- print("Record:", record_type)
86
+ print("Record:", record_type) # noqa: T201
87
87
  return pb, exit_pb, True
88
88
  if record_type == "run":
89
89
  if self._run_id:
@@ -137,7 +137,7 @@ class SyncThread(threading.Thread):
137
137
  if tb_event_files > 0 and sync_item.endswith(WANDB_SUFFIX):
138
138
  wandb.termwarn("Found .wandb file, not streaming tensorboard metrics.")
139
139
  else:
140
- print(f"Found {tb_event_files} tfevent files in {tb_root}")
140
+ print(f"Found {tb_event_files} tfevent files in {tb_root}") # noqa: T201
141
141
  if len(tb_logdirs) > 3:
142
142
  wandb.termwarn(
143
143
  f"Found {len(tb_logdirs)} directories containing tfevent files. "
@@ -163,7 +163,7 @@ class SyncThread(threading.Thread):
163
163
  url_quote(proto_run.project),
164
164
  url_quote(proto_run.run_id),
165
165
  )
166
- print("Syncing: {} ...".format(url))
166
+ print("Syncing: {} ...".format(url)) # noqa: T201
167
167
  sys.stdout.flush()
168
168
  # using a handler here automatically handles the step
169
169
  # logic, adds summaries to the run, and handles different
@@ -245,7 +245,7 @@ class SyncThread(threading.Thread):
245
245
 
246
246
  def run(self):
247
247
  if self._log_path is not None:
248
- print(f"Find logs at: {self._log_path}")
248
+ print(f"Find logs at: {self._log_path}") # noqa: T201
249
249
  for sync_item in self._sync_list:
250
250
  tb_event_files, tb_logdirs, tb_root = self._find_tfevent_files(sync_item)
251
251
  if os.path.isdir(sync_item):
@@ -254,7 +254,7 @@ class SyncThread(threading.Thread):
254
254
  if tb_root is None and (
255
255
  check_and_warn_old(files) or len(filtered_files) != 1
256
256
  ):
257
- print(f"Skipping directory: {sync_item}")
257
+ print(f"Skipping directory: {sync_item}") # noqa: T201
258
258
  continue
259
259
  if len(filtered_files) > 0:
260
260
  sync_item = os.path.join(sync_item, filtered_files[0])
@@ -265,7 +265,7 @@ class SyncThread(threading.Thread):
265
265
  root_dir = self._tmp_dir.name if sync_tb else os.path.dirname(sync_item)
266
266
 
267
267
  # When appending we are allowing a possible resume, ie the run
268
- # doesnt have to exist already
268
+ # does not have to exist already
269
269
  resume = "allow" if self._append else None
270
270
 
271
271
  sm = sender.SendManager.setup(root_dir, resume=resume)
@@ -277,7 +277,7 @@ class SyncThread(threading.Thread):
277
277
  try:
278
278
  ds.open_for_scan(sync_item)
279
279
  except AssertionError as e:
280
- print(f".wandb file is empty ({e}), skipping: {sync_item}")
280
+ print(f".wandb file is empty ({e}), skipping: {sync_item}") # noqa: T201
281
281
  continue
282
282
 
283
283
  # save exit for final send
@@ -311,7 +311,7 @@ class SyncThread(threading.Thread):
311
311
  url_quote(r.project),
312
312
  url_quote(r.run_id),
313
313
  )
314
- print("Syncing: {} ... ".format(url), end="")
314
+ print("Syncing: {} ... ".format(url), end="") # noqa: T201
315
315
  sys.stdout.flush()
316
316
  shown = True
317
317
  sm.finish()
@@ -320,7 +320,7 @@ class SyncThread(threading.Thread):
320
320
  synced_file = f"{sync_item}{SYNCED_SUFFIX}"
321
321
  with open(synced_file, "w"):
322
322
  pass
323
- print("done.")
323
+ print("done.") # noqa: T201
324
324
 
325
325
 
326
326
  class SyncManager:
wandb/util.py CHANGED
@@ -1717,9 +1717,17 @@ def _get_max_cli_version() -> Union[str, None]:
1717
1717
 
1718
1718
 
1719
1719
  def _is_offline() -> bool:
1720
- return ( # type: ignore[no-any-return]
1721
- wandb.run is not None and wandb.run.settings._offline
1722
- ) or wandb.setup().settings._offline # type: ignore
1720
+ """Returns true if wandb is configured to be offline.
1721
+
1722
+ If there is an active run, returns whether the run is offline.
1723
+ Otherwise, returns the default mode, which is affected by explicit settings
1724
+ passed to `wandb.setup()`, environment variables, and W&B configuration
1725
+ files.
1726
+ """
1727
+ if wandb.run:
1728
+ return wandb.run.settings._offline
1729
+ else:
1730
+ return wandb.setup().settings._offline
1723
1731
 
1724
1732
 
1725
1733
  def ensure_text(
wandb/wandb_agent.py CHANGED
@@ -62,10 +62,10 @@ class AgentProcess:
62
62
  os.environ[k] = v
63
63
 
64
64
  # call user function
65
- print("wandb: Agent Started Run:", run_id)
65
+ wandb.termlog(f"Agent Started Run: {run_id}")
66
66
  if function:
67
67
  function()
68
- print("wandb: Agent Finished Run:", run_id, "\n")
68
+ wandb.termlog(f"Agent Finished Run: {run_id}\n")
69
69
 
70
70
  # complete the run
71
71
  run = wandb.run
@@ -92,7 +92,7 @@ class AgentProcess:
92
92
 
93
93
  def wait(self):
94
94
  if self._popen:
95
- # if on windows, wait() will block and we wont be able to interrupt
95
+ # if on windows, wait() will block and we won't be able to interrupt
96
96
  if platform.system() == "Windows":
97
97
  try:
98
98
  while True:
@@ -353,15 +353,10 @@ class Agent:
353
353
  )
354
354
  )
355
355
  if self._in_jupyter:
356
- print(
357
- "wandb: Agent Starting Run: {} with config:\n".format(
358
- command.get("run_id")
359
- )
356
+ wandb.termlog(
357
+ f"Agent Starting Run: {command.get('run_id')} with config:\n"
360
358
  + "\n".join(
361
- [
362
- "\t{}: {}".format(k, v["value"])
363
- for k, v in command["args"].items()
364
- ]
359
+ [f"\t{k}: {v['value']}" for k, v in command["args"].items()]
365
360
  )
366
361
  )
367
362
 
@@ -397,7 +392,7 @@ class Agent:
397
392
 
398
393
  if self._function:
399
394
  # make sure that each run regenerates setup singleton
400
- wandb_sdk.wandb_setup._setup(_reset=True)
395
+ wandb.teardown()
401
396
  proc = AgentProcess(
402
397
  function=self._function,
403
398
  env=env,
@@ -477,12 +472,12 @@ class AgentApi:
477
472
  command["resp_queue"] = resp_queue
478
473
  self._queue.put(command)
479
474
  result = resp_queue.get()
480
- print("result:", result)
475
+ print("result:", result) # noqa: T201
481
476
  if "exception" in result:
482
- print("Exception occurred while running command")
477
+ print("Exception occurred while running command") # noqa: T201
483
478
  for line in result["traceback"]:
484
- print(line.strip())
485
- print(result["exception"])
479
+ print(line.strip()) # noqa: T201
480
+ print(result["exception"]) # noqa: T201
486
481
  return result
487
482
 
488
483
 
wandb/wandb_controller.py CHANGED
@@ -353,19 +353,19 @@ class _WandbController:
353
353
  self._logged += 1
354
354
 
355
355
  def _error(self, s: str) -> None:
356
- print("ERROR:", s)
356
+ print("ERROR:", s) # noqa: T201
357
357
  self._log()
358
358
 
359
359
  def _warn(self, s: str) -> None:
360
- print("WARN:", s)
360
+ print("WARN:", s) # noqa: T201
361
361
  self._log()
362
362
 
363
363
  def _info(self, s: str) -> None:
364
- print("INFO:", s)
364
+ print("INFO:", s) # noqa: T201
365
365
  self._log()
366
366
 
367
367
  def _debug(self, s: str) -> None:
368
- print("DEBUG:", s)
368
+ print("DEBUG:", s) # noqa: T201
369
369
  self._log()
370
370
 
371
371
  def _configure_check(self) -> None:
@@ -396,10 +396,10 @@ class _WandbController:
396
396
  sweep_id, warnings = self._api.upsert_sweep(self._create)
397
397
  handle_sweep_config_violations(warnings)
398
398
 
399
- print("Create sweep with ID:", sweep_id)
399
+ print("Create sweep with ID:", sweep_id) # noqa: T201
400
400
  sweep_url = wandb_sweep._get_sweep_url(self._api, sweep_id)
401
401
  if sweep_url:
402
- print("Sweep URL:", sweep_url)
402
+ print("Sweep URL:", sweep_url) # noqa: T201
403
403
  self._sweep_id = sweep_id
404
404
  self._defer_sweep_creation = False
405
405
  return sweep_id
@@ -636,7 +636,7 @@ class _WandbController:
636
636
  def print_status(self) -> None:
637
637
  status = _sweep_status(self._sweep_obj, self._sweep_config, self._sweep_runs)
638
638
  if self._laststatus != status or self._logged:
639
- print(status)
639
+ print(status) # noqa: T201
640
640
  self._laststatus = status
641
641
  self._logged = 0
642
642
 
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: wandb
3
- Version: 0.19.1rc1
3
+ Version: 0.19.3
4
4
  Summary: A CLI and library for interacting with the Weights & Biases API.
5
5
  Project-URL: Source, https://github.com/wandb/wandb
6
6
  Project-URL: Bug Reports, https://github.com/wandb/wandb/issues
@@ -27,6 +27,7 @@ License: MIT License
27
27
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
28
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
29
  SOFTWARE.
30
+ License-File: LICENSE
30
31
  Classifier: Development Status :: 5 - Production/Stable
31
32
  Classifier: Intended Audience :: Developers
32
33
  Classifier: Intended Audience :: Science/Research
@@ -65,6 +66,7 @@ Requires-Dist: setuptools
65
66
  Requires-Dist: typing-extensions<5,>=4.4; python_version < '3.12'
66
67
  Provides-Extra: aws
67
68
  Requires-Dist: boto3; extra == 'aws'
69
+ Requires-Dist: botocore>=1.5.76; extra == 'aws'
68
70
  Provides-Extra: azure
69
71
  Requires-Dist: azure-identity; extra == 'azure'
70
72
  Requires-Dist: azure-storage-blob; extra == 'azure'
@@ -87,7 +89,7 @@ Requires-Dist: azure-containerregistry; extra == 'launch'
87
89
  Requires-Dist: azure-identity; extra == 'launch'
88
90
  Requires-Dist: azure-storage-blob; extra == 'launch'
89
91
  Requires-Dist: boto3; extra == 'launch'
90
- Requires-Dist: botocore; extra == 'launch'
92
+ Requires-Dist: botocore>=1.5.76; extra == 'launch'
91
93
  Requires-Dist: chardet; extra == 'launch'
92
94
  Requires-Dist: google-auth; extra == 'launch'
93
95
  Requires-Dist: google-cloud-aiplatform; extra == 'launch'