Skip to main content

Source Collector

Challenge on lesson: Checkpoint: Concurrent Data Collector

Implement sync collect(sources) where sources is a list of dicts: {'name': str, 'delay': float, 'fail': bool(optional)}. Each source simulates a fetch: async job awaiting delay then raising RuntimeError(name) if fail else returning (name, 'data'). Run ALL concurrently with a per-source timeout of 0.5s (asyncio.wait_for). Return a dict with keys 'ok' (list of names that returned data, in input order) and 'failed' (sorted list of names that raised or timed out).

Difficulty: intermediate

Back to lesson: Checkpoint: Concurrent Data Collector