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 entity

      • address (str) – address of the entity

      • port (int) – Port of the entity

      • shard_id (Optional[int]) – Optional id of the shard this entity belongs to

  • property proto: jina_pb2.ControlRequestProto

    Cast self to a jina_pb2.ControlRequestProto. Laziness will be broken and serialization will be recomputed when calling SerializeToString(). :rtype: ControlRequestProto :return: protobuf instance

  • property command: str

    Get the command.

    • Return type

      str