def test_serialize_sinfo(self): r"""Test serialize/deserialize with serializer info.""" if (self._cls == 'SerializeBase'): return hout = copy.deepcopy(self._header_info) temp_seri = import_component( 'serializer', self.instance.serializer_info['seritype'])() for iobj in self.testing_options['objects']: msg = self.instance.serialize(iobj, header_kwargs=self._header_info, add_serializer_info=True) hout.update(self.instance.serializer_info) hout.update( self.instance.datatype.encode_type( iobj, typedef=self.instance.typedef)) iout, ihead = self.instance.deserialize(msg) hout.update(size=ihead['size'], id=ihead['id'], incomplete=False) self.assert_result_equal(iout, iobj) self.assert_equal(ihead, hout) # Use info to reconstruct serializer iout, ihead = temp_seri.deserialize(msg) self.assert_result_equal(iout, iobj) self.assert_equal(ihead, hout) new_seri = import_component('serializer', ihead.pop('seritype', None))(**ihead) iout, ihead = new_seri.deserialize(msg) self.assert_result_equal(iout, iobj) self.assert_equal(ihead, hout)
def test_serialize_sinfo(self, instance, testing_options, map_sent2recv, header_info, unyts_equality_patch): r"""Test serialize/deserialize with serializer info.""" hout = copy.deepcopy(header_info) temp_seri = import_component('serializer', instance.serializer_info['seritype'])() for iobj in testing_options['objects']: msg = instance.serialize(iobj, header_kwargs=header_info, add_serializer_info=True) hout.update(instance.serializer_info) hout['datatype'] = instance.datatype.encode_type( iobj, typedef=instance.typedef) iout, ihead = instance.deserialize(msg) hout.update(size=ihead['size'], id=ihead['id'], incomplete=False) assert (iout == map_sent2recv(iobj)) assert (ihead == hout) # Use info to reconstruct serializer iout, ihead = temp_seri.deserialize(msg) assert (iout == map_sent2recv(iobj)) assert (ihead == hout) new_seri = import_component('serializer', ihead.pop('seritype', None))(**ihead) iout, ihead = new_seri.deserialize(msg) assert (iout == map_sent2recv(iobj)) assert (ihead == hout)
def idriver_class(self): r"""class: Input driver class.""" if self.direction is None: return None # pragma: no cover elif (self.direction == 'output') and self.is_file: return None elif (self.direction == 'input') and self.is_file: return import_component('connection', 'file_input') return import_component('connection', 'input')
def get_options(self): r"""Get testing options.""" out = {} if self.is_file: assert(self.filecomm is not None) out = import_component('file', self.filecomm).get_testing_options( **self.testing_option_kws) else: out = import_component('comm', 'default').get_testing_options( **self.testing_option_kws) return out
def yggclean(): r"""Cleanup dependency files.""" from yggdrasil.tools import get_supported_lang from yggdrasil.components import import_component parser = argparse.ArgumentParser( description='Remove dependency libraries compiled by yggdrasil.') parser.add_argument('language', nargs='*', default=[], help=('One or more languages to clean up ' 'dependencies for.')) args = parser.parse_args() if (len(args.language) == 0) or ('all' in args.language): args.language = get_supported_lang() for l in args.language: import_component('model', l).cleanup_dependencies()
def run_example_c_prefixes(self): r"""Version of the example in C using pointers & prefixes.""" drv = import_component('model', self.language) if ((drv.is_typed and (self.language == 'c') and (self.datatype in ['1darray', 'ndarray']))): self.run_example(using_pointers=True, length_prefix=True)
def run_example_c_nolengths(self): r"""Version of the example in C using pointers & no lengths.""" drv = import_component('model', self.language) if ((drv.is_typed and (self.language == 'c') and (self.datatype in ['string', 'bytes', 'unicode']))): self.run_example(using_pointers=True, dont_add_lengths=True)
def set_env(cls, language=None, language_driver=None, language_compiler=None, **kwargs): r"""Get environment variables that should be set for the model process. Args: language (str, optional): Language that is being compiled. Defaults to the first language in cls.languages that isn't toolname. language_driver (ModelDriver, optional): Driver for language that should be used. Defaults to None and will be imported based on language. language_compiler (str, optional): name of compilation tool that should be used to set the environment variables. Defaults to None and the default compilation tools for the provided language/language_driver will be used. **kwargs: Additional keyword arguments are passed to the parent class's method. Returns: dict: Environment variables for the model process. """ out = super(BuildToolBase, cls).set_env(**kwargs) if language_driver is None: if language is None: language = cls.get_default_target_language() language_driver = components.import_component('model', language) compiler = language_driver.get_tool('compiler', toolname=language_compiler) out = compiler.set_env(existing=out) return out
def open_file_comm(fname, mode, filetype='binary', **kwargs): r"""Context manager to open a file comm in a way similar to how Python opens file descriptors. Args: fname (str): Path to file that should be opened. mode (str): Mode that file should be opened in. Supported values include 'r', 'w', and 'a'. filetype (str, optional): Type of file being opened. Defaults to 'binary'. Returns: CommBase: File comm. """ comm = None try: comm_cls = import_component('file', filetype) if mode == 'r': kwargs['direction'] = 'recv' elif mode in ['w', 'a']: kwargs['direction'] = 'send' if mode == 'a': kwargs['append'] = True else: raise ValueError("Unsupported mode: '%s'" % mode) comm = comm_cls('file', address=fname, **kwargs) yield comm finally: if comm is not None: comm.close()
def comm_count(self): r"""int: The number of comms.""" out = 0 for k in self.cleanup_comm_classes: cls = import_component('comm', k) out += cls.comm_count() return out
def __init__(self, *args, **kwargs): kwargs.pop('function', None) super(MPIPartnerModel, self).__init__(*args, **kwargs) self.partner_driver = import_component('model', self.yml['partner_driver'], without_schema=True) self.partner_driver.mpi_partner_init(self)
def get_default_comm(): r"""Get the default comm that should be used for message passing.""" comm_list = get_installed_comm() if 'YGG_DEFAULT_COMM' in os.environ: _default_comm = os.environ['YGG_DEFAULT_COMM'] if not is_comm_installed(_default_comm, language='any'): # pragma: debug raise Exception( 'Unsupported default comm %s set by YGG_DEFAULT_COMM' % (_default_comm)) else: if len(comm_list) > 0: _default_comm = comm_list[0] else: # pragma: windows # Locate comm that maximizes languages that can be run tally = {} for c in get_supported_comm(): tally[c] = 0 for l in get_supported_lang(): if is_comm_installed(c, language=l): tally[c] += 1 _default_comm = max(tally) if tally[_default_comm] == 0: # pragma: debug raise Exception('Could not locate an installed comm.') if _default_comm.endswith('Comm'): _default_comm = import_component('comm', _default_comm)._commtype if _default_comm == 'rmq': # pragma: debug raise NotImplementedError('RMQ cannot be the default comm because ' + 'there is not an RMQ C interface.') return _default_comm
def loadDrivers(self): r"""Load all of the necessary drivers, doing the IO drivers first and adding IO driver environmental variables back tot he models.""" self.debug('') driver = dict(name='name') try: # Preparse model drivers first so that the input/output # channels are updated for wrapped functions self.debug("Preparsing model functions") for driver in self.modeldrivers.values(): driver_cls = import_component('model', driver['driver'], without_schema=True) driver_cls.preparse_function(driver) if self.mpi_comm: self.distribute_mpi() # Create I/O drivers self.debug("Loading connection drivers") for driver in self.connectiondrivers.values(): driver['task_method'] = self.connection_task_method self.create_connection_driver(driver) # Create model drivers self.debug("Loading model drivers") for driver in self.modeldrivers.values(): self.create_driver(driver) self.debug("Model %s:, env: %s", driver['name'], pformat(driver['instance'].env)) except BaseException as e: # pragma: debug self.error("%s could not be created: %s", driver['name'], e) self.terminate() raise
def set_target_language(self): r"""Set the language of the target being compiled (usually the same as the language associated with this driver. Returns: str: Name of language. """ source_dir = self.sourcedir if self.target_language is None: # Get file form cmakelists files try_list = sorted(list(glob.glob(os.path.join(source_dir, '*')))) early_exit = False if self.model_src is not None: try_list = [self.model_src, try_list] early_exit = True languages = copy.deepcopy( self.get_tool_instance('compiler').languages) languages.remove(self.language) try: self.target_language = self.get_language_for_source( try_list, early_exit=early_exit, languages=languages) except ValueError: pass # Try to compile C as C++ # if self.target_language == 'c': # self.target_language = 'c++' if (((self.target_language_driver is None) and (self.target_language is not None))): self.target_language_driver = components.import_component( 'model', self.target_language) return self.target_language
def new_comm(name, comm=None, **kwargs): r"""Return a new communicator, creating necessary components for communication (queues, sockets, channels, etc.). Args: name (str): Communicator name. comm (str, optional): Name of communicator class. **kwargs: Additional keyword arguments are passed to communicator class method new_comm. Returns: Comm: Communicator of given class. """ if isinstance(comm, list): if len(comm) == 1: kwargs.update(comm[0]) kwargs.setdefault('name', name) return new_comm(**kwargs) else: kwargs['comm'] = comm comm = 'ForkComm' comm_cls = import_component('comm', comm) if comm in ['DefaultComm', 'default']: commtype = kwargs.pop('commtype', 'default') assert (commtype == 'default') return comm_cls.new_comm(name, **kwargs)
def write_comm_devnotes_table(**kwargs): r"""Write a table containing development notes for the registered comms. Args: **kwargs: Additional keyword arguments are passed to dict2table and write_table. Returns: str, list: Name of file or files created. """ from yggdrasil import tools, components kwargs.setdefault('fname_base', 'comm_devnotes_table.rst') args = {} for comm in tools.get_supported_comm(): if comm in ['default', 'rmq_async']: continue cdrv = components.import_component('comm', comm) args[comm] = {'developer notes': get_docs_section(cdrv.__doc__, keys=['Developer Notes:', 'Development Notes:'], join_lines=True)} if cdrv.address_description is not None: args[comm]['address'] = cdrv.address_description kwargs.setdefault('key_column_name', 'comm') kwargs.setdefault('val_column_name', 'developer notes') kwargs.setdefault('wrapped_columns', {'address': 40, 'developer notes': 80}) kwargs.setdefault('column_order', ['comm', 'address', 'developer notes']) lines = dict2table(args, **kwargs) return write_table(lines, **kwargs)
def write_wrappers(cls, target=None, sourcedir=None, target_language=None, **kwargs): r"""Write any wrappers needed to compile and/or run a model. Args: **kwargs: Keyword arguments are ignored (only included to allow cascade from child classes). Returns: list: Full paths to any created wrappers. """ if sourcedir is None: # pragma: debug sourcedir = '.' out = super(CMakeConfigure, cls).write_wrappers(**kwargs) if target is None: include_base = 'ygg_cmake.txt' else: include_base = 'ygg_cmake_%s.txt' % target include_file = os.path.join(sourcedir, include_base) if (target_language is not None) and ('driver' not in kwargs): kwargs['driver'] = components.import_component( 'model', target_language) cls.create_include(include_file, target, **kwargs) if os.path.isfile(include_file): os.remove(include_file) return out
def update_config(): r"""Update the user config file for yggdrasil.""" from yggdrasil import config, tools from yggdrasil.components import import_component parser = argparse.ArgumentParser( description='Update the user config file.') parser.add_argument('--show-file', action='store_true', help='Print the path to the config file without updating it.') parser.add_argument('--remove-file', action='store_true', help='Remove the existing config file and return.') parser.add_argument('--overwrite', action='store_true', help='Overwrite the existing file.') parser.add_argument('--languages', nargs='+', default=tools.get_supported_lang(), help=('One or more languages that should be' 'configured.')) parser.add_argument('--disable-languages', nargs='+', default=[], dest='disable_languages', help='One or more languages that should be disabled.') parser.add_argument('--enable-languages', nargs='+', default=[], help='One or more languages that should be enabled.') if ('-h' in sys.argv) or ('--help' in sys.argv): prelang = tools.get_supported_lang() else: prelang = parser.parse_known_args()[0].languages lang_args = {} old_args = set([x.dest for x in parser._actions]) for l in prelang: drv = import_component('model', l) drv.update_config_argparser(parser) new_args = set([x.dest for x in parser._actions]) lang_args[drv.language] = list(new_args - old_args) old_args = new_args args = parser.parse_args() lang_kwargs = {l: {k: getattr(args, k) for k in alist} for l, alist in lang_args.items()} if args.show_file: print('Config file located here: %s' % config.usr_config_file) if args.remove_file and os.path.isfile(config.usr_config_file): os.remove(config.usr_config_file) if args.show_file or args.remove_file: return drv = [import_component('model', l) for l in args.languages] config.update_language_config(drv, overwrite=args.overwrite, verbose=True, disable_languages=args.disable_languages, enable_languages=args.enable_languages, lang_kwargs=lang_kwargs)
def get_subprocess_language_driver(): r"""Determine the driver for the langauge of the calling process. Returns: ModelDriver: Class used to handle running a model of the process language. """ return import_component('model', get_subprocess_language())
def do_send_recv(language='python', fmt='%f\\n%d', msg=[float(1.0), np.int32(2)], input_interface='YggInput', output_interface='YggOutput'): r"""Function to perform simple send/receive between two comms using a language interface that calls the Python interface. Args: language (str, optional): Language that should be mimicked for the interface test. Defaults to 'python'. fmt (str, optional): Format string to use for the test. Defaults to '%f\\n%d'. msg (object, optional): Message object that should be used for the test. Defaults to [float(1.0), int(2)]. input_interface (str, optional): Name of the interface function/class that should be used for the test. Defaults to 'YggInput'. output_interface (str, optional): Name of the interface function/class that should be used for the test. Defaults to 'YggOutput'. """ name = 'test_%s' % language # Set converter based on language driver ldrv = import_component('model', language) converter = ldrv.python2language # Create and start drivers to transport messages iodrv = ConnectionDriver.ConnectionDriver(name, inputs=[{ 'partner_model': 'model1', 'allow_multiple_comms': True }], outputs=[{ 'partner_model': 'model2', 'allow_multiple_comms': True }]) iodrv.start() os.environ.update(iodrv.icomm.opp_comms) os.environ.update(iodrv.ocomm.opp_comms) # Connect and utilize interface under disguise as target language try: with ModelEnv(language=language, YGG_THREADING='True'): # Ensure start-up by waiting for signon message i = YggInterface.YggInit(input_interface, (name, fmt)) i.drain_server_signon_messages() # Output o = YggInterface.YggInit(output_interface, (name, fmt)) o.send(*msg) o.send_eof() o.close(linger=True) # Input assert (i.recv() == (True, converter(msg))) assert (i.recv() == (False, converter(constants.YGG_MSG_EOF))) finally: iodrv.terminate()
def setup_model(cls, language, transform, language_ext=None, **kwargs): r"""Write the model file for the specified combination of language and type. Args: language (str): Language that model should be written in. transform (str): Transformation that should be performed. language_ext (str, optional): Extension that should be used for the model file. If not provided, the extension is determined from the specified language. **kwargs: Additional keyword arguments are passed to the write_function_def class method of the language driver. Returns: tuple(str, dict): Full path to the file that was written and the environment variables that should be set before running the integration. """ if language_ext is None: language_ext = get_language_ext(language) modelfile = os.path.join(_example_dir, cls.example_name, 'src', 'model' + language_ext) drv = import_component('model', language) testdata = cls.get_test_data() testtype = encode_type(testdata) inputs = [{'name': 'x', 'datatype': copy.deepcopy(testtype)}] outputs = [{'name': 'y', 'datatype': copy.deepcopy(testtype)}] # Write the model function_contents = [] for i, o in zip(inputs, outputs): function_contents += drv.write_assign_to_output( o, i, outputs_in_inputs=drv.outputs_in_inputs) lines = drv.write_function_def('model', function_contents=function_contents, inputs=copy.deepcopy(inputs), outputs=copy.deepcopy(outputs), outputs_in_inputs=drv.outputs_in_inputs, opening_msg='IN MODEL', closing_msg='MODEL EXIT', print_inputs=True, print_outputs=True, **kwargs) with open(modelfile, 'w') as fd: print(modelfile) print('\n'.join(lines)) fd.write('\n'.join(lines)) env = {} env['TEST_LANGUAGE'] = language env['TEST_LANGUAGE_EXT'] = language_ext env['TEST_TRANSFORM'] = transform if transform == 'table': env['TEST_MODEL_IO'] = ('outputs:\n' + ' - name: ' + language + '_model:output\n' + ' format_str: "%s\\t%d\\t%f\\n"') return modelfile, env
def set_env(cls, logging_level=None, language=None, language_driver=None, **kwargs): r"""Get environment variables that should be set for the model process. Args: logging_level (int, optional): Logging level that should be passed to get flags. language (str, optional): Language that is being compiled. Defaults to the first language in cls.languages that isn't toolname. language_driver (ModelDriver, optional): Driver for language that should be used. Defaults to None and will be imported based on language. **kwargs: Additional keyword arguments are passed to the parent class's method. Returns: dict: Environment variables for the model process. """ if language_driver is None: if language is None: language = cls.get_default_target_language() language_driver = components.import_component('model', language) kwargs['language_driver'] = language_driver out = super(MakeCompiler, cls).set_env(**kwargs) compiler = language_driver.get_tool('compiler') compile_flags = language_driver.get_compiler_flags( for_model=True, skip_defaults=True, dont_skip_env_defaults=True, logging_level=logging_level, dont_link=True) linker = language_driver.get_tool('linker') linker_flags = language_driver.get_linker_flags( for_model=True, skip_defaults=True, dont_skip_env_defaults=True) for k in [ 'env_compiler', 'env_compiler_flags', 'env_linker', 'env_linker_flags' ]: kwargs.setdefault(k, cls._schema_properties[k]['default']) out[kwargs['env_compiler']] = compiler.get_executable() out[kwargs['env_compiler_flags']] = ' '.join(compile_flags) # yggdrasil requires that linking be done in C++ if (((compiler.languages[0].lower() == 'c') and ('-lstdc++' not in linker_flags))): linker_flags.append('-lstdc++') out[kwargs['env_linker_flags']] = ' '.join(linker_flags) if kwargs['env_compiler'] != kwargs['env_linker']: # pragma: debug out[kwargs['env_linker']] = linker.get_executable() raise NotImplementedError( "Functionality allowing linker to be specified " "in a separate environment variable from the " "compiler is untested.") return out
def compile_osr(cls, target='OpenSimRootYgg'): r"""Compile the OpenSimRoot executable with the yggdrasil flag set. Args: target (str): Make target that should be build. Defaults to 'OpenSimRootYgg' (the yggdrasil-instrumented version of the OSR executable). """ if (cls.repository is not None) and CPPModelDriver.is_installed(): toolname = None # toolname = CPPModelDriver.get_tool('compiler', # return_prop='name', # default=None) cwd = os.path.join(cls.repository, 'OpenSimRoot') flags = ['-j4'] env = copy.deepcopy(os.environ) if platform._is_win: # pragma: windows toolname = 'cl' env['YGG_OSR_TOOL'] = toolname if toolname == 'cl': cl_path = shutil.which(toolname + '.exe') print('cl.exe', shutil.which(toolname), cl_path) subprocess.check_call( ['yggccflags', '--cpp', '--toolname=%s' % toolname]) subprocess.check_call( ['yggldflags', '--cpp', '--toolname=%s' % toolname]) if cl_path: msvc_bin = os.path.dirname(cl_path) env['YGG_OSR_CXX'] = cl_path env['YGG_OSR_LINK'] = os.path.join( msvc_bin, 'link.exe') for k in ['CL', '_CL_']: v = os.environ.get(k, None) if v is not None: env[k] = v.replace('/', '-').replace('\\', '/') else: # pragma: debug env.pop('YGG_OSR_TOOL') warnings.warn( "The MSVC compiler is not installed. Be aware " "that the GNU compiler takes a *very* long time " "to compile OpenSimRoot against yggdrasil on " "Windows (> 1 hr).") cwd = os.path.join(cwd, 'StaticBuild_win64') else: cwd = os.path.join(cwd, 'StaticBuild') if target != 'cleanygg': for x in cls.base_languages: base_cls = import_component('model', x) base_cls.compile_dependencies(toolname=toolname) elif not os.path.isfile(cls.executable_path): return cmd = ['make', target] + flags subprocess.check_call(cmd, cwd=cwd, env=env)
def __init__(self, name, yamls): self.runner = None self.name = name self.yamls = yamls self.languages = [] for x in yamlfile.parse_yaml(yamls)['model'].values(): drv = import_component('model', x['driver'], without_schema=True) if drv.language not in self.languages: self.languages.append(drv.language) super(DemoRun, self).__init__()
def write_interface_mapping_table(split_table_for_notebook=False, **kwargs): r"""Write a table containing mapping of datatypes between different languages. Args: **kwargs: Additional keyword arguments are passed to dict2table and write_table. Returns: str, list: Name of file or files created. """ import copy from yggdrasil import tools, components kwargs.setdefault('fname_base', 'interface_mapping_table.rst') kwargs.setdefault('style', 'complex') comm_keys = ['import', 'input', 'output', 'server', 'client', 'timesync'] meth_keys = ['send', 'recv', 'call'] all_keys = comm_keys + meth_keys if split_table_for_notebook: keys_part1 = ['import', 'input', 'output'] keys_part2 = ['send', 'recv'] keys_part3 = ['server', 'client', 'call'] keys_part4 = ['timesync'] keys_list = [keys_part1, keys_part2, keys_part3, keys_part4] else: keys_list = [all_keys] lines = [] kwargs0 = kwargs for keys in keys_list: args = {} kwargs = copy.deepcopy(kwargs0) for lang in tools.get_supported_lang(): if lang in ['lpy', 'make', 'cmake', 'executable']: continue if lang == 'cpp': lang = 'c++' ldrv = components.import_component('model', lang) if not ldrv.full_language: continue args[lang] = {'language': lang} for k in keys: entry = getattr(ldrv, 'interface_map', {}).get(k, '') if entry: args[lang][k] = '``%s``' % entry else: args[lang][k] = '' kwargs.setdefault('key_column_name', 'language') kwargs.setdefault('val_column_name', keys[0]) kwargs.setdefault('prune_empty_columns', False) kwargs.setdefault('wrapped_columns', {}) # 'notes': 40}) kwargs.setdefault('column_order', ['language'] + keys) lines += dict2table(args, **kwargs) lines += ['', ''] return write_table(lines, **kwargs)
def test_update_language_config(): r"""Test updating configuration for installed languages.""" drv = [import_component('model', l) for l in tools.get_supported_lang()] config.update_language_config(drv, overwrite=True, verbose=True) try: config.update_language_config(drv[0], disable_languages=[drv[0].language]) config.update_language_config(drv[0], disable_languages=[drv[0].language], enable_languages=[drv[0].language]) finally: config.update_language_config(drv[0], enable_languages=[drv[0].language])
def cleanup_comms(comm=None): r"""Call cleanup_comms for the appropriate communicator class. Args: comm (str, optional): Name of communicator class. Defaults to tools.get_default_comm() if not provided. Returns: int: Number of comms closed. """ return import_component('comm', comm).cleanup_comms()
def do_send_recv(language='python', fmt='%f\\n%d', msg=[float(1.0), int(2)], input_interface='YggInput', output_interface='YggOutput'): r"""Function to perform simple send/receive between two comms using a language interface that calls the Python interface. Args: language (str, optional): Language that should be mimicked for the interface test. Defaults to 'python'. fmt (str, optional): Format string to use for the test. Defaults to '%f\\n%d'. msg (object, optional): Message object that should be used for the test. Defaults to [float(1.0), int(2)]. input_interface (str, optional): Name of the interface function/class that should be used for the test. Defaults to 'YggInput'. output_interface (str, optional): Name of the interface function/class that should be used for the test. Defaults to 'YggOutput'. """ name = 'test_%s' % language # Set converter based on language driver ldrv = import_component('model', language) converter = ldrv.python2language if converter is None: def converter(x): return x # Create and start drivers to transport messages odrv = OutputDriver.OutputDriver(name, 'link') odrv.start() os.environ.update(odrv.env) idrv = InputDriver.InputDriver(name, 'link', comm_env=odrv.comm_env) idrv.start() os.environ.update(idrv.env) # Connect and utilize interface under disguise as target language try: with ModelEnv(language=language): # Output o = YggInterface.YggInit(output_interface, (name, fmt)) o.send(*msg) o.send_eof() o.close() # Input i = YggInterface.YggInit(input_interface, (name, fmt)) assert_equal(i.recv(), (True, converter(msg))) assert_equal(i.recv(), (False, converter(YGG_MSG_EOF))) finally: odrv.terminate() idrv.terminate()
def test_run(self, run_name, yamls, check_required_languages): r"""Run the integration.""" languages = [] for x in yamlfile.parse_yaml(list(yamls))['model'].values(): drv = import_component('model', x['driver'], without_schema=True) if drv.language not in languages: languages.append(drv.language) check_required_languages(languages) # Run r = runner.get_runner(yamls, namespace=run_name, production_run=True) r.run() assert (not r.error_flag) del r
def is_library_installed(cls, lib, **kwargs): r"""Determine if a dependency is installed. Args: lib (str): Name of the library that should be checked. **kwargs: Additional keyword arguments are ignored. Returns: bool: True if the library is installed, False otherwise. """ drv = import_component('model', cls.base_languages[0]) return drv.is_library_installed(lib, **kwargs)