def start(authkey, queues, mode='local'):
"""Create a new multiprocess.Manager (or return existing one).
Args:
:authkey: string authorization key
:queues: *INTERNAL_USE*
:mode: 'local' indicates that the manager will only be accessible from the same host, otherwise remotely accessible.
Returns:
A TFManager instance, which is also cached in local memory of the Python worker process.
"""
global mgr, qdict, kdict
qdict.clear()
kdict.clear()
for q in queues:
qdict[q] = JoinableQueue()
TFManager.register('get_queue', callable=lambda qname: qdict[qname])
TFManager.register('get', callable=lambda key: _get(key))
TFManager.register('set', callable=lambda key, value: _set(key, value))
if mode == 'remote':
mgr = TFManager(address=('',0), authkey=authkey)
else:
mgr = TFManager(authkey=authkey)
mgr.start()
return mgr
评论列表
文章目录