예제 #1
0
파일: serve.py 프로젝트: golharam/TS
 def control_job(self, pk, signal):
     logging.debug("Analysis queue control_job: %s %s" % (pk, signal))
     """Terminate, suspend, or resume a job."""
     self.cv.acquire()
     try:
         if not self.is_running(pk):
             ret = (False, "not running")
         else:
             a = self.running[pk]
             fn = {"term": a.terminate, "stop": a.suspend, "cont": a.resume}.get(signal.lower())
             if fn is None:
                 ret = (False, "invalid signal")
             else:
                 ret = (fn(), "executed")
     finally:
         self.cv.release()
     return ret
예제 #2
0
 def control_job(self, pk, signal):
     logger.debug("Analysis queue control_job: %s %s" % (pk, signal))
     """Terminate, suspend, or resume a job."""
     self.cv.acquire()
     try:
         if not self.is_running(pk):
             ret = (False, "not running")
         else:
             a = self.running[pk]
             fn = {"term": a.terminate,
                   "stop": a.suspend,
                   "cont": a.resume, }.get(signal.lower())
             if fn is None:
                 ret = (False, "invalid signal")
             else:
                 ret = (fn(), "executed")
     finally:
         self.cv.release()
     return ret
예제 #3
0
 def remove_signal(self, lock_id, signal):
     res = self.adaptor.remove_signal(lock_id, signal.lower())
     return res
예제 #4
0
 def has_signal(self, lock_id, signal):
     res = self.adaptor.has_signal(lock_id, signal.lower())
     return res