Commit c023dfa4 authored by Philip ABBET's avatar Philip ABBET
Browse files

Fix the execution in a container

parent 14af44b4
Pipeline #7766 failed with stage
in 2 seconds
......@@ -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))
......
......@@ -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:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment