jina.serve.runtimes.gateway.graph.topology_graph module

class jina.serve.runtimes.gateway.graph.topology_graph.TopologyGraph(graph_representation, graph_conditions={}, deployments_disable_reduce=[], timeout_send=1.0, *args, **kwargs)[source]

Bases: object

:class TopologyGraph is a class that describes a computational graph of nodes, where each node represents

a Deployment that needs to be sent requests in the order respecting the path traversal.

Parameters
  • graph_description – A dictionary describing the topology of the Deployments. 2 special nodes are expected, the name start-gateway and end-gateway to determine the nodes that receive the very first request and the ones whose response needs to be sent back to the client. All the nodes with no outgoing nodes will be considered to be hanging, and they will be “flagged” so that the user can ignore their tasks and not await them.

  • conditions – A dictionary describing which Executors have special conditions to be fullfilled by the Documents to be sent to them.

  • reduce – Reduce requests arriving from multiple needed predecessors, True by default

add_routes(request)[source]

Add routes to the DataRequest based on the state of request processing

Parameters

request (DataRequest) – the request to add the routes to

Returns

modified request with added routes

property origin_nodes

The list of origin nodes, the one that depend only on the gateway, so all the subgraphs will be born from them and they will send to their deployments the request as received by the client.

Returns

A list of nodes