Beispiel #1
0
    def update(self, modulename, filepath=None, schedtype=None):
        if modulename not in self._slps:
            return "Unknown module[" + modulename + "] for updating"
        if filepath == None:
            filepath = self._slps[modulename].filepath
        if schedtype == None:
            schedtype = self._slps[modulename].schedtype

        sched = self._schedman.create(modulename, schedtype)
        if sched == None:
            return "Unknown schedtype: " + schedtype

        m = self._loader.load(modulename, filepath)
        if m == None:
            self._log.logError("Pyslpm", "Compile module[%s:%s] failed: %s"
                % (modulename, filepath, traceback.format_exc()))
            return "Compile module[" + modulename + ", " + filepath + "] failed"
        try: # load module in slp
            slp = pyslp(self._log, self._loader, m, sched)
        except:
            self._log.logError("Pyslpm", "update module[%s:%s] failed: %s"
                % (modulename, filepath, traceback.format_exc()))
            return "update module[" + modulename + ":" + filepath + "] failed"
        slp.name = modulename
        slp.filepath = filepath
        self._stopslp(modulename)
        self._slps[modulename] = slp

        return "update module[" + modulename + ":" + filepath + "] ok"
Beispiel #2
0
    def update(self, modulename, filepath=None, schedtype=None):
        if modulename not in self._slps:
            return "Unknown module[" + modulename + "] for updating"
        if filepath == None:
            filepath = self._slps[modulename].filepath
        if schedtype == None:
            schedtype = self._slps[modulename].schedtype

        sched = self._schedman.create(modulename, schedtype)
        if sched == None:
            return "Unknown schedtype: " + schedtype

        m = self._loader.load(modulename, filepath)
        if m == None:
            self._log.logError(
                "Pyslpm", "Compile module[%s:%s] failed: %s" %
                (modulename, filepath, traceback.format_exc()))
            return "Compile module[" + modulename + ", " + filepath + "] failed"
        try:  # load module in slp
            slp = pyslp(self._log, self._loader, m, sched)
        except:
            self._log.logError(
                "Pyslpm", "update module[%s:%s] failed: %s" %
                (modulename, filepath, traceback.format_exc()))
            return "update module[" + modulename + ":" + filepath + "] failed"
        slp.name = modulename
        slp.filepath = filepath
        self._stopslp(modulename)
        self._slps[modulename] = slp

        return "update module[" + modulename + ":" + filepath + "] ok"
Beispiel #3
0
 def load(self, modulename, filepath, schedtype):
     sched = self._schedman.create(modulename, schedtype)
     if sched == None:
         return "Unknown schedtype: " + schedtype
     m = self._loader.load(modulename, filepath)
     if m == None:
         self._log.logError("Pyslpm", "Compile module[%s:%s] failed: %s"
             % (modulename, filepath, traceback.format_exc()))
         return "Compile module[" + modulename + ", " + filepath + "] failed"
     try: # load module in slp
         slp = pyslp(self._log, self._loader, m, sched)
     except:
         self._log.logError("Pyslpm", "load module[%s:%s] failed: %s"
             % (modulename, filepath, traceback.format_exc()))
         return "Load module[" + modulename + ":" + filepath + "] failed"
     slp.name = modulename
     slp.filepath = filepath
     slp.schedtype = schedtype
     self._slps[modulename] = slp
     return "Load module [" + modulename + ":" + filepath + "] ok"
Beispiel #4
0
 def load(self, modulename, filepath, schedtype):
     sched = self._schedman.create(modulename, schedtype)
     if sched == None:
         return "Unknown schedtype: " + schedtype
     m = self._loader.load(modulename, filepath)
     if m == None:
         self._log.logError(
             "Pyslpm", "Compile module[%s:%s] failed: %s" %
             (modulename, filepath, traceback.format_exc()))
         return "Compile module[" + modulename + ", " + filepath + "] failed"
     try:  # load module in slp
         slp = pyslp(self._log, self._loader, m, sched)
     except:
         self._log.logError(
             "Pyslpm", "load module[%s:%s] failed: %s" %
             (modulename, filepath, traceback.format_exc()))
         return "Load module[" + modulename + ":" + filepath + "] failed"
     slp.name = modulename
     slp.filepath = filepath
     slp.schedtype = schedtype
     self._slps[modulename] = slp
     return "Load module [" + modulename + ":" + filepath + "] ok"