From cec32de9afb539bb4f00ccf34880b97cba93acdf Mon Sep 17 00:00:00 2001 From: Maxime Chéramy Date: Thu, 21 May 2015 17:53:00 +0200 Subject: [PATCH] Remove cls argument in SchedulerInfo. --- simso/core/Scheduler.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/simso/core/Scheduler.py b/simso/core/Scheduler.py index 0685549..e3d443c 100644 --- a/simso/core/Scheduler.py +++ b/simso/core/Scheduler.py @@ -15,7 +15,7 @@ class SchedulerInfo(object): SchedulerInfo groups the data that characterize a Scheduler (such as the scheduling overhead) and do the dynamic loading of the scheduler. """ - def __init__(self, name='', cls=None, overhead=0, overhead_activate=0, + def __init__(self, name='', overhead=0, overhead_activate=0, overhead_terminate=0, fields=None): """ Args: @@ -27,7 +27,6 @@ class SchedulerInfo(object): """ self._name = name self._filename = None - self._cls = cls self.overhead = overhead self.overhead_activate = overhead_activate self.overhead_terminate = overhead_terminate @@ -86,14 +85,14 @@ class SchedulerInfo(object): fp, pathname, description = imp.find_module(name, [path]) if path not in sys.path: sys.path.append(path) - self._cls = getattr(imp.load_module(name, fp, pathname, - description), name) + clas = getattr(imp.load_module(name, fp, pathname, + description), name) fp.close() + return clas except ImportError as e: print("ImportError: ", e) print("name: ", name, "path: ", path) - - return self._cls + return None def instantiate(self, model): """ @@ -103,8 +102,9 @@ class SchedulerInfo(object): - `model`: The :class:`Model ` object \ that is passed to the constructor. """ - cls = self.get_cls() - return cls(model, self) + clas = self.get_cls() + if clas: + return clas(model, self) class Scheduler(object): -- libgit2 0.26.0