Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#
# WARNING:root:Unable to get address info for address 103.1.168.192.in-addr.arpa (AddressFamily.AF_INET,\
# SocketKind.SOCK_DGRAM, 17, 0): [Errno 8] nodename nor servname provided, or not known
#
# Therefore, we will not show warnings but only errors.
logging.basicConfig(level=logging.ERROR)
running_system = actor.bootstrap_actor_system(try_join=True)
running_system.shutdown()
# await termination...
console.info("Shutting down actor system.", end="", flush=True)
while actor.actor_system_already_running():
console.println(".", end="", flush=True)
time.sleep(1)
console.println(" [OK]")
except BaseException:
console.error("Could not shut down actor system.")
if raise_errors:
# raise again so user can see the error
raise
elif raise_errors:
console.error("Could not shut down actor system: Actor system is not running.")
sys.exit(1)
def challenge_info(c):
if not c.auto_generated:
msg = "Challenge [{}]".format(c.name)
if c.default:
msg += " (run by default)"
console.println(msg, underline="=", overline="=")
if c.description:
console.println("\n{}".format(c.description))
console.println("\nSchedule:", underline="-")
console.println("")
for num, task in enumerate(c.schedule, start=1):
if task.nested:
console.println(format_task(task, suffix=":", num="{}. ".format(num)))
for leaf_num, leaf_task in enumerate(task, start=1):
console.println(format_task(leaf_task, indent="\t", num="{}.{} ".format(num, leaf_num)))
else:
console.println(format_task(task, num="{}. ".format(num)))
ops = self.parse_operations(self._r(track_spec, "operations", mandatory=False, default_value=[]))
challenges = []
known_challenge_names = set()
default_challenge = None
challenge_specs, auto_generated = self._get_challenge_specs(track_spec)
number_of_challenges = len(challenge_specs)
for challenge_spec in challenge_specs:
name = self._r(challenge_spec, "name", error_ctx="challenges")
description = self._r(challenge_spec, "description", error_ctx=name, mandatory=False)
user_info = self._r(challenge_spec, "user-info", error_ctx=name, mandatory=False)
meta_data = self._r(challenge_spec, "meta", error_ctx=name, mandatory=False)
# if we only have one challenge it is treated as default challenge, no matter what the user has specified
default = number_of_challenges == 1 or self._r(challenge_spec, "default", error_ctx=name, mandatory=False)
cluster_settings = self._r(challenge_spec, "cluster-settings", error_ctx=name, mandatory=False)
if cluster_settings:
console.warn("Track [{}] uses the deprecated property [cluster-settings]. Please replace it with an "
"explicit call to the cluster settings API.".format(self.name), logger=self.logger)
if default and default_challenge is not None:
self._error("Both '%s' and '%s' are defined as default challenges. Please define only one of them as default."
% (default_challenge.name, name))
if name in known_challenge_names:
self._error("Duplicate challenge with name '%s'." % name)
known_challenge_names.add(name)
schedule = []
for op in self._r(challenge_spec, "schedule", error_ctx=name):
if "parallel" in op:
task = self.parse_parallel(op["parallel"], ops, name)
else:
task = self.parse_task(op, ops, name)
elif client_cert and client_key:
self.logger.info("SSL client authentication: on")
self.ssl_context.load_cert_chain(certfile=client_cert,
keyfile=client_key)
else:
self.logger.info("SSL support: off")
self.client_options["scheme"] = "http"
if self._is_set(self.client_options, "basic_auth_user") and self._is_set(self.client_options, "basic_auth_password"):
self.logger.info("HTTP basic authentication: on")
self.client_options["http_auth"] = (self.client_options.pop("basic_auth_user"), self.client_options.pop("basic_auth_password"))
else:
self.logger.info("HTTP basic authentication: off")
if self._is_set(self.client_options, "compressed"):
console.warn("You set the deprecated client option 'compressed‘. Please use 'http_compress' instead.", logger=self.logger)
self.client_options["http_compress"] = self.client_options.pop("compressed")
if self._is_set(self.client_options, "http_compress"):
self.logger.info("HTTP compression: on")
else:
self.logger.info("HTTP compression: off")
appropriate messages.
:param target: A target that will be notified of important events.
:param config: The current config object.
"""
self.logger = logging.getLogger(__name__)
self.target = target
self.config = config
self.es_client_factory = es_client_factory_class
self.track = None
self.challenge = None
self.metrics_store = None
self.load_driver_hosts = []
self.drivers = []
self.progress_reporter = console.progress()
self.progress_counter = 0
self.quiet = False
self.allocations = None
self.raw_samples = []
self.throughput_calculator = None
self.most_recent_sample_per_client = {}
self.number_of_steps = 0
self.currently_completed = 0
self.clients_completed_current_step = {}
self.current_step = -1
self.tasks_per_join_point = None
self.complete_current_task_sent = False
self.telemetry = None
def print_internal(message):
console.println(message, logger=logging.getLogger(__name__).info)
Coordinates all workers. It is technology-agnostic, i.e. it does not know anything about actors. To allow us to hook in an actor,
we provide a ``target`` parameter which will be called whenever some event has occurred. The ``target`` can use this to send
appropriate messages.
:param target: A target that will be notified of important events.
:param config: The current config object.
"""
self.target = target
self.config = config
self.track = None
self.challenge = None
self.metrics_store = None
self.load_driver_hosts = []
self.drivers = []
self.progress_reporter = console.progress()
self.progress_counter = 0
self.quiet = False
self.allocations = None
self.raw_samples = []
self.throughput_calculator = None
self.most_recent_sample_per_client = {}
self.number_of_steps = 0
self.currently_completed = 0
self.clients_completed_current_step = {}
self.current_step = -1
self.ops_per_join_point = None
self.complete_current_task_sent = False