diff --git a/beat/core/dbexecution.py b/beat/core/dbexecution.py index 115a81560b9240215beb6767018cf7ea11b279dc..db630861c427d475a0a7397ba832f41a4fa32e88 100644 --- a/beat/core/dbexecution.py +++ b/beat/core/dbexecution.py @@ -114,10 +114,8 @@ class DBExecutor(object): self.input_list = None self.data_sources = [] self.handler = None - - # runs validation if required self.errors = [] - self.data = data + self.data = None # temporary caches, if the user has not set them, for performance database_cache = database_cache if database_cache is not None else {} @@ -137,7 +135,7 @@ class DBExecutor(object): self.input_list = None self.data_sources = [] - if not isinstance(data, dict): #user has passed a file pointer + if not isinstance(data, dict): #user has passed a file name if not os.path.exists(data): self.errors.append('File not found: %s' % data) return @@ -254,9 +252,8 @@ class DBExecutor(object): ) self.input_list.add(group) - input_conf = self.data['inputs'][name] - input_db = self.databases[input_conf['database']] - input_dataformat_name = input_db.set(input_conf['protocol'], input_conf['set'])['outputs'][name] + input_db = self.databases[details['database']] + input_dataformat_name = input_db.set(details['protocol'], details['set'])['outputs'][details['output']] group.add(inputs.Input(name, self.dataformat_cache[input_dataformat_name], data_source)) diff --git a/beat/core/scripts/databases_provider.py b/beat/core/scripts/databases_provider.py index 4871919bdc8fe292dd950c342c2ca52baf43b029..64a1a67d2e088c090e3e3f6ef6df0fe063d2e748 100644 --- a/beat/core/scripts/databases_provider.py +++ b/beat/core/scripts/databases_provider.py @@ -132,7 +132,8 @@ def main(): database_cache = {} try: - dbexecutor = DBExecutor(args['<dir>'], 'configuration.json', + dbexecutor = DBExecutor(os.path.join(args['<dir>'], 'prefix'), + os.path.join(args['<dir>'], 'configuration.json'), dataformat_cache, database_cache) except (MemoryError): raise @@ -141,7 +142,7 @@ def main(): exc_type, exc_value, exc_traceback = sys.exc_info() tb = traceback.extract_tb(exc_traceback) s = ''.join(traceback.format_list(tb[4:])) #exclude this file - s = s.replace(args['<dir>']).strip() + s = s.replace(args['<dir>'], '').strip() raise UserError("%s%s: %s" % (s, type(e).__name__, e)) # Execute the code @@ -156,7 +157,7 @@ def main(): exc_type, exc_value, exc_traceback = sys.exc_info() tb = traceback.extract_tb(exc_traceback) s = ''.join(traceback.format_list(tb[4:])) - s = s.replace(args['<dir>']).strip() + s = s.replace(args['<dir>'], '').strip() raise UserError("%s%s: %s" % (s, type(e).__name__, e)) except UserError as e: