当前位置: 首页>>代码示例>>Python>>正文


Python RestConnection.get_alerts方法代码示例

本文整理汇总了Python中membase.api.rest_client.RestConnection.get_alerts方法的典型用法代码示例。如果您正苦于以下问题:Python RestConnection.get_alerts方法的具体用法?Python RestConnection.get_alerts怎么用?Python RestConnection.get_alerts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在membase.api.rest_client.RestConnection的用法示例。


在下文中一共展示了RestConnection.get_alerts方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: tearDown

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_alerts [as 别名]
 def tearDown(self):
         try:
             if (hasattr(self, '_resultForDoCleanups') and len(self._resultForDoCleanups.failures) > 0 \
                 and TestInputSingleton.input.param("stop-on-failure", False))\
                     or self.input.param("skip_cleanup", False):
                 self.log.warn("CLEANUP WAS SKIPPED")
             else:
                 self.log.info("==============  basetestcase cleanup was started for test #{0} {1} =============="\
                       .format(self.case_number, self._testMethodName))
                 rest = RestConnection(self.master)
                 alerts = rest.get_alerts()
                 if alerts is not None and len(alerts) != 0:
                     self.log.warn("Alerts were found: {0}".format(alerts))
                 if rest._rebalance_progress_status() == 'running':
                     self.log.warning("rebalancing is still running, test should be verified")
                     stopped = rest.stop_rebalance()
                     self.assertTrue(stopped, msg="unable to stop rebalance")
                 BucketOperationHelper.delete_all_buckets_or_assert(self.servers, self)
                 ClusterOperationHelper.cleanup_cluster(self.servers)
                 self.sleep(10)
                 ClusterOperationHelper.wait_for_ns_servers_or_assert(self.servers, self)
                 self.log.info("==============  basetestcase cleanup was finished for test #{0} {1} =============="\
                       .format(self.case_number, self._testMethodName))
         except BaseException:
             # increase case_number to retry tearDown in setup for the next test
             self.case_number += 1000
         finally:
             # stop all existing task manager threads
             self.cluster.shutdown()
             self._log_finish(self)
开发者ID:strategist922,项目名称:testrunner,代码行数:32,代码来源:basetestcase.py

示例2: tearDown

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_alerts [as 别名]
    def tearDown(self):
            try:
                if hasattr(self, 'skip_buckets_handle') and self.skip_buckets_handle:
                    return
                test_failed = (hasattr(self, '_resultForDoCleanups') and len(self._resultForDoCleanups.failures or self._resultForDoCleanups.errors)) \
                    or (hasattr(self, '_exc_info') and self._exc_info()[1] is not None)
                if test_failed and TestInputSingleton.input.param("stop-on-failure", False)\
                        or self.input.param("skip_cleanup", False):
                    self.log.warn("CLEANUP WAS SKIPPED")
                else:
                    if test_failed and TestInputSingleton.input.param('get_trace', None):
                        for server in self.servers:
                            try:
                                shell = RemoteMachineShellConnection(server)
                                output, _ = shell.execute_command("ps -aef|grep %s" %
                                        TestInputSingleton.input.param('get_trace', None))
                                output = shell.execute_command("pstack %s" % output[0].split()[1].strip())
                                print output[0]
                            except:
                                pass
                    if test_failed and self.input.param('BUGS', False):
                        self.log.warn("Test failed. Possible reason is: {0}".format(self.input.param('BUGS', False)))

                    self.log.info("==============  basetestcase cleanup was started for test #{0} {1} =============="\
                          .format(self.case_number, self._testMethodName))
                    rest = RestConnection(self.master)
                    alerts = rest.get_alerts()
                    if alerts is not None and len(alerts) != 0:
                        self.log.warn("Alerts were found: {0}".format(alerts))
                    if rest._rebalance_progress_status() == 'running':
                        self.log.warning("rebalancing is still running, test should be verified")
                        stopped = rest.stop_rebalance()
                        self.assertTrue(stopped, msg="unable to stop rebalance")
                    BucketOperationHelper.delete_all_buckets_or_assert(self.servers, self)
                    if self.input.param("forceEject", False):
                        for server in self.servers:
                            if server != self.servers[0]:
                                try:
                                    rest = RestConnection(server)
                                    rest.force_eject_node()
                                except BaseException, e:
                                    self.log.error(e)
                    ClusterOperationHelper.cleanup_cluster(self.servers)
                    self.sleep(10)
                    ClusterOperationHelper.wait_for_ns_servers_or_assert(self.servers, self)
                    self.log.info("==============  basetestcase cleanup was finished for test #{0} {1} =============="\
                          .format(self.case_number, self._testMethodName))
            except BaseException:
                # increase case_number to retry tearDown in setup for the next test
                self.case_number += 1000
            finally:
                # stop all existing task manager threads
                self.cluster.shutdown(force=True)
                self._log_finish(self)
开发者ID:paragagarwal,项目名称:testrunner,代码行数:56,代码来源:basetestcase.py

示例3: tearDown

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_alerts [as 别名]
    def tearDown(self):
        try:
            test_failed = (
                hasattr(self, "_resultForDoCleanups")
                and len(self._resultForDoCleanups.failures or self._resultForDoCleanups.errors)
            ) or (hasattr(self, "_exc_info") and self._exc_info()[1] is not None)
            if (
                test_failed
                and TestInputSingleton.input.param("stop-on-failure", False)
                or self.input.param("skip_cleanup", False)
            ):
                self.log.warn("CLEANUP WAS SKIPPED")
            else:
                if test_failed and self.input.param("BUGS", False):
                    self.log.warn("Test failed. Possible reason is: {0}".format(self.input.param("BUGS", False)))

                self.log.info(
                    "==============  basetestcase cleanup was started for test #{0} {1} ==============".format(
                        self.case_number, self._testMethodName
                    )
                )
                rest = RestConnection(self.master)
                alerts = rest.get_alerts()
                if alerts is not None and len(alerts) != 0:
                    self.log.warn("Alerts were found: {0}".format(alerts))
                if rest._rebalance_progress_status() == "running":
                    self.log.warning("rebalancing is still running, test should be verified")
                    stopped = rest.stop_rebalance()
                    self.assertTrue(stopped, msg="unable to stop rebalance")
                BucketOperationHelper.delete_all_buckets_or_assert(self.servers, self)
                if self.input.param("forceEject", False):
                    for server in self.servers:
                        if server != self.servers[0]:
                            try:
                                rest = RestConnection(server)
                                rest.force_eject_node()
                            except BaseException, e:
                                self.log.error(e)
                ClusterOperationHelper.cleanup_cluster(self.servers)
                self.sleep(10)
                ClusterOperationHelper.wait_for_ns_servers_or_assert(self.servers, self)
                self.log.info(
                    "==============  basetestcase cleanup was finished for test #{0} {1} ==============".format(
                        self.case_number, self._testMethodName
                    )
                )
        except BaseException:
            # increase case_number to retry tearDown in setup for the next test
            self.case_number += 1000
        finally:
            # stop all existing task manager threads
            self.cluster.shutdown()
            self._log_finish(self)
开发者ID:Boggypop,项目名称:testrunner,代码行数:55,代码来源:basetestcase.py

示例4: tearDown

# 需要导入模块: from membase.api.rest_client import RestConnection [as 别名]
# 或者: from membase.api.rest_client.RestConnection import get_alerts [as 别名]
 def tearDown(self):
     if not self.input.param("skip_cleanup", False):
         try:
             self.log.info("==============  basetestcase cleanup was started for test #{0} {1} =============="\
                       .format(self.case_number, self._testMethodName))
             rest = RestConnection(self.master)
             alerts = rest.get_alerts()
             if alerts is not None and len(alerts) != 0:
                 self.log.warn("Alerts were found: {0}".format(alerts))
             if rest._rebalance_progress_status() == 'running':
                 self.log.warning("rebalancing is still running, test should be verified")
                 stopped = rest.stop_rebalance()
                 self.assertTrue(stopped, msg="unable to stop rebalance")
             BucketOperationHelper.delete_all_buckets_or_assert(self.servers, self)
             ClusterOperationHelper.cleanup_cluster(self.servers)
             time.sleep(10)
             ClusterOperationHelper.wait_for_ns_servers_or_assert(self.servers, self)
             self.log.info("==============  basetestcase cleanup was finished for test #{0} {1} =============="\
                       .format(self.case_number, self._testMethodName))
         finally:
             #stop all existing task manager threads
             self.cluster.shutdown()
             self._log_finish(self)
开发者ID:ronniedada,项目名称:testrunner,代码行数:25,代码来源:basetestcase.py


注:本文中的membase.api.rest_client.RestConnection.get_alerts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。