[CalendarServer-changes] [15119] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu Sep 10 13:09:06 PDT 2015
Revision: 15119
http://trac.calendarserver.org//changeset/15119
Author: cdaboo at apple.com
Date: 2015-09-10 13:09:06 -0700 (Thu, 10 Sep 2015)
Log Message:
-----------
Add ability to override default work item priority and weight values via the config.
Modified Paths:
--------------
CalendarServer/trunk/calendarserver/tap/caldav.py
CalendarServer/trunk/requirements-stable.txt
CalendarServer/trunk/twistedcaldav/stdconfig.py
Modified: CalendarServer/trunk/calendarserver/tap/caldav.py
===================================================================
--- CalendarServer/trunk/calendarserver/tap/caldav.py 2015-09-10 19:48:57 UTC (rev 15118)
+++ CalendarServer/trunk/calendarserver/tap/caldav.py 2015-09-10 20:09:06 UTC (rev 15119)
@@ -67,7 +67,6 @@
from twext.enterprise.adbapi2 import ConnectionPool
from twext.enterprise.ienterprise import ORACLE_DIALECT
from twext.enterprise.ienterprise import POSTGRES_DIALECT
-from twext.enterprise.jobs.jobitem import JobItem
from twext.enterprise.jobs.queue import NonPerformingQueuer
from twext.enterprise.jobs.queue import ControllerQueue
from twext.enterprise.jobs.queue import WorkerFactory as QueueWorkerFactory
@@ -851,8 +850,6 @@
if pool is not None:
pool.setServiceParent(result)
- self._initJobQueue(None)
-
if config.ControlSocket:
id = config.ControlSocket
self.log.info("Control via AF_UNIX: {id}", id=id)
@@ -1300,7 +1297,6 @@
useWorkerPool=False,
disableWorkProcessing=config.MigrationOnly,
)
- self._initJobQueue(pool)
store.queuer = store.pool = pool
pool.setServiceParent(result)
@@ -1865,7 +1861,6 @@
reactor, store.newTransaction,
disableWorkProcessing=config.MigrationOnly,
)
- self._initJobQueue(pool)
# The master should not perform queued work
store.queuer = NonPerformingQueuer()
@@ -1974,34 +1969,7 @@
remove(checkSocket)
- def _initJobQueue(self, pool):
- """
- Common job queue initialization
- @param pool: the connection pool to init or L{None}
- @type pool: L{PeerConnectionPool} or C{None}
- """
-
- # Initialize queue polling parameters from config settings
- if pool is not None:
- for attr in (
- "queuePollInterval",
- "queueOverdueTimeout",
- "overloadLevel",
- "highPriorityLevel",
- "mediumPriorityLevel",
- ):
- setattr(pool, attr, getattr(config.WorkQueue, attr))
-
- # Initialize job parameters from config settings
- for attr in (
- "failureRescheduleInterval",
- "lockRescheduleInterval",
- ):
- setattr(JobItem, attr, getattr(config.WorkQueue, attr))
-
-
-
class TwistdSlaveProcess(object):
"""
A L{TwistdSlaveProcess} is information about how to start a slave process
Modified: CalendarServer/trunk/requirements-stable.txt
===================================================================
--- CalendarServer/trunk/requirements-stable.txt 2015-09-10 19:48:57 UTC (rev 15118)
+++ CalendarServer/trunk/requirements-stable.txt 2015-09-10 20:09:06 UTC (rev 15119)
@@ -36,7 +36,7 @@
#pyOpenSSL
pycrypto==2.6.1
- --editable svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@15113#egg=twextpy
+ --editable svn+http://svn.calendarserver.org/repository/calendarserver/twext/trunk@15118#egg=twextpy
cffi==1.1.0
pycparser==2.13
#twisted
Modified: CalendarServer/trunk/twistedcaldav/stdconfig.py
===================================================================
--- CalendarServer/trunk/twistedcaldav/stdconfig.py 2015-09-10 19:48:57 UTC (rev 15118)
+++ CalendarServer/trunk/twistedcaldav/stdconfig.py 2015-09-10 20:09:06 UTC (rev 15119)
@@ -15,18 +15,24 @@
# limitations under the License.
##
+from os.path import basename
+from plistlib import PlistParser # @UnresolvedImport
+from socket import getfqdn, gethostbyname
import copy
import os
-from os.path import basename
-from plistlib import PlistParser # @UnresolvedImport
import re
-from socket import getfqdn, gethostbyname
import sys
from calendarserver.push.util import getAPNTopicFromCertificate
+
+from twext.enterprise.jobs.jobitem import JobItem
+from twext.enterprise.jobs.queue import ControllerQueue
+from twext.enterprise.jobs.workitem import WorkItem
from twext.python.log import Logger, InvalidLogLevelError, LogLevel
+
from twisted.python.filepath import FilePath
from twisted.python.runtime import platform
+
from twistedcaldav import caldavxml, customxml, carddavxml, mkcolxml
from twistedcaldav import ical
from twistedcaldav.config import ConfigProvider, ConfigurationError, ConfigDict
@@ -35,7 +41,9 @@
from twistedcaldav.util import KeychainAccessError, KeychainPasswordNotFound
from twistedcaldav.util import computeProcessCount
from twistedcaldav.util import getPasswordFromKeychain
+
from txdav.xml import element as davxml
+
from txweb2.dav.resource import TwistedACLInheritable
log = Logger()
@@ -255,6 +263,9 @@
"failureRescheduleInterval": 60, # When a job fails, reschedule it this number of seconds in the future
"lockRescheduleInterval": 60, # When a job can't run because of a lock, reschedule it this number of seconds in the future
+
+ "workParameters": {}, # dict of work table name's, whose values are dicts containing "priority"
+ # and "weight" items to use for newly created work.
},
#
@@ -1310,6 +1321,32 @@
+def _updateWorkQueue(configDict, reloading=False):
+ try:
+ # Initialize queue polling parameters from config settings
+ for attr in (
+ "queuePollInterval",
+ "queueOverdueTimeout",
+ "overloadLevel",
+ "highPriorityLevel",
+ "mediumPriorityLevel",
+ ):
+ setattr(ControllerQueue, attr, getattr(config.WorkQueue, attr))
+
+ # Initialize job parameters from config settings
+ for attr in (
+ "failureRescheduleInterval",
+ "lockRescheduleInterval",
+ ):
+ setattr(JobItem, attr, getattr(config.WorkQueue, attr))
+
+ # Work parameters
+ WorkItem.updateWorkTypes(configDict.WorkQueue.workParameters)
+ except Exception:
+ log.failure("Unable to apply config.workParameters changes")
+
+
+
def _updateMultiProcess(configDict, reloading=False):
"""
Dynamically compute ProcessCount if it's set to 0. Always compute
@@ -1767,6 +1804,7 @@
_updateMultiProcess,
_updateDataStore,
_updateHostName,
+ _updateWorkQueue,
_postUpdateDirectoryService,
_postUpdateResourceService,
_postUpdateAugmentService,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150910/91875295/attachment.html>
More information about the calendarserver-changes
mailing list