Skip to content

Commit 65f58ce

Browse files
committed
Reload the imported Ev and Preev modules after loading them
* Without the reload, if a user change the evaluation scripts the program is not capable of see them #57
1 parent 189228a commit 65f58ce

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

MLC/Common/PreevaluationManager.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,9 @@ def get_callback():
2121
module_name = Config.get_instance().get('EVALUATOR', 'preev_function')
2222
lg.logger_.debug('[PREEV_MANAGER] Importing module {0}'.format(module_name))
2323
try:
24-
callback = importlib.import_module('Preevaluation.' + module_name)
25-
return callback
24+
module = importlib.import_module('Preevaluation.' + module_name)
25+
reload(module)
26+
return module
2627
except ImportError:
2728
lg.logger_.debug("[PREEV_MANAGER] Preevaluation function doesn't exists. " +
2829
"Aborting program...")

MLC/GUI/Experiment/FirstIndividualsManager.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,6 @@ def get_gen_creator(self):
200200
indivs_dict = {}
201201
for index in xrange(len(self._individuals)):
202202
indiv = Individual(self._individuals[index])
203-
print type(indiv)
204-
print indiv.get_value()
205203
indivs_dict[indiv] = [index]
206204

207205
return IndividualSelection(indivs_dict, fill_creator)

MLC/Population/Evaluation/EvaluatorFactory.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ def get_callback():
1212
module_name = Config.get_instance().get('EVALUATOR', 'evaluation_function')
1313
lg.logger_.debug('[EV_FACTORY] Importing module {0}'.format(module_name))
1414
try:
15-
callback = importlib.import_module('Evaluation.' + module_name)
16-
return callback
15+
module = importlib.import_module('Evaluation.' + module_name)
16+
reload(module)
17+
return module
1718
except ImportError:
1819
lg.logger_.debug("[EV_FACTORY] Evaluation function doesn't exists. " +
1920
"Aborting program...")

0 commit comments

Comments
 (0)