jina.types.request.control module
class jina.types.request.control.ControlRequest(command=None, request=None)[source]
Bases: jina.types.request.Request
ControlRequest is one of the primitive data type in Jina.
It offers a Pythonic interface to allow users access and manipulate jina.jina_pb2.ControlRequestProto
object without working with Protobuf itself.
A container for serialized jina_pb2.ControlRequestProto
that only triggers deserialization and decompression when receives the first read access to its member.
It overrides __getattr__()
to provide the same get/set interface as an jina_pb2.ControlRequestProtoProto
object.
Parameters
command – the command for this request, can be STATUS, ACTIVATE or DEACTIVATE
request – The request.
add_related_entity(id, address, port, shard_id=None)[source]
Add a related entity to this ControlMessage
Parameters
id (
str
) – jina id of the entityaddress (
str
) – address of the entityport (
int
) – Port of the entityshard_id (
Optional
[int
]) – Optional id of the shard this entity belongs to
property proto: jina_pb2.ControlRequestProto
Cast
self
to ajina_pb2.ControlRequestProto
. Laziness will be broken and serialization will be recomputed when callingSerializeToString()
. :rtype:ControlRequestProto
:return: protobuf instanceproperty command: str
Get the command.
Return type
str