#NEWLINE# def _run_scenario( self , cls , method_name , context , args ) : #NEWLINE# #INDENT# 'Runs the specified benchmark scenario with given arguments.\n\n        This method generates a constant load on the cloud under test by\n        executing each scenario iteration using a pool of processes without\n        pausing between iterations up to the number of times specified\n        in the scenario config.\n\n        :param cls: The Scenario class where the scenario is implemented\n        :param method_name: Name of the method that implements the scenario\n        :param context: Benchmark context that contains users, admin & other\n                        information, that was created before benchmark started.\n        :param args: Arguments to call the scenario method with\n\n        :returns: List of results fore each single scenario iteration,\n                  where each result is a dictionary\n        ' #NEWLINE# timeout = self . config . get ( 'timeout' , 0 ) #NEWLINE# times = self . config . get ( 'times' , 1 ) #NEWLINE# concurrency = self . config . get ( 'concurrency' , 1 ) #NEWLINE# iteration_gen = utils . RAMInt ( ) #NEWLINE# cpu_count = multiprocessing . cpu_count ( ) #NEWLINE# max_cpu_used = min ( cpu_count , self . config . get ( 'max_cpu_count' , cpu_count ) ) #NEWLINE# processes_to_start = min ( max_cpu_used , times , concurrency ) #NEWLINE# ( concurrency_per_worker , concurrency_overhead ) = divmod ( concurrency , processes_to_start ) #NEWLINE# self . _log_debug_info ( times = times , concurrency = concurrency , timeout = timeout , max_cpu_used = max_cpu_used , processes_to_start = processes_to_start , concurrency_per_worker = concurrency_per_worker , concurrency_overhead = concurrency_overhead ) #NEWLINE# result_queue = multiprocessing . Queue ( ) #NEWLINE# def worker_args_gen( concurrency_overhead ) : #NEWLINE# #INDENT# while True : #NEWLINE# #INDENT# ( yield ( result_queue , iteration_gen , timeout , ( concurrency_per_worker + ( concurrency_overhead and 1 ) ) , times , context , cls , method_name , args , self . aborted ) ) #NEWLINE# if concurrency_overhead : #NEWLINE# #INDENT# concurrency_overhead -= 1 #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# process_pool = self . _create_process_pool ( processes_to_start , _worker_process , worker_args_gen ( iteration_gen ) ) #NEWLINE# self . _join_processes ( process_pool , result_queue )