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 (dict | None) – The data to pass to the rpc call

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

  • custom_connection_func (Callable | None) – 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 (Callable | None) – 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(context)[source]

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?