def prepare_track(ctx): track_name = ctx.config.opts("system", "track") try: ctx.track = track.load_track(ctx.config, track_name) except FileNotFoundError: logger.error("Cannot load track [%s]" % track_name) raise exceptions.ImproperlyConfigured("Cannot load track %s. You can list the available tracks with %s list tracks." % (track_name, PROGRAM_NAME)) track.prepare_track(ctx.track, ctx.config) race_paths = paths.Paths(ctx.config) track_root = race_paths.track_root(track_name) ctx.config.add(config.Scope.benchmark, "system", "track.root.dir", track_root) selected_challenge = ctx.config.opts("benchmarks", "challenge") for challenge in ctx.track.challenges: if challenge.name == selected_challenge: ctx.challenge = challenge if not ctx.challenge: raise exceptions.ImproperlyConfigured("Unknown challenge [%s] for track [%s]. You can list the available tracks and their " "challenges with %s list tracks." % (selected_challenge, ctx.track.name, PROGRAM_NAME)) race_paths = paths.Paths(ctx.config) ctx.config.add(config.Scope.challenge, "system", "challenge.root.dir", race_paths.challenge_root(ctx.track.name, ctx.challenge.name)) ctx.config.add(config.Scope.challenge, "system", "challenge.log.dir", race_paths.challenge_logs(ctx.track.name, ctx.challenge.name))
def prepare_track(ctx): track_name = ctx.config.opts("system", "track") try: ctx.track = track.load_track(ctx.config, track_name) except FileNotFoundError: logger.error("Cannot load track [%s]" % track_name) raise exceptions.ImproperlyConfigured( "Cannot load track %s. You can list the available tracks with %s list tracks." % (track_name, PROGRAM_NAME)) track.prepare_track(ctx.track, ctx.config) race_paths = paths.Paths(ctx.config) track_root = race_paths.track_root(track_name) ctx.config.add(config.Scope.benchmark, "system", "track.root.dir", track_root) selected_challenge = ctx.config.opts("benchmarks", "challenge") for challenge in ctx.track.challenges: if challenge.name == selected_challenge: ctx.challenge = challenge if not ctx.challenge: raise exceptions.ImproperlyConfigured( "Unknown challenge [%s] for track [%s]. You can list the available tracks and their " "challenges with %s list tracks." % (selected_challenge, ctx.track.name, PROGRAM_NAME)) race_paths = paths.Paths(ctx.config) ctx.config.add( config.Scope.challenge, "system", "challenge.root.dir", race_paths.challenge_root(ctx.track.name, ctx.challenge.name)) ctx.config.add( config.Scope.challenge, "system", "challenge.log.dir", race_paths.challenge_logs(ctx.track.name, ctx.challenge.name))
def prepare_track(ctx): track_name = ctx.config.opts("system", "track") try: ctx.track = track.load_track(ctx.config, track_name) except FileNotFoundError: logger.error("Cannot load track [%s]" % track_name) raise exceptions.ImproperlyConfigured( "Cannot load track %s. You can list the available tracks with %s list tracks." % (track_name, PROGRAM_NAME)) # TODO #71: Reconsider this in case we distribute drivers. *For now* the driver will only be on a single machine, so we're safe. track.prepare_track(ctx.track, ctx.config)
def start_benchmark(self, msg, sender): self.start_sender = sender self.config = msg.config current_track = msg.track logger.info("Preparing track") # TODO #71: Reconsider this in case we distribute drivers. *For now* the driver will only be on a single machine, so we're safe. track.prepare_track(current_track, self.config) logger.info("Benchmark is about to start.") self.quiet = self.config.opts("system", "quiet.mode", mandatory=False, default_value=False) self.es = client.EsClientFactory(self.config.opts("client", "hosts"), self.config.opts("client", "options")).create() self.metrics_store = metrics.InMemoryMetricsStore( config=self.config, meta_info=msg.metrics_meta_info, lap=msg.lap) invocation = self.config.opts("meta", "time.start") expected_cluster_health = self.config.opts("benchmarks", "cluster.health") track_name = self.config.opts("benchmarks", "track") challenge_name = self.config.opts("benchmarks", "challenge") selected_car_name = self.config.opts("benchmarks", "car") self.metrics_store.open(invocation, track_name, challenge_name, selected_car_name) challenge = select_challenge(self.config, current_track) es_version = self.config.opts("source", "distribution.version") for index in current_track.indices: setup_index(self.es, index, challenge.index_settings) wait_for_status(self.es, es_version, expected_cluster_health) allocator = Allocator(challenge.schedule) self.allocations = allocator.allocations self.number_of_steps = len(allocator.join_points) - 1 self.ops_per_join_point = allocator.operations_per_joinpoint logger.info( "Benchmark consists of [%d] steps executed by (at most) [%d] clients as specified by the allocation matrix:\n%s" % (self.number_of_steps, len(self.allocations), self.allocations)) for client_id in range(allocator.clients): self.drivers.append(self.createActor(LoadGenerator)) for client_id, driver in enumerate(self.drivers): self.send( driver, StartLoadGenerator(client_id, self.config, current_track, self.allocations[client_id])) self.update_progress_message() self.wakeupAfter( datetime.timedelta(seconds=Driver.WAKEUP_INTERVAL_SECONDS))
def start_benchmark(self, msg, sender): self.start_sender = sender self.config = msg.config current_track = msg.track logger.info("Preparing track") # TODO #71: Reconsider this in case we distribute drivers. *For now* the driver will only be on a single machine, so we're safe. track.prepare_track(current_track, self.config) logger.info("Benchmark is about to start.") self.quiet = self.config.opts("system", "quiet.mode", mandatory=False, default_value=False) self.es = client.EsClientFactory(self.config.opts("client", "hosts"), self.config.opts("client", "options")).create() self.metrics_store = metrics.InMemoryMetricsStore(config=self.config, meta_info=msg.metrics_meta_info, lap=msg.lap) invocation = self.config.opts("meta", "time.start") expected_cluster_health = self.config.opts("benchmarks", "cluster.health") track_name = self.config.opts("benchmarks", "track") challenge_name = self.config.opts("benchmarks", "challenge") selected_car_name = self.config.opts("benchmarks", "car") self.metrics_store.open(invocation, track_name, challenge_name, selected_car_name) challenge = select_challenge(self.config, current_track) es_version = self.config.opts("source", "distribution.version") for template in current_track.templates: setup_template(self.es, template) for index in current_track.indices: setup_index(self.es, index, challenge.index_settings) wait_for_status(self.es, es_version, expected_cluster_health) allocator = Allocator(challenge.schedule) self.allocations = allocator.allocations self.number_of_steps = len(allocator.join_points) - 1 self.ops_per_join_point = allocator.operations_per_joinpoint logger.info("Benchmark consists of [%d] steps executed by (at most) [%d] clients as specified by the allocation matrix:\n%s" % (self.number_of_steps, len(self.allocations), self.allocations)) for client_id in range(allocator.clients): self.drivers.append(self.createActor(LoadGenerator)) for client_id, driver in enumerate(self.drivers): self.send(driver, StartLoadGenerator(client_id, self.config, current_track, self.allocations[client_id])) self.update_progress_message() self.wakeupAfter(datetime.timedelta(seconds=Driver.WAKEUP_INTERVAL_SECONDS))
def setup(self): if self.track.has_plugins: # no need to fetch the track once more; it has already been updated track.track_repo(self.config, fetch=False, update=False) # load track plugins eagerly to initialize the respective parameter sources track.load_track_plugins(self.config, runner.register_runner, scheduler.register_scheduler) track.prepare_track(self.track, self.config) self.metrics_store = metrics.metrics_store( cfg=self.config, track=self.track.name, challenge=self.challenge.name, read_only=False) self.es_clients = self.create_es_clients() self.wait_for_rest_api() self.prepare_telemetry() cluster_info = self.retrieve_cluster_info() cluster_version = cluster_info["version"] if cluster_info else {} return cluster_version.get("build_flavor", "oss"), cluster_version.get( "number"), cluster_version.get("build_hash")
def start_benchmark(self, msg, sender): self.start_sender = sender self.config = msg.config self.track = msg.track track_name = self.track.name challenge_name = self.track.find_challenge_or_default( self.config.opts("track", "challenge.name")).name selected_car_name = self.config.opts("mechanic", "car.name") logger.info("Preparing track [%s]" % track_name) # TODO #71: Reconsider this in case we distribute drivers. *For now* the driver will only be on a single machine, so we're safe. track.prepare_track(self.track, self.config) logger.info( "Benchmark for track [%s], challenge [%s] and car [%s] is about to start." % (track_name, challenge_name, selected_car_name)) self.quiet = self.config.opts("system", "quiet.mode", mandatory=False, default_value=False) self.es = client.EsClientFactory(self.config.opts("client", "hosts"), self.config.opts("client", "options")).create() self.metrics_store = metrics.InMemoryMetricsStore( cfg=self.config, meta_info=msg.metrics_meta_info, lap=msg.lap) invocation = self.config.opts("system", "time.start") expected_cluster_health = self.config.opts("benchmarks", "cluster.health") self.metrics_store.open(invocation, track_name, challenge_name, selected_car_name) self.challenge = select_challenge(self.config, self.track) for template in self.track.templates: setup_template(self.es, template) for index in self.track.indices: setup_index(self.es, index, self.challenge.index_settings) wait_for_status(self.es, expected_cluster_health) allocator = Allocator(self.challenge.schedule) self.allocations = allocator.allocations self.number_of_steps = len(allocator.join_points) - 1 self.ops_per_join_point = allocator.operations_per_joinpoint logger.info( "Benchmark consists of [%d] steps executed by (at most) [%d] clients as specified by the allocation matrix:\n%s" % (self.number_of_steps, len(self.allocations), self.allocations)) for client_id in range(allocator.clients): self.drivers.append( self.createActor( LoadGenerator, globalName="/rally/driver/worker/%s" % str(client_id), targetActorRequirements={"coordinator": True})) for client_id, driver in enumerate(self.drivers): logger.info("Starting load generator [%d]." % client_id) self.send( driver, StartLoadGenerator(client_id, self.config, self.track, self.allocations[client_id])) self.update_progress_message() self.wakeupAfter( datetime.timedelta(seconds=Driver.WAKEUP_INTERVAL_SECONDS))