def sanity_check_step(self, exts_filter=None, custom_paths=None, custom_commands=None): """ Custom sanity check for extensions, whether installed as stand-alone module or not """ if not self.cfg["exts_filter"]: self.cfg["exts_filter"] = exts_filter self.log.debug("starting sanity check for extension with filter %s", self.cfg["exts_filter"]) if not self.is_extension: # load fake module fake_mod_data = self.load_fake_module(purge=True) # perform sanity check sanity_check_ok = Extension.sanity_check_step(self) if not self.is_extension: # unload fake module and clean up self.clean_up_fake_module(fake_mod_data) if custom_paths or self.cfg["sanity_check_paths"] or custom_commands or self.cfg["sanity_check_commands"]: EasyBlock.sanity_check_step( self, custom_paths=custom_paths, custom_commands=custom_commands, extension=self.is_extension ) # pass or fail sanity check if not sanity_check_ok: msg = "Sanity check for %s failed: %s" % (self.name, "; ".join(self.sanity_check_fail_msgs)) if self.is_extension: self.log.warning(msg) else: self.log.error(msg) return False else: self.log.info("Sanity check for %s successful!" % self.name) return True
def sanity_check_step(self, exts_filter, custom_paths=None, custom_commands=None): """ Custom sanity check for extensions, whether installed as stand-alone module or not """ if not self.cfg["exts_filter"]: self.cfg["exts_filter"] = exts_filter if not self.is_extension: # load fake module fake_mod_data = self.load_fake_module(purge=True) # perform sanity check sanity_check_ok = Extension.sanity_check_step(self) if not self.is_extension: # unload fake module and clean up self.clean_up_fake_module(fake_mod_data) if custom_paths or custom_commands: EasyBlock.sanity_check_step(self, custom_paths=custom_paths, custom_commands=custom_commands) # pass or fail sanity check if not sanity_check_ok: if self.is_extension: self.log.warning("Sanity check for %s failed!" % self.name) else: self.log.error("Sanity check for %s failed!" % self.name) return False else: self.log.info("Sanity check for %s successful!" % self.name) return True
def sanity_check_step(self, exts_filter=None, custom_paths=None, custom_commands=None): """ Custom sanity check for extensions, whether installed as stand-alone module or not """ if not self.cfg['exts_filter']: self.cfg['exts_filter'] = exts_filter self.log.debug("starting sanity check for extension with filter %s", self.cfg['exts_filter']) fake_mod_data = None if not (self.is_extension or self.dry_run): # load fake module fake_mod_data = self.load_fake_module(purge=True) # perform extension sanity check (sanity_check_ok, fail_msg) = Extension.sanity_check_step(self) if fake_mod_data: # unload fake module and clean up self.clean_up_fake_module(fake_mod_data) if custom_paths or custom_commands or not self.is_extension: super(ExtensionEasyBlock, self).sanity_check_step(custom_paths=custom_paths, custom_commands=custom_commands, extension=self.is_extension) # pass or fail sanity check if sanity_check_ok: self.log.info("Sanity check for %s successful!", self.name) else: if not self.is_extension: msg = "Sanity check for %s failed: %s" % (self.name, '; '.join(self.sanity_check_fail_msgs)) raise EasyBuildError(msg) return (sanity_check_ok, '; '.join(self.sanity_check_fail_msgs))
def sanity_check_step(self, exts_filter=None, custom_paths=None, custom_commands=None): """ Custom sanity check for extensions, whether installed as stand-alone module or not """ if not self.cfg.get_ref('exts_filter'): self.cfg['exts_filter'] = exts_filter self.log.debug("starting sanity check for extension with filter %s", self.cfg.get_ref('exts_filter')) # for stand-alone installations that were done for multiple dependency versions (via multi_deps), # we need to perform the extension sanity check for each of them, by loading the corresponding modules first if self.cfg['multi_deps'] and not self.is_extension: multi_deps = self.cfg.get_parsed_multi_deps() lists_of_extra_modules = [[d['short_mod_name'] for d in deps] for deps in multi_deps] else: # make sure Extension sanity check step is run once, by using a single empty list of extra modules lists_of_extra_modules = [[]] for extra_modules in lists_of_extra_modules: fake_mod_data = None # only load fake module + extra modules for stand-alone installations (not for extensions), # since for extension the necessary modules should already be loaded at this point if not (self.is_extension or self.dry_run): # load fake module fake_mod_data = self.load_fake_module(purge=True, extra_modules=extra_modules) if extra_modules: info_msg = "Running extension sanity check with extra modules: %s" % ', '.join(extra_modules) self.log.info(info_msg) trace_msg(info_msg) # perform extension sanity check (sanity_check_ok, fail_msg) = Extension.sanity_check_step(self) if fake_mod_data: # unload fake module and clean up self.clean_up_fake_module(fake_mod_data) if custom_paths or custom_commands or not self.is_extension: super(ExtensionEasyBlock, self).sanity_check_step(custom_paths=custom_paths, custom_commands=custom_commands, extension=self.is_extension) # pass or fail sanity check if sanity_check_ok: self.log.info("Sanity check for %s successful!", self.name) else: if not self.is_extension: msg = "Sanity check for %s failed: %s" % (self.name, '; '.join(self.sanity_check_fail_msgs)) raise EasyBuildError(msg) return (sanity_check_ok, '; '.join(self.sanity_check_fail_msgs))
def sanity_check_step(self, exts_filter=None, custom_paths=None, custom_commands=None): """ Custom sanity check for extensions, whether installed as stand-alone module or not """ if not self.cfg['exts_filter']: self.cfg['exts_filter'] = exts_filter self.log.debug("starting sanity check for extension with filter %s", self.cfg['exts_filter']) if not self.is_extension: # load fake module fake_mod_data = self.load_fake_module(purge=True) # perform sanity check sanity_check_ok = Extension.sanity_check_step(self) if not self.is_extension: # unload fake module and clean up self.clean_up_fake_module(fake_mod_data) if custom_paths or self.cfg[ 'sanity_check_paths'] or custom_commands or self.cfg[ 'sanity_check_commands']: EasyBlock.sanity_check_step(self, custom_paths=custom_paths, custom_commands=custom_commands, extension=self.is_extension) # pass or fail sanity check if not sanity_check_ok: msg = "Sanity check for %s failed: %s" % (self.name, '; '.join( self.sanity_check_fail_msgs)) if self.is_extension: self.log.warning(msg) else: raise EasyBuildError(msg) return False else: self.log.info("Sanity check for %s successful!" % self.name) return True