A bit new to Python, not sure if this question is too naive. Trying to grasp the concurrency model.
Third party function (from the library) connects to multiple hosts through ssh and perform some bash command. This function returns AsyncGenerator.
Then my code iterates through this AsyncGenerator using async for:
# some code before
asyncgenerator_var = # ...
async for (host, exit_code, stdout, stderr) in asyncgenerator_var:
if exit_code != 0:
self.err(f"[{host}]: {''.join(decode_strings(stderr))}")
continue
self.out(f"[{host}]: {''.join(decode_strings(stdout))}")
self.err(f"[{host}]: {''.join(decode_strings(stderr))}")
# some code after
And then code calls await on this function. But if runs one after another. Not concurrently.
Code someone explain why is that? And what should be done to make it run concurrently.