• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python controller.start_controller函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中pyactive.controller.start_controller函数的典型用法代码示例。如果您正苦于以下问题:Python start_controller函数的具体用法?Python start_controller怎么用?Python start_controller使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: create_host

def create_host():
    start_controller("pyactive_thread")
    tcpconf = ('tcp', ('127.0.0.1', 9899))
    global host
    host = init_host(tcpconf)
    global remote_host
    remote_host = host.lookup(settings.PYACTIVE_URL+'controller/Host/0')
开发者ID:iostackproject,项目名称:Crystal-Controller,代码行数:7,代码来源:views.py


示例2: test

def test():
    lP = []
    lA = []
    lL = []
    start_controller('pyactive_thread')
    host = init_host()
#     log = host.spawn_id('log', 'main', 'LogUML', [])
#     host.set_tracer(log)
#     interval(1, save_log, log)
    for i in range(0, N_LEARNERS):
        l = host.spawn_id(str(i), 'paxos_protocol', 'Learner',[N_ACCEPTORS])
        lL.append(l)
    for i in range(0, N_ACCEPTORS):
        a = host.spawn_id(str(i+N_LEARNERS), 'paxos_protocol', 'Acceptor', [N_ACCEPTORS])
        a.set_multi(lL)
        lA.append(a)    
    for i in range(0,N_PROPOSERS):
        p = host.spawn_id(str(i+N_LEARNERS+N_ACCEPTORS+5), 'paxos_protocol', 'Proposer', [N_ACCEPTORS])
        
        num = int(random.random() * 100)
        print i, num
        p.set_proposal(num)
        lP.append(p)
    lP[0].set_multi([lA[0], lA[1],lA[2]])
    lP[1].set_multi([lA[2], lA[3],lA[4]])
    lP[2].set_multi([lA[0], lA[1],lA[2]])
    lP[3].set_multi([lA[2], lA[3],lA[4]])
#     p = AMulti(lP)
#     p.prepare()
    lP[3].prepare()
    lP[0].prepare()
    lP[1].prepare()
    lP[2].prepare()
开发者ID:raqueleyeos,项目名称:pyactive,代码行数:33,代码来源:main.py


示例3: main

def main(argv):
    
    global NUM_NODES, NUM_MSGS
      
    NUM_NODES = int(argv[0])
    NUM_MSGS = int(argv[1])
    start_controller('pyactive_thread')
    launch(testN)
    print 'finish!'
开发者ID:sergitoda,项目名称:pyactive,代码行数:9,代码来源:ring3.py


示例4: main

def main():
    start_controller('pyactive_thread')
    launch(test_2pc)
    print 'now testing bad...'
    launch(test_2pc_bad)
开发者ID:cloudspaces,项目名称:pyactive,代码行数:5,代码来源:2pc_multi.py


示例5: main

def main():
    start_controller("tasklet")
    serve_forever(test3)
开发者ID:sergitoda,项目名称:pyactive,代码行数:3,代码来源:server.py


示例6: setUpClass

 def setUpClass(cls):
     super(Test, cls).setUpClass()
     tcpconf = ('tcp',('127.0.0.1',6842))
     start_controller('pyactive_thread')
     cls.host = init_host(tcpconf)
开发者ID:sergitoda,项目名称:pyactive,代码行数:5,代码来源:test_remote.py


示例7: main

def main():
    start_controller('pyactive_thread')
    launch(test3)
开发者ID:cloudspaces,项目名称:pyactive,代码行数:3,代码来源:fourth.py


示例8: main

def main():
    start_controller('pyactive_thread')
    serve_forever(example1)
开发者ID:cloudspaces,项目名称:pyactive,代码行数:3,代码来源:example3.py


示例9: setUp

 def setUp(self):
     unittest.TestCase.setUp(self)
     start_controller('tasklet')
     self.host = init_host()
开发者ID:sergitoda,项目名称:pyactive,代码行数:4,代码来源:ring2.py


示例10: setUpClass

 def setUpClass(self):
     tcpconf = ('tcp',('127.0.0.1',6664))
     start_controller('pyactive_thread')
     self.host = init_host(tcpconf)
开发者ID:cloudspaces,项目名称:pyactive,代码行数:4,代码来源:test_remote.py


示例11: main

def main():
    start_controller('pyactive_thread')
    launch(test_remote_spawn)
开发者ID:cloudspaces,项目名称:pyactive,代码行数:3,代码来源:remote_host.py


示例12: main

def main():
    start_controller('pyactive_thread')
    launch(testN)
    print 'finish!'
开发者ID:cloudspaces,项目名称:pyactive,代码行数:4,代码来源:ring3.py


示例13: main

def main():
    start_controller('pyactive_thread')
    serve_forever(start_test)
    print 'hola'
开发者ID:iostackproject,项目名称:Crystal-Controller,代码行数:4,代码来源:test.py


示例14: main

def main():
    start_controller('tasklet')
    serve_forever(test)
开发者ID:cloudspaces,项目名称:pyactive,代码行数:3,代码来源:mpaxos_main.py


示例15: test

def test():
    start_controller("pyactive_thread")
    tcpconf = ('tcp',('127.0.0.1',1232))
    host = init_host(tcpconf)
开发者ID:cloudspaces,项目名称:pyactive,代码行数:4,代码来源:remote_hserver.py


示例16: main

def main():
    start_controller('pyactive_thread')
    serve_forever(test_registry)
开发者ID:cloudspaces,项目名称:pyactive,代码行数:3,代码来源:actor13.py


示例17: main

def main():
    start_controller('pyactive_thread')
    launch(client_test)
开发者ID:cloudspaces,项目名称:pyactive,代码行数:3,代码来源:actor2_client.py


示例18: start_controller

'''
Created on 14/07/2014

@author: edgar
'''
from pyactive.controller import init_host, launch, serve_forever,  start_controller, sleep, interval
from pyactive.exception import TimeoutError

start_controller("pyactive_thread")

momconf = ('mom',{'name':'c1','ip':'127.0.0.1','port':61613,'namespace':'/topic/test_edgar'})
host = init_host(momconf)
#host = init_host(('127.0.0.1',4329),True)
#host = Host(host)
#oref = 'env2:simple:s1:Server'
aref = 'mom://s1/server/Server/0'
ref = host.lookup(aref)

ref.stop_clients()
#ref.run_clients()
开发者ID:cloudspaces,项目名称:pyactive,代码行数:20,代码来源:user_control.py


示例19: setUpClass

 def setUpClass(cls):
     super(Test, cls).setUpClass()
     start_controller('pyactive_thread')
     cls.host = init_host()
开发者ID:sergitoda,项目名称:pyactive,代码行数:4,代码来源:test_async.py


示例20: Test

from pyactive.controller import init_host, launch, start_controller

class Test():
    def __init__(self):
        self.name = None
    
       
    #@async
    def hello_world(self):
        print 'async done'
    
    #@sync(1)     
    def get_name(self):
        return self.name
    #@sync(2)
    def registry_obj(self, obj):
        self.obj = obj
        return True
    
def test3():
    
#    tcpconf = ('tcp',('127.0.0.1',6664))
    host = init_host()
 
    test = host.spawn_id('1','launch','Test',[])
    test.hello_world()
    host.shutdown()

if __name__ == "__main__":
    start_controller('tasklet')
    launch(test3)
开发者ID:raqueleyeos,项目名称:pyactive,代码行数:31,代码来源:launch.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.to_json函数代码示例发布时间:2022-05-25
下一篇:
Python controller.init_host函数代码示例发布时间:2022-05-25
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap