jina.serve.stream.helper module

class jina.serve.stream.helper.AsyncRequestsIterator(iterator)[source]

Bases: object

Iterator to allow async iteration of blocking/non-blocking iterator from the Client

Async request iterator TODO (Deepankar): accept num_req

  • Parameters

    iterator (Union[Iterator, AsyncIterator]) – request iterator

  • iterator__next__()[source]

    Executed inside a ThreadPoolExecutor via loop.run_in_executor to avoid following exception. “StopIteration interacts badly with generators and cannot be raised into a Future”

    • Returns

      next request or None