示例#1
0
 def __init__(
     self,
     default_settings=None,
     load_settings=True,
     retry_timedelta=None,
     environ=os.environ,
 ):
     if retry_timedelta is None:
         retry_timedelta = datetime.timedelta(days=1)
     self._environ = environ
     self.default_settings = {
         "section": "default",
         "git_remote": "origin",
         "ignore_globs": [],
         "base_url": "https://api.wandb.ai",
     }
     self.retry_timedelta = retry_timedelta
     self.default_settings.update(default_settings or {})
     self.retry_uploads = 10
     self._settings = Settings(
         load_settings=load_settings, root_dir=self.default_settings.get("root_dir")
     )
     # self.git = GitRepo(remote=self.settings("git_remote"))
     self.git = None
     # Mutable settings set by the _file_stream_api
     self.dynamic_settings = {
         "system_sample_seconds": 2,
         "system_samples": 15,
         "heartbeat_seconds": 30,
     }
     self.client = Client(
         transport=RequestsHTTPTransport(
             headers={
                 "User-Agent": self.user_agent,
                 "X-WANDB-USERNAME": env.get_username(env=self._environ),
                 "X-WANDB-USER-EMAIL": env.get_user_email(env=self._environ),
             },
             use_json=True,
             # this timeout won't apply when the DNS lookup fails. in that case, it will be 60s
             # https://bugs.python.org/issue22889
             timeout=self.HTTP_TIMEOUT,
             auth=("api", self.api_key or ""),
             url="%s/graphql" % self.settings("base_url"),
         )
     )
     self.gql = retry.Retry(
         self.execute,
         retry_timedelta=retry_timedelta,
         check_retry_fn=util.no_retry_auth,
         retryable_exceptions=(RetryError, requests.RequestException),
     )
     self._current_run_id = None
     self._file_stream_api = None
 def __init__(self,
              default_settings=None,
              load_settings=True,
              retry_timedelta=datetime.timedelta(days=1),
              environ=os.environ):
     self._environ = environ
     self.default_settings = {
         'section': "default",
         'run': "latest",
         'git_remote': "origin",
         'ignore_globs': [],
         'base_url': "https://api.wandb.ai"
     }
     self.retry_timedelta = retry_timedelta
     self.default_settings.update(default_settings or {})
     self.retry_uploads = 10
     self._settings = Settings(load_settings=load_settings)
     #self.git = GitRepo(remote=self.settings("git_remote"))
     self.git = None
     # Mutable settings set by the _file_stream_api
     self.dynamic_settings = {
         'system_sample_seconds': 2,
         'system_samples': 15,
         'heartbeat_seconds': 30,
     }
     self.client = Client(transport=RequestsHTTPTransport(
         headers={
             'User-Agent': self.user_agent,
             'X-WANDB-USERNAME': env.get_username(env=self._environ),
             'X-WANDB-USER-EMAIL': env.get_user_email(env=self._environ)
         },
         use_json=True,
         # this timeout won't apply when the DNS lookup fails. in that case, it will be 60s
         # https://bugs.python.org/issue22889
         timeout=self.HTTP_TIMEOUT,
         auth=("api", self.api_key or ""),
         url='%s/graphql' % self.settings('base_url')))
     self.gql = retry.Retry(
         self.execute,
         retry_timedelta=retry_timedelta,
         check_retry_fn=util.no_retry_auth,
         retryable_exceptions=(RetryError, requests.RequestException))
     self._current_run_id = None
     self._file_stream_api = None