test if a source is loaded
This commit is contained in:
parent
8dca850683
commit
8e0fe77274
|
@ -98,10 +98,12 @@ class TiramisuController(Controller):
|
|||
def __init__(self,
|
||||
test: bool,
|
||||
) -> None:
|
||||
self.source_imported = None
|
||||
if not 'dataset_name' in vars(self):
|
||||
raise Exception(f'please specify "dataset_name" to "{self.__class__.__name__}"')
|
||||
self.tiramisu_cache_root_path = join(get_config()['cache']['root_path'], self.dataset_name)
|
||||
super().__init__(test)
|
||||
self.internal_source_name = get_config()['servermodel']['internal_source']
|
||||
if not test:
|
||||
db_conf = get_config()['database']['tiramisu_dsn']
|
||||
self.save_storage = Storage(engine='postgres')
|
||||
|
@ -130,6 +132,12 @@ class TiramisuController(Controller):
|
|||
risotto_context: Context,
|
||||
) -> None:
|
||||
sources = await self.get_sources(risotto_context)
|
||||
source_imported = sources != [self.internal_source_name]
|
||||
if source_imported and self.source_imported is False:
|
||||
await self.load_datas(risotto_context)
|
||||
self.source_imported = source_imported
|
||||
if not self.source_imported:
|
||||
return
|
||||
self._aggregate_tiramisu_funcs(sources)
|
||||
self._convert_dictionaries_to_tiramisu(sources)
|
||||
|
||||
|
@ -175,7 +183,9 @@ except:
|
|||
funcs.write(fh.read())
|
||||
funcs.write(b'\n')
|
||||
|
||||
def _convert_dictionaries_to_tiramisu(self, sources: list) -> None:
|
||||
def _convert_dictionaries_to_tiramisu(self,
|
||||
sources: list,
|
||||
) -> None:
|
||||
funcs_file = join(self.tiramisu_cache_root_path, 'funcs.py')
|
||||
tiramisu_file = join(self.tiramisu_cache_root_path, 'tiramisu.py')
|
||||
dictionaries_dir = join(self.tiramisu_cache_root_path, 'dictionaries')
|
||||
|
|
Loading…
Reference in New Issue