This application is my solution to a little coding exercise I did for a job interview in March, 2015.
-- Tyler Perkins
Create an HTTP service for tracking progress of background jobs. You can use whatever language or technology you prefer.
The job is represented by:
id
- unique job’s identifiertotal
- a number representing total size of the jobprogress
- a number representing current progress of the job (ie. job is considered completed when progress == total)
The service interface should support the following actions:
- Register a job - should accept
total
attribute, generate and return an ID for the job. - Update a job based on ID - should allow to increment job's
progress
by some arbitrary number or set absoluteprogress
- returns the newprogress
- Show all jobs
- Show individual job by ID
Jobs should also expire after they have not been updated for 1 minute (ie. they would no longer appear in Show all jobs, and would not be returned when showing that job by ID).
The job state can be stored in memory (ie. doesn’t have to be persistent) or some external storage engine.
You will need Leiningen 2.0.0 or above installed.
To start a web server for the application, run:
lein ring server
A browser window should pop up, showing http://localhost:3000/, which shows example URLs you can try.
Copyright © 2015, Tyler Perkins