From 04ec89b461772b1f558620f5d622a3a5301f72db Mon Sep 17 00:00:00 2001 From: Vedant P Iyer Date: Thu, 31 Oct 2024 11:58:45 -0600 Subject: [PATCH] renamed front-end and back-end to back-read and back-write in core --- dsi/core.py | 14 +++++--------- examples/coreterminal.py | 10 +++++----- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/dsi/core.py b/dsi/core.py index 6934e65..590dce5 100644 --- a/dsi/core.py +++ b/dsi/core.py @@ -17,7 +17,7 @@ class Terminal(): An instantiated Terminal is the DSI human/machine interface. Terminals are a home for Plugins and an interface for Backends. Backends may be - front-ends or back-ends. Plugins may be Writers or readers. See documentation + back-reads or back-writes. Plugins may be Writers or readers. See documentation for more information. """ BACKEND_PREFIX = ['dsi.backends'] @@ -28,7 +28,7 @@ class Terminal(): VALID_BACKENDS = ['Gufi', 'Sqlite', 'Parquet'] VALID_MODULES = VALID_PLUGINS + VALID_BACKENDS VALID_MODULE_FUNCTIONS = {'plugin': [ - 'writer', 'reader'], 'backend': ['front-end', 'back-end']} + 'writer', 'reader'], 'backend': ['back-read', 'back-write']} VALID_ARTIFACT_INTERACTION_TYPES = ['get', 'set', 'put', 'inspect'] def __init__(self, debug_flag = False): @@ -235,7 +235,7 @@ def artifact_handler(self, interaction_type, query = None, **kwargs): Store or retrieve using all loaded DSI Backends with storage functionality. A DSI Core Terminal may load zero or more Backends with storage functionality. - Calling artifact_handler will execute all back-end functionality currently loaded, given + Calling artifact_handler will execute all back-write functionality currently loaded, given the provided ``interaction_type``. """ if interaction_type not in self.VALID_ARTIFACT_INTERACTION_TYPES: @@ -246,7 +246,7 @@ def artifact_handler(self, interaction_type, query = None, **kwargs): # Perform artifact movement first, because inspect implementation may rely on # self.active_metadata or some stored artifact. selected_function_modules = dict( - (k, self.active_modules[k]) for k in (['back-end'])) + (k, self.active_modules[k]) for k in (['back-write'])) for module_type, objs in selected_function_modules.items(): for obj in objs: self.logger.info(f"-------------------------------------") @@ -268,11 +268,7 @@ def artifact_handler(self, interaction_type, query = None, **kwargs): operation_success = True end = datetime.now() self.logger.info(f"Runtime: {end-start}") - if interaction_type == 'inspect': - for module_type, objs in selected_function_modules.items(): - for obj in objs: - self.logger.info(f"-------------------------------------") - self.logger.info(obj.__class__.__name__ + f" {module_type} - {interaction_type} the data") + elif interaction_type == 'inspect': start = datetime.now() obj.put_artifacts( collection=self.active_metadata, **kwargs) diff --git a/examples/coreterminal.py b/examples/coreterminal.py index 1948f8f..6927c16 100644 --- a/examples/coreterminal.py +++ b/examples/coreterminal.py @@ -23,9 +23,9 @@ # print(a.active_metadata) a.load_module('plugin', 'TOML', 'reader', filenames=["data/results.toml"], target_table_prefix = "results") # print(a.active_metadata) -a.load_module('backend','Sqlite','back-end', filename='data/data.db') -#a.load_module('backend','Sqlite','back-end', filename='data/data2.db') -# a.load_module('backend','Parquet','back-end',filename='./data/bueno.pq') +a.load_module('backend','Sqlite','back-write', filename='data/data.db') +#a.load_module('backend','Sqlite','back-write', filename='data/data2.db') +# a.load_module('backend','Parquet','back-write',filename='./data/bueno.pq') #a.load_module('plugin', "Table_Plot", "writer", table_name = "schema_physics", filename = "schema_physics") @@ -35,12 +35,12 @@ # {'writer': [], # 'reader': [], # 'front-end': [], -# 'back-end': []} +# 'back-write': []} # Example use # a.load_module('plugin','Bueno','reader',filenames='data/bueno1.data') -# a.load_module('backend','Sqlite','back-end',filename='data/bueno.db') +# a.load_module('backend','Sqlite','back-write',filename='data/bueno.db') # a.transload() # a.artifact_handler(interaction_type='put') data = a.artifact_handler(interaction_type='get', query = "SELECT * FROM sqlite_master WHERE type='table';")#, isVerbose = True)