本文整理匯總了Python中psdash.run.PsDashRunner.get_node方法的典型用法代碼示例。如果您正苦於以下問題:Python PsDashRunner.get_node方法的具體用法?Python PsDashRunner.get_node怎麽用?Python PsDashRunner.get_node使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類psdash.run.PsDashRunner
的用法示例。
在下文中一共展示了PsDashRunner.get_node方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_register_agent_to_auth_protected_host
# 需要導入模塊: from psdash.run import PsDashRunner [as 別名]
# 或者: from psdash.run.PsDashRunner import get_node [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)
示例2: test_register_agent_without_name_defaults_to_hostname
# 需要導入模塊: from psdash.run import PsDashRunner [as 別名]
# 或者: from psdash.run.PsDashRunner import get_node [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)
示例3: test_register_agent
# 需要導入模塊: from psdash.run import PsDashRunner [as 別名]
# 或者: from psdash.run.PsDashRunner import get_node [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)