Python gRPC server module#

Python implementation of the gRPC API Eigen example server.

class ansys.eigen.python.grpc.server.GRPCDemoServicer[source]#

Bases: GRPCDemoServicer

Provides methods that implement functionality of the API Eigen Example server.

AddMatrices(request_iterator, context)[source]#

Add matrices.

Parameters:
request_iteratoriterator

Iterator to the stream of matrix messages provided.

contextgrpc.ServicerContext

gRPC-specific information.

Returns:
grpcdemo_pb2.Matrix

Matrix message.

AddVectors(request_iterator, context)[source]#

Add vectors.

Parameters:
request_iteratoriterator

Iterator to the stream of vector messages provided.

contextgrpc.ServicerContext

gRPC-specific information.

Returns:
grpcdemo_pb2.Vector

Vector message.

FlipVector(request_iterator, context)[source]#

Flip a given vector.

Parameters:
request_iteratoriterator

Iterator to the stream of vector messages provided.

contextgrpc.ServicerContext

gRPC-specific information.

Returns:
grpcdemo_pb2.Vector

Flipped vector message.

MultiplyMatrices(request_iterator, context)[source]#

Multiply two matrices.

Parameters:
request_iteratoriterator

Iterator to the stream of Matrix messages provided.

contextgrpc.ServicerContext

gRPC-specific information.

Returns:
grpcdemo_pb2.Matrix

Matrix message.

MultiplyVectors(request_iterator, context)[source]#

Multiply two vectors.

Parameters:
request_iteratoriterator

Iterator to the stream of vector messages provided.

contextgrpc.ServicerContext

gRPC-specific information.

Returns:
grpcdemo_pb2.Vector

Vector message.

SayHello(request, context)[source]#

Test the greeter method to see if the server is up and running correctly.

Parameters:
requestHelloRequest

Greeting request sent by the client.

contextgrpc.ServicerContext

gRPC-specific information.

Returns:
grpcdemo_pb2.HelloReply

Reply to greeting by the server.

ansys.eigen.python.grpc.server.check_data_type(dtype, new_dtype)[source]#

Check if the new data type is the same as the previous data type.

Parameters:
dtypenumpy.type

Type of the numpy array before processing.

new_dtypenumpy.type

Type of the numpy array to be processed.

Returns:
numpy.type

Type of the numpy array.

Raises:
RuntimeError

In case there is already a type and it does not match that of the new_type argument.

ansys.eigen.python.grpc.server.check_size(size, new_size)[source]#

Check if the new parsed size is the same as the previous size.

Parameters:
sizetuple

Size of the numpy array before processing.

new_size_type_

Size of the numpy array to process.

Returns:
tuple

Size of the numpy array.

Raises:
RuntimeError

In case there is already a size and it does not match that of the new_size argument.

ansys.eigen.python.grpc.server.serve()[source]#

Deploy the API Eigen Example server.