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

class jina.serve.runtimes.gateway.graph.topology_graph.TopologyGraph(graph_representation, graph_conditions={}, deployments_metadata={}, deployments_no_reduce=[], timeout_send=1.0, retries=-1, logger=None, *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.

  • 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 floating, 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 to the DataRequest based on the state of request processing


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


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.


A list of nodes

property all_nodes#

The set of all the nodes inside this Graph


A list of nodes


Collect all the results from every node into a single dictionary so that gateway can collect them


A dictionary of the results