def _load_entity(self, api, network): if not api.api_key: raise CommError( "Can't find API key, run wandb login or set WANDB_API_KEY") entity = api.settings('entity') if network: if api.settings('entity') is None: # Kaggle has internet disabled by default, this checks for that case async_viewer = util.async_call(api.viewer, timeout=3) viewer, viewer_thread = async_viewer() if viewer_thread.is_alive(): if is_kaggle(): raise CommError( "To use W&B in kaggle you must enable internet in the settings panel on the right." ) else: raise CommError( "Can't connect to network to query entity from API key" ) if viewer.get('entity'): api.set_setting('entity', viewer['entity']) entity = api.settings('entity') if not entity: # This can happen on network failure raise CommError( "Can't connect to network to query entity from API key") return entity
def query_with_timeout(self, timeout=None): timeout = timeout or 5 async_viewer = util.async_call(self._api.viewer, timeout=timeout) viewer, viewer_thread = async_viewer() if viewer_thread.is_alive(): self._error_network = True return self._error_network = False # TODO(jhr): should we kill the thread? self._viewer = viewer self._flags = json.loads(viewer.get("flags", "{}"))
def _load_viewer(self): if self.mode != "dryrun" and not self._api.disabled() and self._api.api_key: # Kaggle has internet disabled by default, this checks for that case async_viewer = util.async_call(self._api.viewer, timeout=env.get_http_timeout(5)) viewer, viewer_thread = async_viewer() if viewer_thread.is_alive(): if is_kaggle(): raise CommError("To use W&B in kaggle you must enable internet in the settings panel on the right.") else: self._viewer = viewer self._flags = json.loads(viewer.get("flags", "{}"))
def query_with_timeout(self, timeout=None): if self._settings and self._settings._disable_viewer: return timeout = timeout or 5 async_viewer = util.async_call(self._api.viewer_server_info, timeout=timeout) try: viewer_tuple, viewer_thread = async_viewer() except Exception: # TODO: currently a bare exception as lots can happen, we should classify self._error_network = True return if viewer_thread.is_alive(): # this is likely a DNS hang self._error_network = True return self._error_network = False # TODO(jhr): should we kill the thread? self._viewer, self._serverinfo = viewer_tuple self._flags = json.loads(self._viewer.get("flags", "{}"))
def query_with_timeout(self, timeout=None): if self._settings and self._settings._disable_viewer: return timeout = timeout or 5 async_viewer = util.async_call(self._api.viewer_server_info, timeout=timeout) try: viewer_tuple, viewer_thread = async_viewer() except Exception: # TODO: currently a bare exception as lots can happen, we should classify self._error_network = True return if viewer_thread.is_alive(): if util._is_kaggle(): raise CommError( "To use W&B in kaggle you must enable internet in the settings panel on the right." # noqa: E501 ) # this is likely a DNS hang self._error_network = True return self._error_network = False # TODO(jhr): should we kill the thread? self._viewer, self._serverinfo = viewer_tuple self._flags = json.loads(self._viewer.get("flags", "{}"))