summaryrefslogtreecommitdiffstats
path: root/gearman
diff options
context:
space:
mode:
authorBjörn Geiger2011-08-16 16:24:07 +0200
committerBjörn Geiger2011-08-16 16:24:07 +0200
commitd17aaf52b18336505e9b4f84c611d61e111dd72c (patch)
tree83839e262046c61855e4591d5f61bd851b426262 /gearman
parentverschiedenes (diff)
downloadpoolctrl-d17aaf52b18336505e9b4f84c611d61e111dd72c.tar.gz
poolctrl-d17aaf52b18336505e9b4f84c611d61e111dd72c.tar.xz
poolctrl-d17aaf52b18336505e9b4f84c611d61e111dd72c.zip
minor
Diffstat (limited to 'gearman')
-rw-r--r--gearman/controllerWorker/ControllerWorker/Boot.java17
-rwxr-xr-xgearman/psWorker.py6
-rwxr-xr-xgearman/worker.sh5
3 files changed, 15 insertions, 13 deletions
diff --git a/gearman/controllerWorker/ControllerWorker/Boot.java b/gearman/controllerWorker/ControllerWorker/Boot.java
index 7f40059..6e6ab50 100644
--- a/gearman/controllerWorker/ControllerWorker/Boot.java
+++ b/gearman/controllerWorker/ControllerWorker/Boot.java
@@ -437,19 +437,20 @@ public class Boot extends Thread {
JSONObject resultObj = (JSONObject) JSONValue
.parse(result);
if (!resultObj.containsKey("err")) {
- String rawoutput = resultObj.get("rawoutput")
- .toString();
- System.out.println(rawoutput);
- if (rawoutput.equals("is working")) {
+ String ps = resultObj.get("ps").toString();
+ System.out.println(ps);
+ if (ps.equals("is working")) {
System.out.println(ipAddress
+ " is working");
status.put(clientID, 18); // is working
psJobs.remove(clientID);
} else {
- System.out.println(ipAddress
- + " is not working");
- status.put(clientID, 13); // is not working
- psJobs.remove(clientID);
+ /*
+ * System.out.println(ipAddress +
+ * " is not working"); status.put(clientID,
+ * 13); // is not working
+ * psJobs.remove(clientID);
+ */
}
} else {
System.out.println(ipAddress
diff --git a/gearman/psWorker.py b/gearman/psWorker.py
index db90a66..cc7cdc0 100755
--- a/gearman/psWorker.py
+++ b/gearman/psWorker.py
@@ -32,12 +32,11 @@ def psWorker(worker, job):
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
-
+
while sshCommand.returncode == None:
out = sshCommand.stdout.readline()
if out != "":
ret['rawoutput'] += out
- time.sleep(0.05)
sshCommand.poll()
while True:
@@ -49,11 +48,12 @@ def psWorker(worker, job):
ret['rawoutput'] = ret['rawoutput'].strip() # get rid of newlines
rc = ret['rc'] = sshCommand.returncode
-
if rc == 0:
lines = ret['rawoutput'].splitlines()
ret['ps'] = []
for l in xrange(len(lines)):
+ if l == 0:
+ continue
rowentries = lines[l].split()
if len(rowentries) == 14:
(f, s, uid, pid, ppid, c, pri, ni, addr, sz, wchan, tty, time, cmd) = rowentries
diff --git a/gearman/worker.sh b/gearman/worker.sh
index 4b97f74..827618a 100755
--- a/gearman/worker.sh
+++ b/gearman/worker.sh
@@ -4,5 +4,6 @@
./whoWorker.py >> whoWorker.log 2>&1 |
./wolWorker.py >> wolWorker.log 2>&1 |
./osWorker.py >> osWorker.log 2>&1 |
-./shutdownWorker.py >> shutdownWorker.log 2>&1 |
-./psWorker.py >> psWorker.log 2>&1 \ No newline at end of file
+./psWorker.py >> psWorker.log 2>&1 |
+./shutdownWorker.py >> shutdownWorker.log 2>&1
+