def test_get_simple_local_runner_empty_config(self): prf = PiraRunnerFactory(self._ic, PiraConfiguration()) self.assertIsNotNone(prf) runner = prf.get_simple_local_runner() self.assertIsNotNone(runner) self.assertTrue(isinstance(runner, LocalRunner)) self.assertTrue(runner.has_sink())
def test_init_nonempty_config(self): prf = PiraRunnerFactory(self._ic, self._pira_two_cfg) self.assertIsNotNone(prf) self.assertTrue(isinstance(prf, PiraRunnerFactory)) prfII = PiraRunnerFactory(self._ic, self._pira_two_adapter) self.assertIsNotNone(prfII) self.assertTrue(isinstance(prf, PiraRunnerFactory))
def test_init_empty_config(self): prf = PiraRunnerFactory(self._ic, PiraConfiguration()) self.assertIsNotNone(prf) self.assertTrue(isinstance(prf, PiraRunnerFactory)) prfII = PiraRunnerFactory(self._ic, PiraConfigurationII()) self.assertIsNotNone(prf) self.assertTrue(isinstance(prfII, PiraRunnerFactory))
def test_get_scalability_runner_config_adapter(self): prfII = PiraRunnerFactory(self._ic, self._pira_two_adapter) self.assertIsNotNone(prfII) ep_cfg = ExtrapConfiguration('/extrap', 'pre', 'post') runner = prfII.get_scalability_runner(ep_cfg) self.assertIsNotNone(runner) self.assertTrue(isinstance(runner, LocalScalingRunner))
def test_get_scalability_runner_empty_config(self): prf = PiraRunnerFactory(self._ic, PiraConfiguration()) self.assertIsNotNone(prf) ep_cfg = ExtrapConfiguration('/extrap', 'pre', 'post') with self.assertRaises(PiraConfigurationErrorException): prf.get_scalability_runner(ep_cfg) prfII = PiraRunnerFactory(self._ic, PiraConfigurationII()) self.assertIsNotNone(prfII) with self.assertRaises(PiraConfigurationErrorException): prfII.get_scalability_runner(ep_cfg)
def main(arguments) -> None: """ Main function for pira framework. Used to invoke the various components. """ show_pira_invoc_info(arguments) invoc_cfg = process_args_for_invoc(arguments) use_extra_p, extrap_config = process_args_for_extrap(arguments) home_dir = U.get_cwd() U.set_home_dir(home_dir) U.make_dir(invoc_cfg.get_pira_dir()) BackendDefaults(invoc_cfg) csv_config = process_args_for_csv(arguments) try: if arguments.config_version is 1: config_loader = CLoader() else: config_loader = SCLoader() configuration = config_loader.load_conf(invoc_cfg.get_path_to_cfg()) checker.check_configfile(configuration, arguments.config_version) if B.check_queued_job(): # FIXME: Implement L.get_logger().log( 'In this version of PIRA it is not yet implemented', level='error') assert (False) else: ''' This branch is running PIRA actively on the local machine. It is blocking, and the user can track the progress in the terminal. ''' L.get_logger().log('Running the local case') # The FunctorManager manages loaded functors and generates the respective names F.FunctorManager(configuration) dbm = D.DBManager(D.DBManager.db_name + '.' + D.DBManager.db_ext) dbm.create_cursor() analyzer = A(configuration) runner_factory = PiraRunnerFactory(invoc_cfg, configuration) runner = runner_factory.get_simple_local_runner() if use_extra_p: L.get_logger().log('Running with Extra-P runner') runner = runner_factory.get_scalability_runner(extrap_config) if runner.has_sink(): analyzer.set_profile_sink(runner.get_sink()) # A build/place is a top-level directory for build in configuration.get_builds(): L.get_logger().log('Build: ' + str(build)) app_tuple = (U.generate_random_string(), build, '', '') dbm.insert_data_application(app_tuple) # An item is a target/software in that directory for item in configuration.get_items(build): L.get_logger().log('Running for item ' + str(item)) # A flavor is a specific version to build if configuration.has_local_flavors(build, item): for flavor in configuration.get_flavors(build, item): L.get_logger().log('Running for local flavor ' + flavor, level='debug') # prepare database, and get a unique handle for current item. db_item_id = dbm.prep_db_for_build_item_in_flavor( configuration, build, item, flavor) # Create configuration object for the item currently processed. place = configuration.get_place(build) t_config = TargetConfiguration( place, build, item, flavor, db_item_id, invoc_cfg.is_compile_time_filtering(), invoc_cfg.get_hybrid_filter_iters()) # Execute using a local runner, given the generated target description execute_with_config(runner, analyzer, invoc_cfg.get_pira_iters(), t_config, csv_config) # If global flavor else: # TODO: Implement L.get_logger().log( 'In this version of PIRA it is not yet implemented', level='error') assert (False) U.change_cwd(home_dir) except RuntimeError as rt_err: U.change_cwd(home_dir) L.get_logger().log('Runner.run caught exception. Message: ' + str(rt_err), level='error') L.get_logger().dump_tape() sys.exit(-1)