Table Of Contents

Previous topic

Server Transports

Next topic

Miscellanous Spyne Utilities

This Page

Auxiliary Processors

The spyne.auxproc package contains backends to process auxiliary method contexts.

“Auxiliary Methods” are methods that run asyncronously once the primary method returns (either successfully or not). There can be only one primary method for a given method identifier but zero or more auxiliary methods.

To define multiple auxiliary methods for a given main method, you must use separate ServiceBase subclasses that you pass to the spyne.application.Application constructor.

Auxiliary methods are a useful abstraction for a variety of asyncronous execution methods like persistent or non-persistent queueing, async execution in another thread, process or node.

Classes from this package will have the AuxProc suffix, short for “Auxiliary Processor”.

This package is EXPERIMENTAL.


class spyne.auxproc._base.AuxProcBase(process_exceptions=False)[source]

Override this method to make arbitrary initialization of your AuxProc. It’s called once, ‘as late as possible’ into the Application initialization.

initialize_context(ctx, p_ctx, error)[source]

Override this method to alter thow the auxiliary method context is initialized. It’s called every time the method is executed.

process(server, ctx, *args, **kwargs)[source]

The method that does the actual processing. This should be called from the auxiliary context.

process_context(server, ctx, p_ctx, p_error)[source]

Override this to implement your own auxiliary processor.


class spyne.auxproc.sync.SyncAuxProc(process_exceptions=False)[source]

Bases: spyne.auxproc._base.AuxProcBase

SyncAuxProc processes auxiliary methods synchronously. It’s useful for testing purposes.


class spyne.auxproc.thread.ThreadAuxProc(pool_size=1)[source]

Bases: spyne.auxproc._base.AuxProcBase

ThreadAuxProc processes auxiliary methods asynchronously in another thread using the undocumented multiprocessing.pool.ThreadPool class. This is available in Python 2.7. It’s possibly there since 2.6 as well but it’s hard to tell since it’s not documented.

Parameters:pool_size – Max. number of threads that can be used to process methods in auxiliary queue in parallel.