airflow.providers.grpc.operators.grpc

Module Contents

class airflow.providers.grpc.operators.grpc.GrpcOperator(*, stub_class: Callable, call_func: str, grpc_conn_id: str = 'grpc_default', data: Optional[dict] = None, interceptors: Optional[List[Callable]] = None, custom_connection_func: Optional[Callable] = None, streaming: bool = False, response_callback: Optional[Callable] = None, log_response: bool = False, **kwargs)[source]

Bases: airflow.models.BaseOperator

Calls a gRPC endpoint to execute an action

Parameters
  • stub_class (gRPC stub class generated from proto file) -- The stub client to use for this gRPC call

  • call_func (gRPC client function name for the endpoint generated from proto file, str) -- The client function name to call the gRPC endpoint

  • grpc_conn_id (str) -- The connection to run the operator against

  • data (A dict with key value pairs as kwargs of the call_func) -- The data to pass to the rpc call

  • interceptors (A list of gRPC interceptor objects, has to be initialized) -- A list of gRPC interceptor objects to be used on the channel

  • custom_connection_func (A python function that returns channel object, take in a connection object, can be a partial function) -- The customized connection function to return channel object

  • streaming (boolean) -- A flag to indicate if the call is a streaming call

  • response_callback (A python function that process the response from gRPC call, takes in response object and context object, context object can be used to perform push xcom or other after task actions) -- The callback function to process the response from gRPC call

  • log_response (boolean) -- A flag to indicate if we need to log the response

template_fields = ['stub_class', 'call_func', 'data'][source]
_get_grpc_hook(self)[source]
execute(self, context: Dict)[source]
_handle_response(self, response: Any, context: Dict)[source]

Was this entry helpful?