本文整理汇总了Python中terminal.Terminal.shell方法的典型用法代码示例。如果您正苦于以下问题:Python Terminal.shell方法的具体用法?Python Terminal.shell怎么用?Python Terminal.shell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类terminal.Terminal
的用法示例。
在下文中一共展示了Terminal.shell方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Theatre
# 需要导入模块: from terminal import Terminal [as 别名]
# 或者: from terminal.Terminal import shell [as 别名]
class Theatre(object):
def __init__(self, here, manager_loc, core_store, store_lock, current_id, id_lock, current_creator, creator_lock, port_range, f = None, args = None, kwds = None, ps = None):
log.debug(self, 'starting')
self.__here = here
port = ids.port_from_loc(here)
self.__shared_data = Shared(port, current_id, id_lock, core_store, store_lock, current_creator, creator_lock, port_range)
self.__actor_store = LocalActorStore(self.__here, self.__shared_data)
self.__messenger = Messenger(here, self.__actor_store)
self.__migrator = Migrator(here, self.__actor_store, self.__shared_data)
self.__manager_loc = manager_loc
self.__port_range = port_range
self.__term = None
self.__processes = ps
if (port == port_range[0]):
self.__term = Terminal(self, here)
self.valve = rpc.RPCValve(port, self.external_interface(), log)
set_local_theatre(self.internal_interface())
self.valve.listen()
print('Theatre created on port ' + str(port))
vis.add_host(here)
if (port != port_range[0]):
while True:
try:
time.sleep(5)
except:
pass
else:
self.f = f
self.f(*args, **kwds)
self.__term.shell()
def external_interface(self):
return TheatreExternalInterface(self.__messenger, self.__migrator, self.__term, self, self.__actor_store)
def internal_interface(self):
return TheatreInternalInterface(self.__here, self.__messenger, self.__actor_store, self.__migrator, self.__manager_loc, self.__shared_data)
def shutdown(self):
for port in self.__port_range:
if (port != self.__port_range[0]):
network_locator = rpc.RPCConnector("127.0.0.1:" + str(port))
locator = network_locator.connect()
locator.shutdown()
locator.disconnect()
self.valve.shutdown()
time.sleep(2)
for p in self.__processes:
p.terminate()
time.sleep(2)
sys.exit()
def __str__(self):
return "Theatre"