def _cleanUpPool(self):
     """
     Close the connection currently associated with this task.
     """
     d = getConnection(self._connectionString)
     d.addCallback(lambda conn: conn._autoclose.reset(3))
     d.addErrback(lambda conn: None)
     return d
 def _cleanUpPool(self):
     """
     Close the connection currently associated with this task.
     """
     d = getConnection(self._connectionString)
     d.addCallback(lambda conn: conn._autoclose.reset(3))
     d.addErrback(lambda conn: None)
     return d
    def doTask(self):
        """
        Contact to one device and return a deferred which gathers data from
        the device.

        @return: Deferred actions to run against a device configuration
        @rtype: Twisted deferred object
        """
        # Zenoss 2 ZenCollector scheduler doesn't delete task.LoopingCall after
        # tasks cleanup.
        if self._lastErrorMsg == "Task cleaned":
            return
        # See if we need to connect first before doing any collection
        d = getConnection(self._connectionString)
        d.addCallback(self._fetchPerf)
        d.addErrback(self._failure)

        # Call _finished for both success and error scenarios
        d.addBoth(self._finished)

        # Wait until the Deferred actually completes
        return d
    def doTask(self):
        """
        Contact to one device and return a deferred which gathers data from
        the device.

        @return: Deferred actions to run against a device configuration
        @rtype: Twisted deferred object
        """
        # Zenoss 2 ZenCollector scheduler doesn't delete task.LoopingCall after
        # tasks cleanup.
        if self._lastErrorMsg == 'Task cleaned':
            return
        # See if we need to connect first before doing any collection
        d = getConnection(self._connectionString)
        d.addCallback(self._fetchPerf)
        d.addErrback(self._failure)

        # Call _finished for both success and error scenarios
        d.addBoth(self._finished)

        # Wait until the Deferred actually completes
        return d