Prechádzať zdrojové kódy

send status on process change

David 10 rokov pred
rodič
commit
cf9dc05c81
1 zmenil súbory, kde vykonal 6 pridanie a 1 odobranie
  1. 6 1
      pmanager/pmanager.py

+ 6 - 1
pmanager/pmanager.py

@@ -80,7 +80,10 @@ class PManager:
             if j["command"] == "netcat":
                 sendmsg(j["key"])
             if j["command"] == "status": #and j["key"] == self.name:
-                self.send({"type": "snowmix", "subtype": "statusreport", "name": self.name, "data":self.p_list})
+                self.sendstatus()
+
+    def sendstatus(self):
+        self.send({"type": "snowmix", "subtype": "statusreport", "name": self.name, "data":self.p_list})
 
     def send(self, data):
         try:
@@ -117,6 +120,7 @@ class PManager:
         if key not in self.p_list:
             log("key %s doesn't exist! not killing!" % (key))
             return
+        self.sendstatus()
         try:
             os.killpg(os.getpgid(self.p_list[key]), signal.SIGTERM)
         except Exception as e:
@@ -152,6 +156,7 @@ class PManager:
             log("This process (%s) is not on my table!" % key)
             return
     
+        self.sendstatus()
         log("Launching! key: %s, opts: %s" % (key, options))
         tolaunch = self.ptable[key]
         if options is not None: