Project: bounded jobs with replay validation and selective retries
A reliable job runner needs more than gather and a retry loop. It must bound task creation, reject conflicting duplicate jobs before causing effects, retry only the declared transient error class and clean up siblings when one job fails permanently.
This project uses a real asynchronous worker pool over a finite batch. Identical keys share one logical execution within that batch, while cross-process durability remains outside the contract. The review should explain cancellation, whether retried calls are idempotent and how accepted work is recovered after a process crash. Returning a partial dictionary must not be mistaken for a fully successful batch.
import asyncio
async def attempt():
await asyncio.sleep(0)
return 7
async def main():
async with asyncio.TaskGroup() as g:
task=g.create_task(attempt())
print(task.result())
asyncio.run(main())Review the design
The project proves finite-batch coordination and failure propagation. Durability, jittered backoff, deadlines and externally idempotent effects are required design extensions, not guarantees supplied by an in-memory dictionary.
Your task
Implement async run_jobs(jobs,call,workers,retries). jobs=(key,payload), duplicate identical keys execute once; conflicting payloads raise ValueError before any call. Use at most workers worker tasks and preserve first-key result order. Retry OSError up to retries additional attempts, propagating other errors via TaskGroup. No sleeping backoff in this local project. Require workers>=1 and retries>=0.
The explanation opens here once every check passes.