All jobs / Automation developer
Automation developer interview question · 3–5 years
Three independent API calls run one after another in an async function. How do you overlap them?
The strongest answer
await asyncio.gather(a(), b(), c()) so all three are in flight at once — and decide what return_exceptions should do, because by default the first failure propagates
Why it works
Exactly, and the exception policy is the part usually left unconsidered.
What a good answer covers
- gather runs awaitables concurrently.
- Sequential awaits are sequential.
- return_exceptions decides fail-fast or collect.
- TaskGroup gives structured cancellation.
Answers that fall short
- Close, but not the strongest: Call them without await and they run in parallel automatically
A coroutine that is never awaited simply never runs. - Weak: Wrap each in its own thread
Threads are unnecessary when the calls are already async. - Red flag: Nothing — await always runs concurrently
await means wait; sequential awaits are sequential.
Who gets asked this
- Backend developer
- Full-stack developer
- Automation developer
- DevOps / SRE / cloud
- Data analyst / BI
- Data engineer
- Data science / ML / AI
- AI engineer
More Automation developer questions
- How do you compose several transformation stages over a huge stream without buffering?
- A Python service does heavy numeric work per request and latency is unacceptable. What options do you weigh?
- Under load your async service exhausts database connections. What went wrong?
- What is a decorator, really?
- You need setup and guaranteed teardown around a block. What do you write?
- Can you rely on a dict keeping insertion order?
- One synchronous database call inside an async handler makes the whole service slow. Why?