baseplate.context.thrift

class baseplate.context.thrift.ThriftContextFactory(pool, client_cls)

Thrift client pool context factory.

This factory will attach a proxy object with the same interface as your thrift client to an attribute on the context object. When a thrift method is called on this proxy object, it will check out a connection from the connection pool and execute the RPC, automatically recording diagnostic information.

Parameters:

The proxy object has a retrying method which takes the same parameters as RetryPolicy.new and acts as a context manager. The context manager returns another proxy object where Thrift service method calls will be automatically retried with the specified retry policy when transient errors occur:

with context.my_service.retrying(attempts=3) as svc:
    svc.some_method()