gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r14161 - gauger


From: gnunet
Subject: [GNUnet-SVN] r14161 - gauger
Date: Thu, 13 Jan 2011 15:26:20 +0100

Author: bartpolot
Date: 2011-01-13 15:26:20 +0100 (Thu, 13 Jan 2011)
New Revision: 14161

Added:
   gauger/gauger.py
Log:
Initial gauger implementation import

Added: gauger/gauger.py
===================================================================
--- gauger/gauger.py                            (rev 0)
+++ gauger/gauger.py    2011-01-13 14:26:20 UTC (rev 14161)
@@ -0,0 +1,33 @@
+#!/usr/bin/env python2
+from socket import socket, AF_INET, SOCK_STREAM
+import os
+import csv
+
+def updateplot(host, data):
+  filename = host + '/' + data
+  os.system("gnuplot -e 'set terminal png; set output \"" + filename + 
".png\"; plot \"" + filename + "\" using 2:xticlabel(1) with line title \"" + 
host + ", " + data + "\" lw 3 lt rgb \"green\" '")
+
+s1 = socket(AF_INET, SOCK_STREAM)
+s1.bind(("0.0.0.0", 1111))
+s1.listen(5)
+while(True):
+  s2, address = s1.accept()
+  print 'Connection from:'
+  print address
+  data = s2.recv(4096)
+  s2.close()
+  print data.split(',')
+  hostname, dataname, revision, result = data.strip().split(',')
+  if (not os.path.exists(hostname)):
+    os.mkdir(hostname)
+    print "Created new host directory: ", hostname
+  if (not os.access(hostname, os.W_OK) or not os.path.isdir(hostname)):
+    print "Not a directory or not writable: ", hostname
+    continue
+  datafile = open(hostname + '/' + dataname, "a+")
+  datafile.seek(0, 2)
+  datafile.write(revision + ' ' + result + "\n")
+  datafile.close()
+  updateplot(hostname, dataname)
+
+


Property changes on: gauger/gauger.py
___________________________________________________________________
Added: svn:executable
   + *




reply via email to

[Prev in Thread] Current Thread [Next in Thread]