Beispiel #1
0
    def diagnostics(
            self,
            reportId=None,  # type: str
            timeout=None):
        # type: (...)->IDiagnosticsResult
        """
        Creates a diagnostics report that can be used to determine the healthfulness of the Cluster.
        :param reportId - an optional string name for the generated report.
        :return:A IDiagnosticsResult object with the results of the query or error message if the query failed on the server.

        """

        pool = ThreadPool(processes=1)
        diag_results_async_result = pool.apply_async(
            self._operate_on_cluster,
            (CoreClient.diagnostics, DiagnosticsException))
        try:
            diag_results = diag_results_async_result.get(timeout)
        except multiprocessing.TimeoutError as e:
            raise couchbase.exceptions.TimeoutError(params=dict(inner_cause=e))

        final_results = {'services': {}}

        for k, v in diag_results.items():
            if k in Cluster._root_diag_data:
                final_results[k] = v
            else:
                for item in v:
                    final_results['services'][k] = EndPointDiagnostics(k, item)
        return DiagnosticsResult(final_results)
    def diagnostics(self,
                    *options,   # type: DiagnosticsOptions
                    **kwargs
                    ):
        # type: (...) -> DiagnosticsResult
        """
        Creates a diagnostics report that can be used to determine the healthfulness of the Cluster.
        :param options:  Options for the diagnostics
        :return: A :class:`~.diagnostics.DiagnosticsResult` object with the results of the query or error message if the query failed on the server.

        """
        self._check_for_shutdown()
        result = self._sync_operate_on_entire_cluster(CoreClient.diagnostics, **forward_args(kwargs, *options))
        return DiagnosticsResult(result)