def __init__(self, name, description="", static_parameters={}, dynamic_parameters={}, suite_id=None, experiment_tags={}, simulations_tags={}, simulations_name=None, simulations_description=None): # Store general info self.name = name self.description = description self.experiment_tags = experiment_tags self._experiment_configuration = self._simulation_configuration = self._plugin_info = None # If no specific simulation info -> get from the experiment self.simulation_name = simulations_name or self.name self.simulation_description = simulations_description or self.description self.simulation_tags = simulations_tags or self.experiment_tags # Handle the suite_id if not suite_id: self.suite_id = CompsExperimentManager.create_suite(name) self.generated_suite = True else: self.generated_suite = False self.suite_id = suite_id # Create the command line exe_options = {'--config': 'config.json', '--input-path': SetupParser.get('input_root')} if SetupParser.get('python_path') != '': exe_options['--python-script-path'] = SetupParser.get('python_path') self.cmd = CommandlineGenerator(SetupParser.get('bin_staging_root'), exe_options, []) # Flow control self.SimulationCreationLimit = -1 self.SimulationCommissionLimit = -1 # Parameters self.static_parameters = static_parameters self.dynamic_parameters = dynamic_parameters
def get_commandline(self): """ Get the complete command line to run the simulations of this experiment. Returns: The :py:class:`CommandlineGenerator` object created with the correct paths """ from simtools.Utilities.General import CommandlineGenerator from simtools.SetupParser import SetupParser eradication_options = {'--config': 'config.json'} if SetupParser.get('type') == 'LOCAL': exe_path = self.stage_executable( self.assets.exe_path, SetupParser.get('bin_staging_root')) eradication_options['--input-path'] = self.assets.input_root if self.assets.python_path: eradication_options[ '--python-script-path'] = self.assets.python_path else: exe_path = os.path.join( 'Assets', os.path.basename(self.assets.exe_path or 'Eradication.exe')) eradication_options['--input-path'] = './Assets' if self.assets.PYTHON in self.assets.collections: eradication_options['--python-script-path'] = 'Assets\\python' return CommandlineGenerator(exe_path, eradication_options, [])
def test_commandline(self): commandline = self.cb.get_commandline('input/file.txt', dict(SetupParser.items())) self.assertEqual('input/file.txt', commandline.Commandline) another_command = CommandlineGenerator('input/file.txt', {'--config': 'config.json'}, []) self.assertEqual('input/file.txt --config config.json', another_command.Commandline)
def __init__(self, experiment=None, config_builder=None): super().__init__() self.experiment = experiment self.exp_builder = None self.config_builder = config_builder self.commandline = CommandlineGenerator() self.experiment_tags = {} self.asset_service = None self.assets = None self.cache = self.initialize_cache(queue=True)
def get_commandline(self): """ Get the complete command line to run the simulations of this experiment. Returns: The :py:class:`CommandlineGenerator` object created with the correct paths """ from simtools.Utilities.General import CommandlineGenerator from simtools.SetupParser import SetupParser cms_options = {'-config': 'config.json', '-model': 'model.emodl'} if SetupParser.get('type') == 'LOCAL': exe_path = self.assets.exe_path else: exe_path = os.path.join('Assets', self.exe_name) return CommandlineGenerator(exe_path, cms_options, [])
def get_commandline(self): return CommandlineGenerator('executable', [], {})
def get_commandline(self): from simtools.Utilities.General import CommandlineGenerator return CommandlineGenerator(self.command, self.options, self.parameters)