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


Python Service.perform_sync方法代码示例

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


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

示例1: __new__

# 需要导入模块: from cocaine.services import Service [as 别名]
# 或者: from cocaine.services.Service import perform_sync [as 别名]
 def __new__(cls):
     if not hasattr(cls, "_instanse"):
         instanse = object.__new__(cls)
         try:
             _logger = Service("logging")
             for verbosity in _logger.perform_sync("verbosity"): #only one chunk and read choke also.
                 pass
             setattr(instanse, "_logger", _logger)
             try:
                 setattr(instanse, "target", "app/%s" % sys.argv[sys.argv.index("--app") + 1])
             except ValueError: 
                 setattr(instanse, "target", "app/%s" % "standalone" )
             _construct_logger_methods(instanse, verbosity)
         except Exception as err:
             instanse = _STDERR_Logger()
             instanse.warn("Logger init error: %s. Use stderr logger" % err)
         cls._instanse = instanse
     return cls._instanse
开发者ID:mou,项目名称:cocaine-framework-python,代码行数:20,代码来源:logger.py

示例2: on

# 需要导入模块: from cocaine.services import Service [as 别名]
# 或者: from cocaine.services.Service import perform_sync [as 别名]
# coding=utf-8
from tornado.ioloop import IOLoop
from cocaine.services import Service

__author__ = 'EvgenySafronov <[email protected]>'


if __name__ == '__main__2':
    def on(chunk):
        print('Response received - {0}'.format(chunk))
        loop.stop()

    def error(exception):
        print('Error received - {0}'.format(exception))
        loop.stop()

    service = Service('Echo')
    future = service.invoke('doIt', 'SomeMessage')
    future.bind(on, error)
    loop = IOLoop.instance()
    loop.start()

if __name__ == '__main__':
    service = Service('Echo')
    for chunk in service.perform_sync('invoke', 'doIt', 'SomeMessage'):
        print('Response received - {0}'.format(chunk))
开发者ID:m0sth8,项目名称:cocaine-framework-python,代码行数:28,代码来源:check.py


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