a.util : module documentation

Part of asynqueue Source for util.py Project Page for AsynQueue

Miscellaneous useful stuff.

callAfterDeferred is a cool little function that looks for a Deferred as an attribute of some namespace (i.e., object) and does a call after it fires. DeferredTracker lets you to track and wait for deferreds without actually having received a reference to them. DeferredLock lets you shut things down when you get the lock.

CallRunner is used by threads.ThreadWorker and process.ProcessWorker. You probably won't need to use it yourself, unless perhaps you come up with an entirely new kind of interfaces.IWorker implementation.

Function o2p Converts an object into a pickle string or a blank string if an empty container.
Function p2o Converts a pickle string into its represented object, or into the default object you specify if it's a blank string.
Function callAfterDeferred Looks for a Deferred dName as an attribute of namespace and does the f-args-kw call, chaining its call to the Deferred if necessary.
Function killProcess No summary
Function testFunction For testing only.
Class TestStuff For testing only.
Class ProcessProtocol I am a simple protocol for spawning a subordinate process.
Class DeferredTracker I allow you to track and wait for Deferreds without actually having received a reference to them, or interfering with their callback chains.
Class DeferredLock I am a modified form of defer.DeferredLock lock that lets you shut things down when you get the lock.
Class CallRunner I'm used by threads.ThreadLooper and process.ProcessUniverse.
def o2p(obj):

Converts an object into a pickle string or a blank string if an empty container.

def p2o(pickledString, defaultObj=None):

Converts a pickle string into its represented object, or into the default object you specify if it's a blank string.

Note that a reference to the default object itself will be returned, not a copy of it. So make sure you only supply an empty Python primitive, e.g., [].

def callAfterDeferred(namespace, dName, f, *args, **kw):

Looks for a Deferred dName as an attribute of namespace and does the f-args-kw call, chaining its call to the Deferred if necessary.

Note that the original deferred's value is swallowed when it calls the new deferred's callback; the original deferred must be for signalling readiness only and its return value not relied upon.

def killProcess(pid):

Kills the process with the supplied PID, returning a deferred that fires when it's no longer running. The return value is True if the process was alive and had to be killed, False if it was already dead.

def testFunction(x):

For testing only.

API Documentation for AsynQueue, generated by pydoctor at 2018-07-10 19:10:20.