def __call__()

in esrally/track/loader.py [0:0]


    def __call__(self, track_name, track_specification, mapping_dir, spec_file=None):
        self.name = track_name
        self.base_path = os.path.dirname(os.path.abspath(spec_file)) if spec_file else None
        description = self._r(track_specification, "description", mandatory=False, default_value="")

        meta_data = self._r(track_specification, "meta", mandatory=False)
        indices = [
            self._create_index(idx, mapping_dir) for idx in self._r(track_specification, "indices", mandatory=False, default_value=[])
        ]
        data_streams = [
            self._create_data_stream(idx) for idx in self._r(track_specification, "data-streams", mandatory=False, default_value=[])
        ]
        if len(indices) > 0 and len(data_streams) > 0:
            # we guard against this early and support either or
            raise TrackSyntaxError("indices and data-streams cannot both be specified")
        templates = [
            self._create_index_template(tpl, mapping_dir)
            for tpl in self._r(track_specification, "templates", mandatory=False, default_value=[])
        ]
        composable_templates = [
            self._create_index_template(tpl, mapping_dir)
            for tpl in self._r(track_specification, "composable-templates", mandatory=False, default_value=[])
        ]
        component_templates = [
            self._create_component_template(tpl, mapping_dir)
            for tpl in self._r(track_specification, "component-templates", mandatory=False, default_value=[])
        ]
        corpora = self._create_corpora(self._r(track_specification, "corpora", mandatory=False, default_value=[]), indices, data_streams)
        challenges = self._create_challenges(track_specification)
        dependencies = self._r(track_specification, "dependencies", mandatory=False)
        # at this point, *all* track params must have been referenced in the templates
        return track.Track(
            name=self.name,
            meta_data=meta_data,
            description=description,
            challenges=challenges,
            indices=indices,
            data_streams=data_streams,
            templates=templates,
            composable_templates=composable_templates,
            component_templates=component_templates,
            corpora=corpora,
            dependencies=dependencies,
            root=self.base_path,
        )