What happened?
The serve function accepts a grpcv1.FunctionRunnerService, when it should accept a grpcv1.FunctionRunnerServiceServicer.
|
def serve( |
|
function: grpcv1.FunctionRunnerService, |
|
address: str, |
|
*, |
|
creds: grpc.ServerCredentials, |
|
insecure: bool, |
|
options: Sequence[tuple[str, Any]] | None = None, |
|
) -> None: |
This results in a type mismatch:
Method "RunFunction" overrides class "FunctionRunnerService" in an incompatible manner
Base method is declared as a staticmethod but override is not
Positional parameter count mismatch; base method has 10, but override has 3
...
Similarly, a class that implements a RunFunction(Service) servicer, should really implement grpcv1. FunctionRunnerServiceServicer instead.
|
class BetaFunctionRunner(grpcv1beta1.FunctionRunnerService): |
|
"""A BetaFunctionRunner handles beta gRPC RunFunctionRequests. |
|
|
|
It handles requests by passing them to a wrapped v1.FunctionRunnerService. |
|
Incoming v1beta1 requests are converted to v1 by round-tripping them through |
|
serialization. Outgoing requests are converted from v1 to v1beta1 the same |
|
way. |
|
""" |
|
|
|
def __init__(self, wrapped: grpcv1.FunctionRunnerService): |
|
"""Create a new BetaFunctionRunner.""" |
|
self.wrapped = wrapped |
See gRPC docs for details: https://grpc.io/docs/languages/python/quickstart/#update-the-server
How can we reproduce it?
Look at the signature of respective class and you'll see the mismatch.
What environment did it happen in?
Function version: v0.13.0
What happened?
The
servefunction accepts agrpcv1.FunctionRunnerService, when it should accept agrpcv1.FunctionRunnerServiceServicer.function-sdk-python/crossplane/function/runtime.py
Lines 72 to 79 in ad6f1e1
This results in a type mismatch:
Similarly, a class that implements a RunFunction(Service) servicer, should really implement
grpcv1. FunctionRunnerServiceServicerinstead.function-sdk-python/crossplane/function/runtime.py
Lines 137 to 148 in ad6f1e1
See gRPC docs for details: https://grpc.io/docs/languages/python/quickstart/#update-the-server
How can we reproduce it?
Look at the signature of respective class and you'll see the mismatch.
What environment did it happen in?
Function version: v0.13.0