Interview practice question
Same job running twice at once
Data Engineering · Python · Experienced
Sometimes a scheduled Python job starts while the previous run is still going, and both write to the same table, causing duplicates. How do you prevent it?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- Overlapping runs of non-idempotent jobs corrupt data.
- Configure the scheduler to prevent overlap, like max_active_runs = 1.
- Add a lock: a database advisory lock, DynamoDB conditional write or a lock row.
- Make the job idempotent anyway.
- Alert when a run takes longer than its schedule interval.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.