- Generate report for top50 songs listened per day in respective country
- Generate report for top50 songs listened by user per day
- Logger has been implemented, any exception will be logged in
app.log
file - Test cases has been added for all functions
- Application continues even if the log file for specific date doesn't exist however application logs in
app.log
for further tracing.
- Install used packages as
pip install -r requirements.txt
- Run Application
python run.py -t "user_top_50" ## to generate user's top 50 songs
python run.py -t "country_top_50_song" ## to generate country top 50 songs
pytest
Input file is expected to be as inside directory data/input/
Output will be generated inside directory data/output
as
Feature | Number of Records | Multiprocessing | Multithreading | Tested Machine | |
---|---|---|---|---|---|
1 | country wise top 50 songs | 1999998 | ~8 Sec | ~34 Sec | MacBook Pro Processor 2.2GHz Quad-Core Intel Core i7 Memory 16GM 1600 MHz DDR3 |
2 | user wise top 50 songs | 1999998 | ~9 Sec | ~34 Sec | MacBook Pro Processor 2.2GHz Quad-Core Intel Core i7 Memory 16GM 1600 MHz DDR3 |
- Counting of the country and user's top 50 songs can be done in single pass which will take less time in comparison with doing individually. However, I have treated as individual feature.
- If this functionality needs to be accessed from any user interface, then it needs to be handled in background jobs by means of celery, redis etc..