Commit 82a6493f authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[executor] Fix lazy loading of algorithm's runner

parent 6e553b9e
Pipeline #24046 passed with stage
in 3 minutes and 15 seconds
......@@ -92,7 +92,7 @@ class Executor(object):
self.data = simplejson.loads(f.read().decode('utf-8'))
self.prefix = os.path.join(directory, 'prefix')
self.runner = None
self._runner = None
# Temporary caches, if the user has not set them, for performance
database_cache = database_cache if database_cache is not None else {}
......@@ -134,10 +134,21 @@ class Executor(object):
)
@property
def runner(self):
"""Returns the algorithm runner
This property allows for lazy loading of the runner
"""
if self._runner is None:
self._runner = self.algorithm.runner()
return self._runner
def setup(self):
"""Sets up the algorithm to start processing"""
self.runner = self.algorithm.runner()
retval = self.runner.setup(self.data['parameters'])
logger.debug("User algorithm is setup")
return retval
......@@ -146,7 +157,6 @@ class Executor(object):
def prepare(self):
"""Prepare the algorithm"""
self.runner = self.algorithm.runner()
retval = self.runner.prepare(self.data_loaders)
logger.debug("User algorithm is prepared")
return retval
......
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