[CalendarServer-changes] [15354] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Wed Dec 2 11:25:57 PST 2015
Revision: 15354
http://trac.calendarserver.org//changeset/15354
Author: cdaboo at apple.com
Date: 2015-12-02 11:25:57 -0800 (Wed, 02 Dec 2015)
Log Message:
-----------
Refactor to better support multi-pod sim. Use a proper return code from the sim.
Modified Paths:
--------------
CalendarServer/trunk/conf/caldavd-test-podA.plist
CalendarServer/trunk/conf/caldavd-test-podB.plist
CalendarServer/trunk/contrib/performance/loadtest/clients-old.plist
CalendarServer/trunk/contrib/performance/loadtest/clients.plist
CalendarServer/trunk/contrib/performance/loadtest/config-old.plist
CalendarServer/trunk/contrib/performance/loadtest/config.dist.plist
CalendarServer/trunk/contrib/performance/loadtest/config.plist
CalendarServer/trunk/contrib/performance/loadtest/ical.py
CalendarServer/trunk/contrib/performance/loadtest/population.py
CalendarServer/trunk/contrib/performance/loadtest/sim.py
CalendarServer/trunk/contrib/performance/simanalysis/sim_regress.py
Modified: CalendarServer/trunk/conf/caldavd-test-podA.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test-podA.plist 2015-12-02 18:08:19 UTC (rev 15353)
+++ CalendarServer/trunk/conf/caldavd-test-podA.plist 2015-12-02 19:25:57 UTC (rev 15354)
@@ -116,7 +116,13 @@
<key>AMP</key>
<dict>
<key>Enabled</key>
+ <true/>
+ <key>Port</key>
+ <integer>62311</integer>
+ <key>EnableStaggering</key>
<false/>
+ <key>StaggerSeconds</key>
+ <integer>3</integer>
</dict>
</dict>
Modified: CalendarServer/trunk/conf/caldavd-test-podB.plist
===================================================================
--- CalendarServer/trunk/conf/caldavd-test-podB.plist 2015-12-02 18:08:19 UTC (rev 15353)
+++ CalendarServer/trunk/conf/caldavd-test-podB.plist 2015-12-02 19:25:57 UTC (rev 15354)
@@ -116,7 +116,13 @@
<key>AMP</key>
<dict>
<key>Enabled</key>
+ <true/>
+ <key>Port</key>
+ <integer>62312</integer>
+ <key>EnableStaggering</key>
<false/>
+ <key>StaggerSeconds</key>
+ <integer>3</integer>
</dict>
</dict>
Modified: CalendarServer/trunk/contrib/performance/loadtest/clients-old.plist
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/clients-old.plist 2015-12-02 18:08:19 UTC (rev 15353)
+++ CalendarServer/trunk/contrib/performance/loadtest/clients-old.plist 2015-12-02 19:25:57 UTC (rev 15354)
@@ -55,12 +55,6 @@
<key>supportAmpPush</key>
<true/>
- <key>ampPushHosts</key>
- <array>
- <string>localhost</string>
- </array>
- <key>ampPushPort</key>
- <integer>62311</integer>
</dict>
<!-- The profiles define certain types of user behavior on top of the
Modified: CalendarServer/trunk/contrib/performance/loadtest/clients.plist
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/clients.plist 2015-12-02 18:08:19 UTC (rev 15353)
+++ CalendarServer/trunk/contrib/performance/loadtest/clients.plist 2015-12-02 19:25:57 UTC (rev 15354)
@@ -55,12 +55,6 @@
<key>supportAmpPush</key>
<true/>
- <key>ampPushHosts</key>
- <array>
- <string>localhost</string>
- </array>
- <key>ampPushPort</key>
- <integer>62311</integer>
</dict>
<!-- The profiles define certain types of user behavior on top of the
Modified: CalendarServer/trunk/contrib/performance/loadtest/config-old.plist
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/config-old.plist 2015-12-02 18:08:19 UTC (rev 15353)
+++ CalendarServer/trunk/contrib/performance/loadtest/config-old.plist 2015-12-02 19:25:57 UTC (rev 15354)
@@ -31,6 +31,13 @@
<key>uri</key>
<string>https://localhost:8443</string>
+ <key>ampPushHosts</key>
+ <array>
+ <string>localhost</string>
+ </array>
+ <key>ampPushPort</key>
+ <integer>62311</integer>
+
<!-- Define whether server supports stats socket. -->
<key>stats</key>
<dict>
@@ -49,6 +56,13 @@
<key>uri</key>
<string>https://localhost:8543</string>
+ <key>ampPushHosts</key>
+ <array>
+ <string>localhost</string>
+ </array>
+ <key>ampPushPort</key>
+ <integer>62312</integer>
+
<!-- Define whether server supports stats socket. -->
<key>stats</key>
<dict>
Modified: CalendarServer/trunk/contrib/performance/loadtest/config.dist.plist
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/config.dist.plist 2015-12-02 18:08:19 UTC (rev 15353)
+++ CalendarServer/trunk/contrib/performance/loadtest/config.dist.plist 2015-12-02 19:25:57 UTC (rev 15354)
@@ -44,6 +44,13 @@
<key>uri</key>
<string>https://localhost:8443</string>
+ <key>ampPushHosts</key>
+ <array>
+ <string>localhost</string>
+ </array>
+ <key>ampPushPort</key>
+ <integer>62311</integer>
+
<!-- Define whether server supports stats socket. -->
<key>stats</key>
<dict>
@@ -62,6 +69,13 @@
<key>uri</key>
<string>https://localhost:8543</string>
+ <key>ampPushHosts</key>
+ <array>
+ <string>localhost</string>
+ </array>
+ <key>ampPushPort</key>
+ <integer>62312</integer>
+
<!-- Define whether server supports stats socket. -->
<key>stats</key>
<dict>
Modified: CalendarServer/trunk/contrib/performance/loadtest/config.plist
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/config.plist 2015-12-02 18:08:19 UTC (rev 15353)
+++ CalendarServer/trunk/contrib/performance/loadtest/config.plist 2015-12-02 19:25:57 UTC (rev 15354)
@@ -31,6 +31,13 @@
<key>uri</key>
<string>https://localhost:8443</string>
+ <key>ampPushHosts</key>
+ <array>
+ <string>localhost</string>
+ </array>
+ <key>ampPushPort</key>
+ <integer>62311</integer>
+
<!-- Define whether server supports stats socket. -->
<key>stats</key>
<dict>
@@ -49,6 +56,13 @@
<key>uri</key>
<string>https://localhost:8543</string>
+ <key>ampPushHosts</key>
+ <array>
+ <string>localhost</string>
+ </array>
+ <key>ampPushPort</key>
+ <integer>62312</integer>
+
<!-- Define whether server supports stats socket. -->
<key>stats</key>
<dict>
Modified: CalendarServer/trunk/contrib/performance/loadtest/ical.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/ical.py 2015-12-02 18:08:19 UTC (rev 15353)
+++ CalendarServer/trunk/contrib/performance/loadtest/ical.py 2015-12-02 19:25:57 UTC (rev 15354)
@@ -489,7 +489,7 @@
def __init__(
self,
reactor,
- root,
+ server,
principalPathTemplate,
serializePath,
record,
@@ -498,8 +498,6 @@
calendarHomePollInterval=None,
supportPush=True,
supportAmpPush=True,
- ampPushHosts=None,
- ampPushPort=62311,
):
self._client_id = str(uuid4())
@@ -514,7 +512,7 @@
agent = ContentDecoderAgent(agent, [("gzip", GzipDecoder)])
self.agent = AuthHandlerAgent(agent, auth)
- self.root = root
+ self.server = server
self.principalPathTemplate = principalPathTemplate
self.record = record
@@ -529,10 +527,11 @@
self.supportPush = supportPush
self.supportAmpPush = supportAmpPush
+ ampPushHosts = self.server.get("ampPushHosts")
if ampPushHosts is None:
- ampPushHosts = [urlparse(self.root)[1].split(":")[0]]
+ ampPushHosts = [urlparse(self.server["uri"])[1].split(":")[0]]
self.ampPushHosts = ampPushHosts
- self.ampPushPort = ampPushPort
+ self.ampPushPort = self.server.get("ampPushPort", 62311)
self.serializePath = serializePath
@@ -666,7 +665,7 @@
response = yield self._request(
allowedStatus,
'PROPFIND',
- self.root + url.encode('utf-8'),
+ self.server["uri"] + url.encode('utf-8'),
hdrs,
StringProducer(body),
method_label=method_label,
@@ -687,7 +686,7 @@
response = yield self._request(
(OK, MULTI_STATUS,),
'PROPPATCH',
- self.root + url.encode('utf-8'),
+ self.server["uri"] + url.encode('utf-8'),
hdrs,
StringProducer(body),
method_label=method_label,
@@ -711,7 +710,7 @@
response = yield self._request(
allowedStatus,
'REPORT',
- self.root + url.encode('utf-8'),
+ self.server["uri"] + url.encode('utf-8'),
hdrs,
StringProducer(body),
method_label=method_label,
@@ -1203,7 +1202,7 @@
response = yield self._request(
OK,
'GET',
- self.root + responseHref.encode('utf-8'),
+ self.server["uri"] + responseHref.encode('utf-8'),
method_label="GET{notification}",
)
body = yield readBody(response)
@@ -1261,7 +1260,7 @@
response = yield self._request(
(NO_CONTENT, NOT_FOUND),
'DELETE',
- self.root + responseHref.encode('utf-8'),
+ self.server["uri"] + responseHref.encode('utf-8'),
method_label="DELETE{invite}",
)
@@ -1572,7 +1571,7 @@
"principalURL": self.principalURL,
"calendars": [calendar.serialize() for calendar in sorted(self._calendars.values(), key=lambda x:x.name)],
"events": [event.serialize() for event in sorted(self._events.values(), key=lambda x:x.url)],
- "notificationCollection" : self._notificationCollection.serialize(),
+ "notificationCollection" : self._notificationCollection.serialize() if self._notificationCollection else {},
}
# Write JSON data
with open(os.path.join(path, "index.json"), "w") as f:
@@ -1607,6 +1606,8 @@
for calendar in data["calendars"]:
calendar = Calendar.deserialize(calendar, self._events)
self._calendars[calendar.url] = calendar
+ if data["notificationCollection"]:
+ self._notificationCollection = NotificationCollection.deserialize(data, {})
@inlineCallbacks
@@ -1674,7 +1675,7 @@
response = yield self._request(
(NO_CONTENT, PRECONDITION_FAILED,),
'PUT',
- self.root + href.encode('utf-8'),
+ self.server["uri"] + href.encode('utf-8'),
Headers({
'content-type': ['text/calendar'],
'if-match': [event.etag]}),
@@ -1769,7 +1770,7 @@
response = yield self._request(
okCodes,
'PUT',
- self.root + href.encode('utf-8'),
+ self.server["uri"] + href.encode('utf-8'),
headers, StringProducer(component.getTextWithTimezones(includeTimezones=True)),
method_label="PUT{attendee-%s}" % (label_suffix,),
)
@@ -1790,7 +1791,7 @@
response = yield self._request(
(NO_CONTENT, NOT_FOUND),
'DELETE',
- self.root + href.encode('utf-8'),
+ self.server["uri"] + href.encode('utf-8'),
method_label="DELETE{event}",
)
returnValue(response)
@@ -1814,7 +1815,7 @@
response = yield self._request(
CREATED,
'PUT',
- self.root + href.encode('utf-8'),
+ self.server["uri"] + href.encode('utf-8'),
headers,
StringProducer(component.getTextWithTimezones(includeTimezones=True)),
method_label="PUT{organizer-%s}" % (label_suffix,) if invite else "PUT{event}",
@@ -1850,7 +1851,7 @@
response = yield self._request(
(NO_CONTENT, PRECONDITION_FAILED,),
'PUT',
- self.root + href.encode('utf-8'),
+ self.server["uri"] + href.encode('utf-8'),
Headers({
'content-type': ['text/calendar'],
'if-match': [event.etag]
@@ -1882,7 +1883,7 @@
response = yield self._request(
OK,
'GET',
- self.root + href.encode('utf-8'),
+ self.server["uri"] + href.encode('utf-8'),
method_label="GET{event}",
)
headers = response.headers
@@ -1913,7 +1914,7 @@
@return: A C{Deferred} which fires with a C{dict}. Keys in the dict
are user UUIDs (those requested) and values are something else.
"""
- outbox = self.root + self.outbox
+ outbox = self.server["uri"] + self.outbox
if mask:
maskStr = u'\r\n'.join(['X-CALENDARSERVER-MASK-UID:' + uid
@@ -1970,7 +1971,7 @@
@inlineCallbacks
def postAttachment(self, href, content):
- url = self.root + "{0}?{1}".format(href, "action=attachment-add")
+ url = self.server["uri"] + "{0}?{1}".format(href, "action=attachment-add")
filename = 'file-{}.txt'.format(len(content))
headers = Headers({
'Content-Disposition': ['attachment; filename="{}"'.format(filename)]
@@ -1995,7 +1996,7 @@
response = yield self._request(
(OK, CREATED, MULTI_STATUS),
'POST',
- self.root + href,
+ self.server["uri"] + href,
headers=headers,
body=StringProducer(content),
method_label=label
Modified: CalendarServer/trunk/contrib/performance/loadtest/population.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/population.py 2015-12-02 18:08:19 UTC (rev 15353)
+++ CalendarServer/trunk/contrib/performance/loadtest/population.py 2015-12-02 19:25:57 UTC (rev 15354)
@@ -81,12 +81,12 @@
self.profileTypes = profileTypes
- def new(self, reactor, serverAddress, principalPathTemplate, serializationPath, userRecord, authInfo):
+ def new(self, reactor, server, principalPathTemplate, serializationPath, userRecord, authInfo):
"""
Create a new instance of this client type.
"""
return self.clientType(
- reactor, serverAddress, principalPathTemplate,
+ reactor, server, principalPathTemplate,
serializationPath, userRecord, authInfo,
**self.clientParams
)
@@ -265,7 +265,7 @@
reactor = loggedReactor(self.reactor)
client = clientType.new(
reactor,
- self.servers[record.podID]["uri"],
+ self.servers[record.podID],
self.principalPathTemplate,
self.serializationPath,
record,
Modified: CalendarServer/trunk/contrib/performance/loadtest/sim.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/sim.py 2015-12-02 18:08:19 UTC (rev 15353)
+++ CalendarServer/trunk/contrib/performance/loadtest/sim.py 2015-12-02 19:25:57 UTC (rev 15354)
@@ -433,7 +433,9 @@
@classmethod
def main(cls, args=None):
simulator = cls.fromCommandLine(args)
- raise SystemExit(simulator.run())
+ exitCode = simulator.run()
+ print("Exit code: {}".format(exitCode))
+ raise SystemExit(exitCode)
def createSimulator(self):
@@ -489,7 +491,10 @@
self.reactor.listenTCP(self.webadminPort, Site(LoadSimAdminResource(self)))
self.reactor.run()
+ # Return code to indicate pass or fail
+ return 0 if all([len(obs.failures()) == 0 for obs in self.observers]) else 1
+
def stop(self):
if self.ms.running:
self.updateStats()
Modified: CalendarServer/trunk/contrib/performance/simanalysis/sim_regress.py
===================================================================
--- CalendarServer/trunk/contrib/performance/simanalysis/sim_regress.py 2015-12-02 18:08:19 UTC (rev 15353)
+++ CalendarServer/trunk/contrib/performance/simanalysis/sim_regress.py 2015-12-02 19:25:57 UTC (rev 15354)
@@ -59,7 +59,10 @@
self.stopServer()
with open(logfile) as f:
qos = filter(lambda line: line.strip().startswith("Qos : "), f.read().splitlines())
- qos = float(qos[0].strip()[len("Qos : "):]) if qos else None
+ try:
+ qos = float(qos[0].strip()[len("Qos : "):])
+ except (IndexError, ValueError):
+ qos = None
print("Revision: {} Qos: {}".format(self.currentRev, qos))
self.results.append((self.currentRev, qos))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20151202/3969690f/attachment-0001.html>
More information about the calendarserver-changes
mailing list