[CalendarServer-changes] [15611] CalendarServer/trunk/calendarserver/tools

source_changes at macosforge.org source_changes at macosforge.org
Thu May 19 10:03:34 PDT 2016


Revision: 15611
          http://trac.calendarserver.org//changeset/15611
Author:   cdaboo at apple.com
Date:     2016-05-19 10:03:33 -0700 (Thu, 19 May 2016)
Log Message:
-----------
Add "D" option to dashview to show just directory panels. Fix dashview to not flash all the time on other than the first host in a pod when Jobs are displayed. Add dashcollect error messages for invalid JSON config file.

Modified Paths:
--------------
    CalendarServer/trunk/calendarserver/tools/dashcollect.py
    CalendarServer/trunk/calendarserver/tools/dashview.py

Modified: CalendarServer/trunk/calendarserver/tools/dashcollect.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/dashcollect.py	2016-05-19 16:22:09 UTC (rev 15610)
+++ CalendarServer/trunk/calendarserver/tools/dashcollect.py	2016-05-19 17:03:33 UTC (rev 15611)
@@ -151,6 +151,7 @@
             try:
                 jsondata = json.loads(f.read(), object_pairs_hook=OrderedDict)
             except Exception:
+                print("Could not read JSON data from {}".format(path))
                 raise RuntimeError("Could not read JSON data from {}".format(path))
 
         try:
@@ -158,6 +159,7 @@
             _verbose("Config '{}'".format(self.title))
             self.pods = [Pod(podname, data) for podname, data in jsondata["pods"].items()]
         except Exception:
+            print("No valid JSON data in {}".format(path))
             raise RuntimeError("No valid JSON data in {}".format(path))
 
 
@@ -195,7 +197,7 @@
         """
         Update the data for each L{Server} in this L{Pod}.
         """
-        _verbose("  Pod: {}".format(self.title))
+        _verbose("  Pod send: {}".format(self.title))
         for server in self.servers:
             server.sendSock()
 
@@ -204,7 +206,7 @@
         """
         Update the data for each L{Server} in this L{Pod}.
         """
-        _verbose("  Pod: {}".format(self.title))
+        _verbose("  Pod read: {}".format(self.title))
         data[self.title] = OrderedDict()
         for server in self.servers:
             server.update(data[self.title])
@@ -296,8 +298,8 @@
         # Only read each item once
         self.currentData = self.readSock(list(set(self.items)))
         data[self.host] = self.currentData
-        _verbose("    Server: {}".format(self.host))
-        _verbose("      Data: {}".format(self.currentData))
+        _verbose("    Server read: {}".format(self.host))
+        #_verbose("      Data: {}".format(self.currentData))
 
 
     def getOneItem(self, item):

Modified: CalendarServer/trunk/calendarserver/tools/dashview.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/dashview.py	2016-05-19 16:22:09 UTC (rev 15610)
+++ CalendarServer/trunk/calendarserver/tools/dashview.py	2016-05-19 17:03:33 UTC (rev 15611)
@@ -34,6 +34,7 @@
 import termios
 import time
 
+
 LOG_FILENAME = 'db.log'
 #logging.basicConfig(filename=LOG_FILENAME, level=logging.DEBUG)
 
@@ -98,6 +99,7 @@
     screen = None
     registered_windows = collections.OrderedDict()
     registered_window_sets = {
+        "D": ("Directory Panels", [],),
         "H": ("HTTP Panels", [],),
         "J": ("Jobs Panels", [],),
     }
@@ -397,6 +399,14 @@
         """
         if len(self.currentData) == 0:
             self.update()
+
+        # jobs are only requested from the first server in a pod because otherwise
+        # it would be too expensive to run the DB query for all servers. So when we
+        # need the jobs data, always substitute the first server's data
+        if item == "jobs":
+            pod = self.currentData["pods"][pod]
+            server = pod.keys()[0]
+
         return self.currentData["pods"][pod][server].get(item)
 
 
@@ -1212,5 +1222,7 @@
 Dashboard.registerWindowSet(AssignmentsWindow, "J")
 Dashboard.registerWindowSet(JobsWindow, "J")
 
+Dashboard.registerWindowSet(DirectoryStatsWindow, "D")
+
 if __name__ == "__main__":
     main()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20160519/6f90aa0e/attachment.html>


More information about the calendarserver-changes mailing list