Ejemplo n.º 1
0
 def on_connected(self, *args, **kwargs):
     if args:
         self._config_path = args[0]
     if not self._config_path:
         cprint(
             textwrap.dedent("""
                 You are not connected to any logdevice clusters, in order to do so,
                 please use the connect command and pass the configuration file path
                 as an argument, for instance:
                 """),
             "yellow",
         )
         cprint("connect /var/shared/logdevice-cluster.conf")
         return
     settings = {"on-demand-logs-config": "true", "num-workers": 2}
     with self._lock:
         try:
             self._client = Client(
                 "ldshell",
                 self._config_path,
                 timeout=self._timeout,
                 settings=settings,
             )
         except Exception as e:
             cprint("Cannot connect to logdevice cluster!", "red")
             self._reset()
             raise e
 def build_client(self, settings=None):
     default_settings = {"on-demand-logs-config": "true", "num-workers": 2}
     default_settings.update(settings or {})
     return Client(
         "ldshell",
         self._config_path,
         timeout=self._timeout,
         settings=default_settings,
     )
Ejemplo n.º 3
0
 def build_client(self, settings=None):
     logging.info("Creating a logdevice client using config {}",
                  self.get_config_path())
     default_settings = {"on-demand-logs-config": "true", "num-workers": 2}
     default_settings.update(settings or {})
     return Client(
         "ldshell",
         self.get_config_path(),
         timeout=self._timeout,
         settings=default_settings,
     )