airflow.providers.grpc.operators.grpc

Module Contents

Classes

GrpcOperator

Calls a gRPC endpoint to execute an action

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

Bases: airflow.models.BaseOperator

Calls a gRPC endpoint to execute an action

Parameters
  • stub_class (Callable) – The stub client to use for this gRPC call

  • call_func (str) – The client function name to call the gRPC endpoint

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

  • data (Optional[dict]) – The data to pass to the rpc call

  • interceptors (Optional[List[Callable]]) – A list of gRPC interceptor objects to be used on the channel

  • custom_connection_func (Optional[Callable]) – The customized connection function to return channel object. A callable that accepts the connection as its only arg.

  • streaming (bool) – A flag to indicate if the call is a streaming call

  • response_callback (Optional[Callable]) – The callback function to 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

  • log_response (bool) – A flag to indicate if we need to log the response

template_fields :Sequence[str] = ['stub_class', 'call_func', 'data'][source]
template_fields_renderers[source]
execute(self, context)[source]

This is the main method to derive when creating an operator. Context is the same dictionary used as when rendering jinja templates.

Refer to get_template_context for more context.

Was this entry helpful?