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


Python PsDashRunner.get_nodes方法代码示例

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


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

示例1: test_nodes_from_config

# 需要导入模块: from psdash.run import PsDashRunner [as 别名]
# 或者: from psdash.run.PsDashRunner import get_nodes [as 别名]
 def test_nodes_from_config(self):
     config = {
         'PSDASH_NODES': [
             {
                 'name': 'test-node',
                 'host': 'remotehost.org',
                 'port': 5000
             }
         ]
     }
     r = PsDashRunner(config)
     self.assertEqual(len(r.get_nodes()), 2)
     self.assertIn('remotehost.org:5000', r.get_nodes())
     self.assertEqual(r.get_nodes()['remotehost.org:5000'].name, 'test-node')
     self.assertEqual(r.get_nodes()['remotehost.org:5000'].host, 'remotehost.org')
     self.assertEqual(r.get_nodes()['remotehost.org:5000'].port, 5000)
开发者ID:ArcherSys,项目名称:psdash,代码行数:18,代码来源:test_run.py

示例2: test_register_agent_to_auth_protected_host

# 需要导入模块: from psdash.run import PsDashRunner [as 别名]
# 或者: from psdash.run.PsDashRunner import get_nodes [as 别名]
    def test_register_agent_to_auth_protected_host(self):
        r = PsDashRunner({
            'PSDASH_AUTH_USERNAME': 'user',
            'PSDASH_AUTH_PASSWORD': 'pass'
        })
        agent = PsDashRunner({
            'PSDASH_AGENT': True,
            'PSDASH_PORT': 5001,
            'PSDASH_REGISTER_TO': 'http://localhost:5000',
            'PSDASH_AUTH_USERNAME': 'user',
            'PSDASH_AUTH_PASSWORD': 'pass'
        })
        jobs = []
        jobs.append(gevent.spawn(r.run))
        gevent.sleep(0.3)
        jobs.append(gevent.spawn(agent.run))
        gevent.sleep(0.3)

        self.assertIn('127.0.0.1:5001', r.get_nodes())
        self.assertEquals(r.get_node('127.0.0.1:5001').name, socket.gethostname())
        self.assertEquals(r.get_node('127.0.0.1:5001').port, 5001)

        r.server.close()
        agent.server.close()
        gevent.killall(jobs)
开发者ID:ArcherSys,项目名称:psdash,代码行数:27,代码来源:test_run.py

示例3: test_register_agent_without_name_defaults_to_hostname

# 需要导入模块: from psdash.run import PsDashRunner [as 别名]
# 或者: from psdash.run.PsDashRunner import get_nodes [as 别名]
    def test_register_agent_without_name_defaults_to_hostname(self):
        agent_options = {
            'PSDASH_AGENT': True,
            'PSDASH_PORT': 5001,
            'PSDASH_REGISTER_TO': 'http://localhost:5000'
        }
        r = PsDashRunner()
        agent = PsDashRunner(agent_options)
        jobs = []
        jobs.append(gevent.spawn(r.run))
        gevent.sleep(0.3)
        jobs.append(gevent.spawn(agent.run))
        gevent.sleep(0.3)

        self.assertIn('127.0.0.1:5001', r.get_nodes())
        self.assertEquals(r.get_node('127.0.0.1:5001').name, socket.gethostname())
        self.assertEquals(r.get_node('127.0.0.1:5001').port, 5001)

        r.server.close()
        agent.server.close()
        gevent.killall(jobs)
开发者ID:ArcherSys,项目名称:psdash,代码行数:23,代码来源:test_run.py

示例4: test_register_agent

# 需要导入模块: from psdash.run import PsDashRunner [as 别名]
# 或者: from psdash.run.PsDashRunner import get_nodes [as 别名]
    def test_register_agent(self):
        agent_options = {
            'PSDASH_AGENT': True,
            'PSDASH_PORT': 5001,
            'PSDASH_REGISTER_TO': 'localhost:5000',
            'PSDASH_REGISTER_AS': 'the_agent'
        }
        r = PsDashRunner()
        agent = PsDashRunner(agent_options)
        jobs = []
        jobs.append(gevent.spawn(r.run))
        gevent.sleep(0.2)
        jobs.append(gevent.spawn(agent.run))
        gevent.sleep(0.2)

        self.assertIn('127.0.0.1:5001', r.get_nodes())
        self.assertEquals(r.get_node('127.0.0.1:5001').name, 'the_agent')
        self.assertEquals(r.get_node('127.0.0.1:5001').port, 5001)

        r.server.close()
        agent.server.close()
        gevent.killall(jobs)
开发者ID:achun2080,项目名称:psdash,代码行数:24,代码来源:test_run.py

示例5: test_get_all_nodes

# 需要导入模块: from psdash.run import PsDashRunner [as 别名]
# 或者: from psdash.run.PsDashRunner import get_nodes [as 别名]
 def test_get_all_nodes(self):
     r = PsDashRunner()
     r.register_node('examplehost', 'example.org', 5000)
     self.assertEqual(len(r.get_nodes()), 2) # local + registered
开发者ID:ArcherSys,项目名称:psdash,代码行数:6,代码来源:test_run.py


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