[zorg] r311133 - A simple log diff for the server

Chris Matthews via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 17 15:42:43 PDT 2017


Author: cmatthews
Date: Thu Aug 17 15:42:43 2017
New Revision: 311133

URL: http://llvm.org/viewvc/llvm-project?rev=311133&view=rev
Log:
A simple log diff for the server

We monitor log health from Jenkins jobs. Print any new log messages
from the server.

Modified:
    zorg/trunk/llvm-lnt/fabfile.py

Modified: zorg/trunk/llvm-lnt/fabfile.py
URL: http://llvm.org/viewvc/llvm-project/zorg/trunk/llvm-lnt/fabfile.py?rev=311133&r1=311132&r2=311133&view=diff
==============================================================================
--- zorg/trunk/llvm-lnt/fabfile.py (original)
+++ zorg/trunk/llvm-lnt/fabfile.py Thu Aug 17 15:42:43 2017
@@ -8,6 +8,8 @@ from os.path import expanduser
 
 from fabric.api import env, cd, task, run, put
 from fabric.api import sudo
+from fabric.context_managers import hide
+from fabric.operations import get, local
 
 here = os.path.dirname(os.path.realpath(__file__))
 
@@ -60,10 +62,24 @@ def update():
 
 @task
 def log():
-    sudo('cat /srv/lnt/install/lnt.log')
+    get('/srv/lnt/install/lnt.log', 'lnt.log')
+    local('cat lnt.log')
 
 
 @task
+def new_log():
+    """Show only lines since the last time the log was echoed."""
+    if os.path.exists("lnt.log"):
+        lines = {line for line in open("lnt.log", 'r').readlines()}
+    else:
+        lines = {}
+    with hide('warnings'):
+        get('/srv/lnt/install/lnt.log', 'lnt.log', )
+    new_lines = {line for line in open("lnt.log", 'r').readlines()}
+    for l in new_lines - lines:
+        print ' '.join(l.split()[2:]),
+
+ at task
 def ps():
     sudo('ps auxxxf | grep gunicorn')
 




More information about the llvm-commits mailing list