Review job submission and retry behavior for production use
Quick Overview
Review a job API with submit and retry operations for production readiness. Work through duplicate requests, durable acceptance, job state transitions, concurrent workers, and failures with uncertain outcomes.
Review job submission and retry behavior for production use
Company: Apple
Role: Software Engineer
Category: Software Engineering Fundamentals
Difficulty: hard
Interview Round: Onsite
A job API exposes `submit` and `retry` operations. Review what these operations need to do before the API is suitable for production, and propose concrete changes to their behavior and implementation.
The original implementation is not available. Do not assume a particular defect exists in it. Treat this as a design-review exercise: identify the semantics you need to establish, describe failure cases, and work through an implementation that addresses them.
### Clarifying Questions
- Does `submit` execute the job synchronously or acknowledge work that will run later?
- Does `retry` resubmit an existing job, repeat a failed attempt, or retry the client's API request?
- Can a job produce external side effects, and can those effects be made idempotent?
- Which failure states are eligible for retry, and who is allowed to submit or retry a job?
### Part 1: Review retry behavior
Describe how you would inspect and improve `retry`, including repeated calls, concurrent attempts, and failures whose outcome is uncertain.
```hint Locate the uncertainty
A timeout can occur after work succeeds. Trace what a second attempt could repeat in that case.
```
#### What This Part Should Cover
- Retry eligibility and job-attempt state transitions
- Duplicate calls, concurrency, and repeated external effects
- Retry limits, delay policy, and visibility into failures
### Part 2: Review submission behavior
Describe how you would inspect and improve `submit`, including validation, acceptance, and reliable handoff to execution.
```hint Follow an accepted job
Trace the path from the client's request through persistence and execution. Consider a crash between each pair of steps.
```
#### What This Part Should Cover
- Input validation and caller authorization
- The meaning of a successful submission response
- Durable job creation, duplicate submissions, and execution handoff
### What a Strong Answer Covers
- Consistent semantics across submission, retries, and job status
- Concrete failure scenarios tied to proposed implementation changes
- Tests and operational signals that reveal lost or duplicated work
### Follow-up Questions
- How would you prevent two workers from executing a retried job concurrently?
- What should the API return if the client times out after the job has been accepted?
- How would your design change for a job whose external side effect cannot be deduplicated?
Overview: Review a job API with submit and retry operations for production readiness. Work through duplicate requests, durable acceptance, job state transitions, concurrent workers, and failures with uncertain outcomes.
A job API exposes submit and retry operations. Review what these operations need to do before the API is suitable for production, and propose concrete changes to their behavior and implementation.
The original implementation is not available. Do not assume a particular defect exists in it. Treat this as a design-review exercise: identify the semantics you need to establish, describe failure cases, and work through an implementation that addresses them.
Clarifying Questions Guidance
Does
submit
execute the job synchronously or acknowledge work that will run later?
Does
retry
resubmit an existing job, repeat a failed attempt, or retry the client's API request?
Can a job produce external side effects, and can those effects be made idempotent?
Which failure states are eligible for retry, and who is allowed to submit or retry a job?
Part 1: Review retry behavior
Describe how you would inspect and improve retry, including repeated calls, concurrent attempts, and failures whose outcome is uncertain.
What This Part Should Cover Guidance
Retry eligibility and job-attempt state transitions
Duplicate calls, concurrency, and repeated external effects
Retry limits, delay policy, and visibility into failures
Part 2: Review submission behavior
Describe how you would inspect and improve submit, including validation, acceptance, and reliable handoff to execution.
What This Part Should Cover Guidance
Input validation and caller authorization
The meaning of a successful submission response
Durable job creation, duplicate submissions, and execution handoff
What a Strong Answer Covers Guidance
Consistent semantics across submission, retries, and job status
Concrete failure scenarios tied to proposed implementation changes
Tests and operational signals that reveal lost or duplicated work
Follow-up Questions Guidance
How would you prevent two workers from executing a retried job concurrently?
What should the API return if the client times out after the job has been accepted?
How would your design change for a job whose external side effect cannot be deduplicated?