<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[13515] twext/trunk/twext/enterprise</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.calendarserver.org//changeset/13515">13515</a></dd>
<dt>Author</dt> <dd>cdaboo@apple.com</dd>
<dt>Date</dt> <dd>2014-05-20 11:38:40 -0700 (Tue, 20 May 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add singleton and regenerating WorkItem types.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#twexttrunktwextenterprisedalrecordpy">twext/trunk/twext/enterprise/dal/record.py</a></li>
<li><a href="#twexttrunktwextenterprisedaltesttest_recordpy">twext/trunk/twext/enterprise/dal/test/test_record.py</a></li>
<li><a href="#twexttrunktwextenterprisejobqueuepy">twext/trunk/twext/enterprise/jobqueue.py</a></li>
<li><a href="#twexttrunktwextenterprisetesttest_jobqueuepy">twext/trunk/twext/enterprise/test/test_jobqueue.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="twexttrunktwextenterprisedalrecordpy"></a>
<div class="modfile"><h4>Modified: twext/trunk/twext/enterprise/dal/record.py (13514 => 13515)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/twext/enterprise/dal/record.py        2014-05-20 13:53:21 UTC (rev 13514)
+++ twext/trunk/twext/enterprise/dal/record.py        2014-05-20 18:38:40 UTC (rev 13515)
</span><span class="lines">@@ -417,6 +417,17 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @classmethod
</span><ins>+ def deleteall(cls, transaction):
+ """
+ Delete all rows from the table that corresponds to C{cls}.
+ """
+ return Delete(
+ From=cls.table,
+ Where=None,
+ ).on(transaction)
+
+
+ @classmethod
</ins><span class="cx"> @inlineCallbacks
</span><span class="cx"> def _rowsFromQuery(cls, transaction, qry, rozrc):
</span><span class="cx"> """
</span></span></pre></div>
<a id="twexttrunktwextenterprisedaltesttest_recordpy"></a>
<div class="modfile"><h4>Modified: twext/trunk/twext/enterprise/dal/test/test_record.py (13514 => 13515)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/twext/enterprise/dal/test/test_record.py        2014-05-20 13:53:21 UTC (rev 13514)
+++ twext/trunk/twext/enterprise/dal/test/test_record.py        2014-05-20 18:38:40 UTC (rev 13515)
</span><span class="lines">@@ -319,6 +319,23 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><ins>+ def test_deleteall(self):
+ """
+ L{Record.deleteall} will delete all instances of the record.
+ """
+ txn = self.pool.connection()
+ data = [(123, u"one"), (456, u"four"), (345, u"three"),
+ (234, u"two"), (356, u"three")]
+ for beta, gamma in data:
+ yield txn.execSQL("insert into ALPHA values (:1, :2)",
+ [beta, gamma])
+
+ yield TestRecord.deleteall(txn)
+ all = yield TestRecord.all(txn)
+ self.assertEqual(len(all), 0)
+
+
+ @inlineCallbacks
</ins><span class="cx"> def test_repr(self):
</span><span class="cx"> """
</span><span class="cx"> The C{repr} of a L{Record} presents all its values.
</span></span></pre></div>
<a id="twexttrunktwextenterprisejobqueuepy"></a>
<div class="modfile"><h4>Modified: twext/trunk/twext/enterprise/jobqueue.py (13514 => 13515)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/twext/enterprise/jobqueue.py        2014-05-20 13:53:21 UTC (rev 13514)
+++ twext/trunk/twext/enterprise/jobqueue.py        2014-05-20 18:38:40 UTC (rev 13515)
</span><span class="lines">@@ -513,33 +513,18 @@
</span><span class="cx"> # date.
</span><span class="cx"> workItem = yield self.workItem()
</span><span class="cx"> if workItem is not None:
</span><del>- if workItem.group is not None:
- try:
- yield NamedLock.acquire(self.transaction, workItem.group)
- except Exception as e:
- log.error("JobItem: {jobid}, WorkItem: {workid} lock failed: {exc}".format(
- jobid=self.jobID,
- workid=workItem.workID,
- exc=e,
- ))
- raise JobFailedError(e)
-
</del><span class="cx"> try:
</span><del>- # Once the work is done we delete ourselves
- yield workItem.delete()
- except NoSuchRecord:
- # The record has already been removed
- pass
- else:
- try:
</del><ins>+ okToGo = yield workItem.beforeWork()
+ if okToGo:
</ins><span class="cx"> yield workItem.doWork()
</span><del>- except Exception as e:
- log.error("JobItem: {jobid}, WorkItem: {workid} failed: {exc}".format(
- jobid=self.jobID,
- workid=workItem.workID,
- exc=e,
- ))
- raise JobFailedError(e)
</del><ins>+ yield workItem.afterWork()
+ except Exception as e:
+ log.error("JobItem: {jobid}, WorkItem: {workid} failed: {exc}".format(
+ jobid=self.jobID,
+ workid=workItem.workID,
+ exc=e,
+ ))
+ raise JobFailedError(e)
</ins><span class="cx">
</span><span class="cx"> try:
</span><span class="cx"> # Once the work is done we delete ourselves
</span><span class="lines">@@ -826,6 +811,40 @@
</span><span class="cx"> returnValue(workItems)
</span><span class="cx">
</span><span class="cx">
</span><ins>+ @inlineCallbacks
+ def beforeWork(self):
+ """
+ A hook that gets called before the L{WorkItem} does its real work. This can be used
+ for common behaviors need by work items. The base implementation handles the group
+ locking behavior.
+
+ @return: an L{Deferred} that fires with L{True} if processing of the L{WorkItem}
+ should continue, L{False} if it should be skipped without error.
+ @rtype: L{Deferred}
+ """
+ if self.group is not None:
+ try:
+ yield NamedLock.acquire(self.transaction, self.group)
+ except Exception as e:
+ log.error("JobItem: {jobid}, WorkItem: {workid} lock failed: {exc}".format(
+ jobid=self.jobID,
+ workid=self.workID,
+ exc=e,
+ ))
+ raise JobFailedError(e)
+
+ try:
+ # Work item is deleted before doing work - but someone else may have
+ # done it whilst we waited on the lock so handle that by simply
+ # ignoring the work
+ yield self.delete()
+ except NoSuchRecord:
+ # The record has already been removed
+ returnValue(False)
+ else:
+ returnValue(True)
+
+
</ins><span class="cx"> def doWork(self):
</span><span class="cx"> """
</span><span class="cx"> Subclasses must implement this to actually perform the queued work.
</span><span class="lines">@@ -838,7 +857,123 @@
</span><span class="cx"> raise NotImplementedError
</span><span class="cx">
</span><span class="cx">
</span><ins>+ def afterWork(self):
+ """
+ A hook that gets called after the L{WorkItem} does its real work. This can be used
+ for common clean-up behaviors. The base implementation does nothing.
+ """
+ return succeed(None)
</ins><span class="cx">
</span><ins>+
+ @classmethod
+ @inlineCallbacks
+ def reschedule(cls, transaction, seconds, **kwargs):
+ """
+ Reschedule this work.
+
+ @param seconds: optional seconds delay - if not present use the class value.
+ @type seconds: L{int} or L{None}
+ """
+ if seconds is not None and seconds >= 0:
+ notBefore = (
+ datetime.utcnow() +
+ timedelta(seconds=seconds)
+ )
+ log.info(
+ "Scheduling next {cls}: {when}",
+ cls=cls.__name__,
+ when=notBefore,
+ )
+ wp = yield transaction._queuer.enqueueWork(
+ transaction,
+ cls,
+ notBefore=notBefore,
+ **kwargs
+ )
+ returnValue(wp)
+ else:
+ returnValue(None)
+
+
+
+class SingletonWorkItem(WorkItem):
+ """
+ An L{WorkItem} that can only appear once no matter how many times an attempt is
+ made to create one. The L{allowOverride} class property determines whether the attempt
+ to create a new job is simply ignored, or whether the new job overrides any existing
+ one.
+ """
+
+ @classmethod
+ @inlineCallbacks
+ def makeJob(cls, transaction, **kwargs):
+ """
+ A new work item needs to be created. First we create a Job record, then
+ we create the actual work item related to the job.
+
+ @param transaction: the transaction to use
+ @type transaction: L{IAsyncTransaction}
+ """
+
+ all = yield cls.all(transaction)
+ if len(all):
+ # Silently ignore the creation of this work
+ returnValue(None)
+
+ result = yield super(SingletonWorkItem, cls).makeJob(transaction, **kwargs)
+ returnValue(result)
+
+
+ @inlineCallbacks
+ def beforeWork(self):
+ """
+ No need to lock - for safety just delete any others.
+ """
+
+ # Delete all other work items
+ yield self.deleteall(self.transaction)
+ returnValue(True)
+
+
+ @classmethod
+ @inlineCallbacks
+ def reschedule(cls, transaction, seconds, force=False, **kwargs):
+ """
+ Reschedule a singleton. If L{force} is set then delete any existing item before
+ creating the new one. This allows the caller to explicitly override an existing
+ singleton.
+ """
+ if force:
+ yield cls.deleteall(transaction)
+ all = yield cls.all(transaction)
+ result = yield super(SingletonWorkItem, cls).reschedule(transaction, seconds, **kwargs)
+ returnValue(result)
+
+
+
+class RegeneratingWorkItem(SingletonWorkItem):
+ """
+ An L{SingletonWorkItem} that regenerates itself when work is done.
+ """
+
+ def regenerateInterval(self):
+ """
+ Return the interval in seconds between regenerating instances.
+ """
+ return None
+
+
+ @inlineCallbacks
+ def afterWork(self):
+ """
+ A hook that gets called after the L{WorkItem} does its real work. This can be used
+ for common clean-up behaviors. The base implementation does nothing.
+ """
+ yield super(RegeneratingWorkItem, self).afterWork()
+ yield self.reschedule(self.transaction, self.regenerateInterval())
+
+
+
</ins><span class="cx"> class PerformJob(Command):
</span><span class="cx"> """
</span><span class="cx"> Notify another process that it must do a job that has been persisted to
</span><span class="lines">@@ -1217,13 +1352,20 @@
</span><span class="cx"> def __init__(self, transactionFactory, whenConnected,
</span><span class="cx"> boxReceiver=None, locator=None):
</span><span class="cx"> super(ConnectionFromController, self).__init__(boxReceiver, locator)
</span><del>- self.transactionFactory = transactionFactory
</del><ins>+ self._txnFactory = transactionFactory
</ins><span class="cx"> self.whenConnected = whenConnected
</span><span class="cx"> # FIXME: Glyph it appears WorkProposal expects this to have reactor...
</span><span class="cx"> from twisted.internet import reactor
</span><span class="cx"> self.reactor = reactor
</span><span class="cx">
</span><span class="cx">
</span><ins>+ @property
+ def transactionFactory(self):
+ txn = self._txnFactory
+ txn._queuer = self
+ return txn
+
+
</ins><span class="cx"> def startReceivingBoxes(self, sender):
</span><span class="cx"> super(ConnectionFromController, self).startReceivingBoxes(sender)
</span><span class="cx"> self.whenConnected(self)
</span></span></pre></div>
<a id="twexttrunktwextenterprisetesttest_jobqueuepy"></a>
<div class="modfile"><h4>Modified: twext/trunk/twext/enterprise/test/test_jobqueue.py (13514 => 13515)</h4>
<pre class="diff"><span>
<span class="info">--- twext/trunk/twext/enterprise/test/test_jobqueue.py        2014-05-20 13:53:21 UTC (rev 13514)
+++ twext/trunk/twext/enterprise/test/test_jobqueue.py        2014-05-20 18:38:40 UTC (rev 13515)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx"> ConnectionFromPeerNode, LocalQueuer,
</span><span class="cx"> _BaseQueuer, NonPerformingQueuer, JobItem,
</span><span class="cx"> WORK_PRIORITY_LOW, WORK_PRIORITY_HIGH, WORK_PRIORITY_MEDIUM,
</span><del>- JobDescriptor
</del><ins>+ JobDescriptor, SingletonWorkItem
</ins><span class="cx"> )
</span><span class="cx"> import twext.enterprise.jobqueue
</span><span class="cx">
</span><span class="lines">@@ -229,15 +229,15 @@
</span><span class="cx"> for table in ("DUMMY_WORK_ITEM",)
</span><span class="cx"> ] + ["delete from job"]
</span><span class="cx"> except SkipTest as e:
</span><del>- DummyWorkItem = object
</del><ins>+ DummyWorkItemTable = object
</ins><span class="cx"> skip = e
</span><span class="cx"> else:
</span><del>- DummyWorkItem = fromTable(schema.DUMMY_WORK_ITEM)
</del><ins>+ DummyWorkItemTable = fromTable(schema.DUMMY_WORK_ITEM)
</ins><span class="cx"> skip = False
</span><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><del>-class DummyWorkItem(WorkItem, DummyWorkItem):
</del><ins>+class DummyWorkItem(WorkItem, DummyWorkItemTable):
</ins><span class="cx"> """
</span><span class="cx"> Sample L{WorkItem} subclass that adds two integers together and stores them
</span><span class="cx"> in another table.
</span><span class="lines">@@ -261,7 +261,7 @@
</span><span class="cx"> a concurrent transaction, then commit it.
</span><span class="cx"> """
</span><span class="cx"> workItems = yield super(DummyWorkItem, cls).loadForJob(txn, *a)
</span><del>- if workItems[0].deleteOnLoad:
</del><ins>+ if len(workItems) and workItems[0].deleteOnLoad:
</ins><span class="cx"> otherTransaction = txn.store().newTransaction()
</span><span class="cx"> otherSelf = yield super(DummyWorkItem, cls).loadForJob(txn, *a)
</span><span class="cx"> yield otherSelf[0].delete()
</span><span class="lines">@@ -270,6 +270,22 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx">
</span><ins>+class DummyWorkSingletonItem(SingletonWorkItem, DummyWorkItemTable):
+ """
+ Sample L{SingletonWorkItem} subclass that adds two integers together and stores them
+ in another table.
+ """
+
+ results = {}
+
+ def doWork(self):
+ if self.a == -1:
+ raise ValueError("Ooops")
+ self.results[self.jobID] = self.a + self.b
+ return succeed(None)
+
+
+
</ins><span class="cx"> class AMPTests(TestCase):
</span><span class="cx"> """
</span><span class="cx"> Tests for L{AMP} faithfully relaying ids across the wire.
</span><span class="lines">@@ -318,7 +334,7 @@
</span><span class="cx">
</span><span class="cx">
</span><span class="cx"> @inlineCallbacks
</span><del>- def _enqueue(self, dbpool, a, b, notBefore=None, priority=None, weight=None):
</del><ins>+ def _enqueue(self, dbpool, a, b, notBefore=None, priority=None, weight=None, cl=DummyWorkItem):
</ins><span class="cx"> fakeNow = datetime.datetime(2012, 12, 12, 12, 12, 12)
</span><span class="cx"> if notBefore is None:
</span><span class="cx"> notBefore = datetime.datetime(2012, 12, 13, 12, 12, 0)
</span><span class="lines">@@ -339,7 +355,7 @@
</span><span class="cx"> @transactionally(dbpool.connection)
</span><span class="cx"> def check(txn):
</span><span class="cx"> return qpool.enqueueWork(
</span><del>- txn, DummyWorkItem,
</del><ins>+ txn, cl,
</ins><span class="cx"> a=a, b=b, priority=priority, weight=weight,
</span><span class="cx"> notBefore=notBefore
</span><span class="cx"> )
</span><span class="lines">@@ -347,7 +363,9 @@
</span><span class="cx"> proposal = yield check
</span><span class="cx"> yield proposal.whenProposed()
</span><span class="cx">
</span><ins>+ returnValue(qpool)
</ins><span class="cx">
</span><ins>+
</ins><span class="cx"> @inlineCallbacks
</span><span class="cx"> def test_enqueue(self):
</span><span class="cx"> """
</span><span class="lines">@@ -466,7 +484,84 @@
</span><span class="cx"> self.assertTrue(work.a == 2)
</span><span class="cx">
</span><span class="cx">
</span><ins>+ @inlineCallbacks
+ def test_notsingleton(self):
+ """
+ L{PeerConnectionPool.enqueueWork} will insert a job and a work item.
+ """
+ dbpool = buildConnectionPool(self, nodeSchema + jobSchema + schemaText)
</ins><span class="cx">
</span><ins>+ yield self._enqueue(dbpool, 1, 2, cl=DummyWorkItem)
+
+ def allJobs(txn):
+ return DummyWorkItem.all(txn)
+
+ jobs = yield inTransaction(dbpool.connection, allJobs)
+ self.assertTrue(len(jobs) == 1)
+
+ yield self._enqueue(dbpool, 2, 3)
+
+ jobs = yield inTransaction(dbpool.connection, allJobs)
+ self.assertTrue(len(jobs) == 2)
+
+
+ @inlineCallbacks
+ def test_singleton(self):
+ """
+ L{PeerConnectionPool.enqueueWork} will insert a job and a work item.
+ """
+ dbpool = buildConnectionPool(self, nodeSchema + jobSchema + schemaText)
+
+ yield self._enqueue(dbpool, 1, 2, cl=DummyWorkSingletonItem)
+
+ def allJobs(txn):
+ return DummyWorkSingletonItem.all(txn)
+
+ jobs = yield inTransaction(dbpool.connection, allJobs)
+ self.assertTrue(len(jobs) == 1)
+
+ yield self._enqueue(dbpool, 2, 3, cl=DummyWorkSingletonItem)
+
+ jobs = yield inTransaction(dbpool.connection, allJobs)
+ self.assertTrue(len(jobs) == 1)
+
+
+ @inlineCallbacks
+ def test_singleton_reschedule(self):
+ """
+ L{PeerConnectionPool.enqueueWork} will insert a job and a work item.
+ """
+ dbpool = buildConnectionPool(self, nodeSchema + jobSchema + schemaText)
+
+ qpool = yield self._enqueue(dbpool, 1, 2, cl=DummyWorkSingletonItem, notBefore=datetime.datetime(2014, 5, 17, 12, 0, 0))
+
+ @inlineCallbacks
+ def allWork(txn):
+ jobs = yield JobItem.all(txn)
+ work = [((yield job.workItem()), job) for job in jobs]
+ returnValue(filter(lambda x: x[0], work))
+
+ work = yield inTransaction(dbpool.connection, allWork)
+ self.assertTrue(len(work) == 1)
+ self.assertTrue(work[0][1].notBefore == datetime.datetime(2014, 5, 17, 12, 0, 0))
+
+ def _reschedule_force(txn, force):
+ txn._queuer = qpool
+ return DummyWorkSingletonItem.reschedule(txn, 60, force=force)
+ yield inTransaction(dbpool.connection, _reschedule_force, force=False)
+
+ work = yield inTransaction(dbpool.connection, allWork)
+ self.assertTrue(len(work) == 1)
+ self.assertTrue(work[0][1].notBefore == datetime.datetime(2014, 5, 17, 12, 0, 0))
+
+ yield inTransaction(dbpool.connection, _reschedule_force, force=True)
+
+ work = yield inTransaction(dbpool.connection, allWork)
+ self.assertTrue(len(work) == 1)
+ self.assertTrue(work[0][1].notBefore != datetime.datetime(2014, 5, 17, 12, 0, 0))
+
+
+
</ins><span class="cx"> class WorkerConnectionPoolTests(TestCase):
</span><span class="cx"> """
</span><span class="cx"> A L{WorkerConnectionPool} is responsible for managing, in a node's
</span><span class="lines">@@ -627,7 +722,7 @@
</span><span class="cx"> return dummy
</span><span class="cx">
</span><span class="cx"> peer.choosePerformer = chooseDummy
</span><del>- performed = local.performJob(JobDescriptor(7384, 1))
</del><ins>+ performed = local.performJob(JobDescriptor(7384, 1, "ABC"))
</ins><span class="cx"> performResult = []
</span><span class="cx"> performed.addCallback(performResult.append)
</span><span class="cx">
</span><span class="lines">@@ -802,12 +897,12 @@
</span><span class="cx"> worker2, _ignore_trans2 = peer()
</span><span class="cx">
</span><span class="cx"> # Ask the worker to do something.
</span><del>- worker1.performJob(JobDescriptor(1, 1))
</del><ins>+ worker1.performJob(JobDescriptor(1, 1, "ABC"))
</ins><span class="cx"> self.assertEquals(worker1.currentLoad, 1)
</span><span class="cx"> self.assertEquals(worker2.currentLoad, 0)
</span><span class="cx">
</span><span class="cx"> # Now ask the pool to do something
</span><del>- peerPool.workerPool.performJob(JobDescriptor(2, 1))
</del><ins>+ peerPool.workerPool.performJob(JobDescriptor(2, 1, "ABC"))
</ins><span class="cx"> self.assertEquals(worker1.currentLoad, 1)
</span><span class="cx"> self.assertEquals(worker2.currentLoad, 1)
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>