buildgrid.server.decorators.metadata module
- buildgrid.server.decorators.metadata.metadatacontext(f: Func) Func
Helper function to obtain metadata and set request metadata ContextVar, and then reset it on completion of method.
Note
args[2] of the method must be of type grpc.ServicerContext
This returns a decorator that extracts the invocation_metadata from the context argument and sets the ContextVar variable with it. Resetting the ContextVar variable after the method has completed.