本文整理汇总了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
示例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))