Browse Source

Changes to slim for LodelContext - corrects is_running

prieto 8 years ago
parent
commit
ec0208a0aa
1 changed files with 8 additions and 12 deletions
  1. 8
    12
      progs/slim/slim.py

+ 8
- 12
progs/slim/slim.py View File

@@ -286,18 +286,14 @@ with pid %d found" % (name, pids[name]))
286 286
 #
287 287
 #If not running clean the pid list
288 288
 #@return bool
289
-def is_running(name, pid):
290
-    try:
291
-        os.kill(pid, 0)
292
-        return True
293
-    except (OSError,ProcessLookupError):
294
-        pid_datas = get_pids()
295
-        logging.warning("Instance '%s' was marked as running, but not \
296
-process with pid %d found. Cleaning pid list" % (name, pid))
297
-        del(pid_datas[name])
298
-        save_pids(pid_datas)
299
-    return False
300
-        
289
+def is_running(name):
290
+    if name is None:
291
+        return LodelContext._current is not None
292
+    else:
293
+        if LodelContext._type == LodelContext.MONOSITE
294
+            logging.warning("In monosite mode no name is allowed")
295
+        else:
296
+            return LodelContext.__current == LodelContext._contexts[name]
301 297
 
302 298
 ##@brief Check if instance are specified
303 299
 def get_specified(args):

Loading…
Cancel
Save