[CalendarServer-changes] [15618] CalendarServer/trunk/calendarserver/tools/dashcollect.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu May 19 15:17:08 PDT 2016
Revision: 15618
http://trac.calendarserver.org//changeset/15618
Author: dre at apple.com
Date: 2016-05-19 15:17:08 -0700 (Thu, 19 May 2016)
Log Message:
-----------
Enhance dashcollect docstring
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tools/dashcollect.py
Modified: CalendarServer/trunk/calendarserver/tools/dashcollect.py
===================================================================
--- CalendarServer/trunk/calendarserver/tools/dashcollect.py 2016-05-19 22:04:51 UTC (rev 15617)
+++ CalendarServer/trunk/calendarserver/tools/dashcollect.py 2016-05-19 22:17:08 UTC (rev 15618)
@@ -15,52 +15,14 @@
# limitations under the License.
##
-from collections import OrderedDict
-from datetime import datetime, date
-from threading import Thread
-import SocketServer
-import argparse
-import errno
-import json
-import os
-import sched
-import socket
-import sys
-import time
-
"""
A service that logs dashboard data from multiple hosts and stores them in
log files. It can also, optionally, make the most recent data available
for retrieval via a simple TCP socket read on a specific port.
-"""
-"""
-JSON schema for servers file:
+This tool uses its own config file, specified with the '-f' option. A
+sample is shown below:
-; root object
-OBJECT (title, pods)
-
-; Title/description of this config
-MEMBER title "title" : STRING
-
-; pods - set of pods to monitor
-MEMBER pods "pod" : Object (
- *pod
-)
-
-; An event type
-MEMBER pod "" : Object(
- ?description, servers
-)
-
-; The description of a pod
-MEMBER description "description" : STRING
-
-; Servers associated with a pod
-; Server names are either "host:port", or "unix:path"
-MEMBER servers "servers" : ARRAY STRING
-
-Example:
{
"title": "My CalDAV service",
"pods": {
@@ -82,6 +44,19 @@
}
"""
+from collections import OrderedDict
+from datetime import datetime, date
+from threading import Thread
+import SocketServer
+import argparse
+import errno
+import json
+import os
+import sched
+import socket
+import sys
+import time
+
verbose = False
def _verbose(log):
if verbose:
@@ -90,8 +65,16 @@
def main():
- parser = argparse.ArgumentParser(description="Dashboard service for CalendarServer.")
- parser.add_argument("-f", help="Server config file")
+ try:
+ # to produce a docstring target
+ thisFile = __file__
+ except NameError:
+ # unlikely but possible...
+ thisFile = sys.argv[0]
+ parser = argparse.ArgumentParser(
+ description="Dashboard service for CalendarServer.",
+ epilog="To view the docstring, run: pydoc {}".format(thisFile))
+ parser.add_argument("-f", help="Server config file (see docstring for details)")
parser.add_argument("-l", help="Log file directory")
parser.add_argument("-n", action="store_true", help="New log file")
parser.add_argument("-s", default="localhost:8200", help="Run the dash_thread service on the specified host:port")
@@ -143,6 +126,31 @@
class Config(object):
"""
Loads the config and creates a list of L{Pod}'s.
+
+ JSON schema for server config file:
+
+ ; root object
+ OBJECT (title, pods)
+
+ ; Title/description of this config
+ MEMBER title "title" : STRING
+
+ ; pods - set of pods to monitor
+ MEMBER pods "pod" : Object (
+ *pod
+ )
+
+ ; An event type
+ MEMBER pod "" : Object(
+ ?description, servers
+ )
+
+ ; The description of a pod
+ MEMBER description "description" : STRING
+
+ ; Servers associated with a pod
+ ; Server names are either "host:port", or "unix:path"
+ MEMBER servers "servers" : ARRAY STRING
"""
def loadFromFile(self, path):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20160519/7b8f1c2e/attachment-0001.html>
More information about the calendarserver-changes
mailing list