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


Python ServerProxy.sample方法代码示例

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


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

示例1: test_listen_port

# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import sample [as 别名]
    def test_listen_port(self):
        """
        The test case to test the server
        created by NodeSamplerServer class.
        :return:
        """

        def start_server():
            self.node_sampler_server.start()

        server_thread = Thread(target=start_server)
        server_thread.setDaemon(True)
        server_thread.start()

        proxy = ServerProxy("http://localhost:8000")
        service_a = Service(name="$$service_a$$",
                            check_methods=TEST_METHOD,
                            ip=TEST_IP)
        service_b = Service(name="$$service_b$$",
                            check_methods=TEST_METHOD,
                            ip=TEST_IP)
        service_c = Service(name="$$service_c$$",
                            check_methods=TEST_METHOD,
                            ip=TEST_IP)
        fake_services = [service_a, service_b, service_c]
        self.assertEquals(
            proxy.sample(fake_services), 1,
            "NodeSamplerServer cannot create object.")
开发者ID:Claire-Sun,项目名称:Lab_python,代码行数:30,代码来源:test_sampler.py

示例2: connect

# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import sample [as 别名]
    def connect(self, ip, group, port, node_services):
        log = LOG()
        log_root = log.root()

        url = "http://" + ip + ":" + port
        log_root.debug(
            "Sent from Master-node_services: %s -url: %s -group: %s " %
            (node_services, url, group))

        proxy = ServerProxy(url)
        raw_node_result = proxy.sample(node_services)
        log_root.info(
            "Raw Info received from Sampler:  %s" % raw_node_result)
        return raw_node_result
开发者ID:Claire-Sun,项目名称:Lab_python,代码行数:16,代码来源:master.py

示例3: test_sample_server

# 需要导入模块: from xmlrpclib import ServerProxy [as 别名]
# 或者: from xmlrpclib.ServerProxy import sample [as 别名]
    def test_sample_server(self):
        """
        This test case to test sampler response.
        :return:
        """
        fake_uri = "http://localhost:8000/"
        proxy = ServerProxy(fake_uri)

        dict_service_a = {"name": "$$test_service_a$$",
                          "ip": TEST_IP,
                          "check_methods": TEST_METHOD}
        dict_service_b = {"name": "$$test_service_b$$",
                          "ip": TEST_IP,
                          "check_methods": TEST_METHOD}

        fake_services = [dict_service_a, dict_service_b]
        self.assertEquals(proxy.sample(fake_services), 1,
                          "Failed to return result from sampler.")
开发者ID:Claire-Sun,项目名称:Lab_python,代码行数:20,代码来源:test_sampler.py


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