yandextank/plugins/Phantom/utils.py
def compose_config(self):
        """        Generate phantom tool run config        """
        streams_config = ''
        stat_benchmarks = ''
        for stream in self.streams:
            streams_config += stream.compose_config()
            if not stream.is_main:
                stat_benchmarks += " " + "benchmark_io%s" % stream.sequence_no

        kwargs = {}
        kwargs['threads'] = self.threads
        kwargs['phantom_log'] = self.phantom_log
        kwargs['stat_log'] = self.stat_log
        kwargs['benchmarks_block'] = streams_config
        kwargs['stat_benchmarks'] = stat_benchmarks
        kwargs['additional_libs'] = self.additional_libs
        kwargs['phantom_modules_path'] = self.phantom_modules_path
        filename = self.core.mkstemp(".conf", "phantom_")
        self.core.add_artifact_file(filename)
        logger.debug("Generating phantom config: %s", filename)
        template_str = resource_string(__name__, "config/phantom.conf.tpl")
        tpl = string.Template(template_str)
        config = tpl.substitute(kwargs)

        with open(filename, 'w') as conffile:
            conffile.write(config)
        return filename
def compose_config(self):
        streams_config = ''
        stat_benchmarks = ''
        for stream in self.streams:
            streams_config += stream.compose_config()
            if not stream.is_main:
                stat_benchmarks += " " + "benchmark_io%s" % stream.sequence_no

        kwargs = {}
        kwargs['threads'] = self.threads
        kwargs['phantom_log'] = self.phantom_log
        kwargs['stat_log'] = self.stat_log
        kwargs['benchmarks_block'] = streams_config
        kwargs['stat_benchmarks'] = stat_benchmarks
        kwargs['additional_libs'] = self.additional_libs
        kwargs['phantom_modules_path'] = self.phantom_modules_path
        filename = self.core.mkstemp(".conf", "phantom_")
        self.core.add_artifact_file(filename)
        logger.debug("Generating phantom config: %s", filename)
        template_str = resource_string(__name__, "config/phantom.conf.tpl")
        tpl = string.Template(template_str)
        config = tpl.substitute(kwargs)

        with open(filename, 'w') as conffile:
            conffile.write(config)
        return filename
def compose_config ( self ) : streams_config = '' stat_benchmarks = '' for stream in self . streams : streams_config += stream . compose_config ( ) if not stream . is_main : stat_benchmarks += " " + "benchmark_io%s" % stream . sequence_no kwargs = { } kwargs [ 'threads' ] = self . threads kwargs [ 'phantom_log' ] = self . phantom_log kwargs [ 'stat_log' ] = self . stat_log kwargs [ 'benchmarks_block' ] = streams_config kwargs [ 'stat_benchmarks' ] = stat_benchmarks kwargs [ 'additional_libs' ] = self . additional_libs kwargs [ 'phantom_modules_path' ] = self . phantom_modules_path filename = self . core . mkstemp ( ".conf" , "phantom_" ) self . core . add_artifact_file ( filename ) logger . debug ( "Generating phantom config: %s" , filename ) template_str = resource_string ( __name__ , "config/phantom.conf.tpl" ) tpl = string . Template ( template_str ) config = tpl . substitute ( kwargs ) with open ( filename , 'w' ) as conffile : conffile . write ( config ) return filename
Generate phantom tool run config
Generate phantom tool run config