示例#1
0
def load_track(cfg):
    """

    Loads a track

    :param cfg: The config object. It contains the name of the track to load.
    :return: The loaded track.
    """
    track_name = None
    try:
        repo = track_repo(cfg)
        track_name = repo.track_name
        track_dir = repo.track_dir(track_name)
        reader = TrackFileReader(cfg)
        included_tasks = cfg.opts("track", "include.tasks")

        current_track = reader.read(track_name, repo.track_file(track_name),
                                    track_dir)
        current_track = filter_included_tasks(
            current_track, filters_from_included_tasks(included_tasks))
        plugin_reader = TrackPluginReader(track_dir)
        current_track.has_plugins = plugin_reader.can_load()

        if cfg.opts("track", "test.mode.enabled"):
            return post_process_for_test_mode(current_track)
        else:
            return current_track
    except FileNotFoundError:
        logger.exception("Cannot load track [%s]" % track_name)
        raise exceptions.SystemSetupError(
            "Cannot load track %s. List the available tracks with %s list tracks."
            % (track_name, PROGRAM_NAME))
示例#2
0
文件: loader.py 项目: sen0120/rally
def tracks(cfg):
    """

    Lists all known tracks. Note that users can specify a distribution version so if different tracks are available for
    different versions, this will be reflected in the output.

    :param cfg: The config object.
    :return: A list of tracks that are available for the provided distribution version or else for the master version.
    """
    repo = track_repo(cfg)
    reader = TrackFileReader(cfg)
    return [reader.read(track_name,
                        repo.track_file(track_name),
                        repo.track_dir(track_name))
            for track_name in repo.track_names]