Пример #1
0
 def __init__(self,
              cfg,
              sources=False,
              build=False,
              distribution=False,
              external=False,
              docker=False):
     self.cfg = cfg
     self.track = track.load_track(self.cfg)
     challenge_name = self.cfg.opts("track", "challenge.name")
     challenge = self.track.find_challenge_or_default(challenge_name)
     if challenge is None:
         raise exceptions.SystemSetupError(
             "Track [%s] does not provide challenge [%s]. List the available tracks with %s list tracks."
             % (self.track.name, challenge_name, PROGRAM_NAME))
     self.metrics_store = metrics.metrics_store(self.cfg,
                                                track=self.track.name,
                                                challenge=challenge.name,
                                                read_only=False)
     self.race_store = metrics.race_store(self.cfg)
     self.sources = sources
     self.build = build
     self.distribution = distribution
     self.external = external
     self.docker = docker
     self.actor_system = None
     self.mechanic = None
Пример #2
0
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))
Пример #3
0
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))
Пример #4
0
    def setup(self, sources=False):
        # to load the track we need to know the correct cluster distribution version. Usually, this value should be set
        # but there are rare cases (external pipeline and user did not specify the distribution version) where we need
        # to derive it ourselves. For source builds we always assume "master"
        if not sources and not self.cfg.exists("mechanic", "distribution.version"):
            distribution_version = mechanic.cluster_distribution_version(self.cfg)
            self.logger.info("Automatically derived distribution version [%s]", distribution_version)
            self.cfg.add(config.Scope.benchmark, "mechanic", "distribution.version", distribution_version)
            min_es_version = versions.Version.from_string(version.minimum_es_version())
            specified_version = versions.Version.from_string(distribution_version)
            if specified_version < min_es_version:
                raise exceptions.SystemSetupError(f"Cluster version must be at least [{min_es_version}] but was [{distribution_version}]")

        self.current_track = track.load_track(self.cfg)
        self.track_revision = self.cfg.opts("track", "repository.revision", mandatory=False)
        challenge_name = self.cfg.opts("track", "challenge.name")
        self.current_challenge = self.current_track.find_challenge_or_default(challenge_name)
        if self.current_challenge is None:
            raise exceptions.SystemSetupError(
                "Track [{}] does not provide challenge [{}]. List the available tracks with {} list tracks.".format(
                    self.current_track.name, challenge_name, PROGRAM_NAME))
        if self.current_challenge.user_info:
            console.info(self.current_challenge.user_info)
        self.race = metrics.create_race(self.cfg, self.current_track, self.current_challenge, self.track_revision)

        self.metrics_store = metrics.metrics_store(
            self.cfg,
            track=self.race.track_name,
            challenge=self.race.challenge_name,
            read_only=False
        )
        self.race_store = metrics.race_store(self.cfg)
Пример #5
0
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)
Пример #6
0
    def setup(self, msg, sender):
        self.start_sender = sender
        self.cfg = msg.cfg
        # to load the track we need to know the correct cluster distribution version. Usually, this value should be set but there are rare
        # cases (external pipeline and user did not specify the distribution version) where we need to derive it ourselves. For source
        # builds we always assume "master"
        if not msg.sources and not self.cfg.exists("mechanic",
                                                   "distribution.version"):
            distribution_version = mechanic.cluster_distribution_version(
                self.cfg)
            if not distribution_version:
                raise exceptions.SystemSetupError(
                    "A distribution version is required. Please specify it with --distribution-version."
                )
            self.logger.info("Automatically derived distribution version [%s]",
                             distribution_version)
            self.cfg.add(config.Scope.benchmark, "mechanic",
                         "distribution.version", distribution_version)

        t = track.load_track(self.cfg)
        self.track_revision = self.cfg.opts("track",
                                            "repository.revision",
                                            mandatory=False)
        challenge_name = self.cfg.opts("track", "challenge.name")
        challenge = t.find_challenge_or_default(challenge_name)
        if challenge is None:
            raise exceptions.SystemSetupError(
                "Track [%s] does not provide challenge [%s]. List the available tracks with %s list tracks."
                % (t.name, challenge_name, PROGRAM_NAME))
        if challenge.user_info:
            console.info(challenge.user_info)
        self.race = metrics.create_race(self.cfg, t, challenge,
                                        self.track_revision)

        self.metrics_store = metrics.metrics_store(
            self.cfg,
            track=self.race.track_name,
            challenge=self.race.challenge_name,
            read_only=False)
        self.race_store = metrics.race_store(self.cfg)
        self.logger.info("Asking mechanic to start the engine.")
        cluster_settings = challenge.cluster_settings
        self.mechanic = self.createActor(
            mechanic.MechanicActor,
            targetActorRequirements={"coordinator": True})
        self.send(
            self.mechanic,
            mechanic.StartEngine(self.cfg, self.metrics_store.open_context,
                                 cluster_settings, msg.sources, msg.build,
                                 msg.distribution, msg.external, msg.docker))
Пример #7
0
    def setup(self, msg):
        self.mechanic = self.createActor(mechanic.MechanicActor,
                                         #globalName="/rally/mechanic/coordinator",
                                         targetActorRequirements={"coordinator": True})

        self.cfg = msg.cfg
        # to load the track we need to know the correct cluster distribution version. Usually, this value should be set but there are rare
        # cases (external pipeline and user did not specify the distribution version) where we need to derive it ourselves. For source
        # builds we always assume "master"
        if not msg.sources and not self.cfg.exists("mechanic", "distribution.version"):
            distribution_version = mechanic.cluster_distribution_version(self.cfg)
            if not distribution_version:
                raise exceptions.SystemSetupError("A distribution version is required. Please specify it with --distribution-version.")
            logger.info("Automatically derived distribution version [%s]" % distribution_version)
            self.cfg.add(config.Scope.benchmark, "mechanic", "distribution.version", distribution_version)

        t = track.load_track(self.cfg)
        challenge_name = self.cfg.opts("track", "challenge.name")
        challenge = t.find_challenge_or_default(challenge_name)
        if challenge is None:
            raise exceptions.SystemSetupError("Track [%s] does not provide challenge [%s]. List the available tracks with %s list tracks."
                                              % (t.name, challenge_name, PROGRAM_NAME))
        if challenge.user_info:
            console.info(challenge.user_info, logger=logger)
        self.race = metrics.create_race(self.cfg, t, challenge)

        self.metrics_store = metrics.metrics_store(
            self.cfg,
            track=self.race.track_name,
            challenge=self.race.challenge_name,
            read_only=False
        )
        self.lap_counter = LapCounter(self.race, self.metrics_store, self.cfg)
        self.race_store = metrics.race_store(self.cfg)
        logger.info("Asking mechanic to start the engine.")
        cluster_settings = self.race.challenge.cluster_settings
        self.send(self.mechanic, mechanic.StartEngine(self.cfg, self.metrics_store.open_context, cluster_settings, msg.sources, msg.build,
                                                      msg.distribution, msg.external, msg.docker))
Пример #8
0
 def __init__(self,
              cfg,
              sources=False,
              build=False,
              distribution=False,
              external=False,
              docker=False):
     self.cfg = cfg
     self.track = track.load_track(self.cfg)
     self.metrics_store = metrics.metrics_store(
         self.cfg,
         track=self.track.name,
         challenge=self.track.find_challenge_or_default(
             self.cfg.opts("track", "challenge.name")).name,
         read_only=False)
     self.race_store = metrics.race_store(self.cfg)
     self.sources = sources
     self.build = build
     self.distribution = distribution
     self.external = external
     self.docker = docker
     self.actor_system = None
     self.mechanic = None
Пример #9
0
 def setup(self):
     self.mechanic.prepare_candidate()
     self.cluster = self.mechanic.start_engine()
     self.track = track.load_track(self.cfg)
     metrics.race_store(self.cfg).store_race(self.track)
     self.actor_system = thespian.actors.ActorSystem()
Пример #10
0
 def _load_track(self):
     return track.load_track(self.cfg)
Пример #11
0
def load_track(cfg, name=None):
    # hack to make this work with multiple tracks (Rally core is usually not meant to be used this way)
    if name:
        cfg.add(config.Scope.applicationOverride, "track", "track.name", name)
    return track.load_track(cfg)
Пример #12
0
 def setup(self):
     self.actor_system = thespian.actors.ActorSystem()
     self.mechanic.start_engine()
     self.track = track.load_track(self.cfg)
     metrics.race_store(self.cfg).store_race(self.track)