in esrally/actor.py [0:0]
def bootstrap_actor_system(try_join=False, prefer_local_only=False, local_ip=None, coordinator_ip=None):
logger = logging.getLogger(__name__)
system_base = __SYSTEM_BASE
try:
if try_join:
if actor_system_already_running():
logger.debug("Joining already running actor system with system base [%s].", system_base)
return thespian.actors.ActorSystem(system_base)
else:
logger.debug("Creating new actor system with system base [%s] on coordinator node.", system_base)
# if we try to join we can only run on the coordinator...
return thespian.actors.ActorSystem(system_base, logDefs=log.load_configuration(), capabilities={"coordinator": True})
elif prefer_local_only:
coordinator = True
if system_base != "multiprocQueueBase":
coordinator_ip = "127.0.0.1"
local_ip = "127.0.0.1"
else:
coordinator_ip = None
local_ip = None
else:
if system_base not in ("multiprocTCPBase", "multiprocUDPBase"):
raise exceptions.SystemSetupError("Rally requires a network-capable system base but got [%s]." % system_base)
if not coordinator_ip:
raise exceptions.SystemSetupError("coordinator IP is required")
if not local_ip:
raise exceptions.SystemSetupError("local IP is required")
# always resolve the public IP here, even if a DNS name is given. Otherwise Thespian will be unhappy
local_ip = net.resolve(local_ip)
coordinator_ip = net.resolve(coordinator_ip)
coordinator = local_ip == coordinator_ip
capabilities = {"coordinator": coordinator}
if local_ip:
# just needed to determine whether to run benchmarks locally
capabilities["ip"] = local_ip
if coordinator_ip:
# Make the coordinator node the convention leader
capabilities["Convention Address.IPv4"] = "%s:1900" % coordinator_ip
logger.info("Starting actor system with system base [%s] and capabilities [%s].", system_base, capabilities)
return thespian.actors.ActorSystem(system_base, logDefs=log.load_configuration(), capabilities=capabilities)
except thespian.actors.ActorSystemException:
logger.exception("Could not initialize internal actor system.")
raise