def allocate_remotes(remotes):
"""
Utility method for building a Malmo ClientPool.
Using this method allows sharing the same ClientPool across
mutiple experiment
:param remotes: tuple or array of tuples. Each tuple can be (), (ip,), (ip, port)
:return: Malmo ClientPool with all registered clients
"""
if not isinstance(remotes, list):
remotes = [remotes]
pool = ClientPool()
for remote in remotes:
if isinstance(remote, ClientInfo):
pool.add(remote)
elif isinstance(remote, Sequence):
if len(remote) == 0:
pool.add(ClientInfo('localhost', 10000))
elif len(remote) == 1:
pool.add(ClientInfo(remote[0], 10000))
else:
pool.add(ClientInfo(remote[0], int(remote[1])))
return pool
评论列表
文章目录