Commit cec32de9 by Maxime Chéramy

Remove cls argument in SchedulerInfo.

parent 5e3ed0dc
...@@ -15,7 +15,7 @@ class SchedulerInfo(object): ...@@ -15,7 +15,7 @@ class SchedulerInfo(object):
SchedulerInfo groups the data that characterize a Scheduler (such as the SchedulerInfo groups the data that characterize a Scheduler (such as the
scheduling overhead) and do the dynamic loading of the scheduler. 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): overhead_terminate=0, fields=None):
""" """
Args: Args:
...@@ -27,7 +27,6 @@ class SchedulerInfo(object): ...@@ -27,7 +27,6 @@ class SchedulerInfo(object):
""" """
self._name = name self._name = name
self._filename = None self._filename = None
self._cls = cls
self.overhead = overhead self.overhead = overhead
self.overhead_activate = overhead_activate self.overhead_activate = overhead_activate
self.overhead_terminate = overhead_terminate self.overhead_terminate = overhead_terminate
...@@ -86,14 +85,14 @@ class SchedulerInfo(object): ...@@ -86,14 +85,14 @@ class SchedulerInfo(object):
fp, pathname, description = imp.find_module(name, [path]) fp, pathname, description = imp.find_module(name, [path])
if path not in sys.path: if path not in sys.path:
sys.path.append(path) sys.path.append(path)
self._cls = getattr(imp.load_module(name, fp, pathname, clas = getattr(imp.load_module(name, fp, pathname,
description), name) description), name)
fp.close() fp.close()
return clas
except ImportError as e: except ImportError as e:
print("ImportError: ", e) print("ImportError: ", e)
print("name: ", name, "path: ", path) print("name: ", name, "path: ", path)
return None
return self._cls
def instantiate(self, model): def instantiate(self, model):
""" """
...@@ -103,8 +102,9 @@ class SchedulerInfo(object): ...@@ -103,8 +102,9 @@ class SchedulerInfo(object):
- `model`: The :class:`Model <simso.core.Model.Model>` object \ - `model`: The :class:`Model <simso.core.Model.Model>` object \
that is passed to the constructor. that is passed to the constructor.
""" """
cls = self.get_cls() clas = self.get_cls()
return cls(model, self) if clas:
return clas(model, self)
class Scheduler(object): class Scheduler(object):
......
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 sign in to comment