Issue:
Implement data cleaning mechanism to remove stale entries from AppPending table and S3 bucket
Solution:
To delete the stale entries from the AppPending table and the jar from the S3 bucket implemented a scheduler which will run every midnight and delete the entries from the AppPending table for the entries with submitter_approval="False".
Use below website to get the cronstring of the job if required to be changed it in future:
https://crontab.guru/#0_0_*_*_*
Files changed:
Code changes are present in branch https://bitbucket.org/rpatil14/appstore_riddhi/branch/IGBF-2087#diff
python_packages.txt
submit_app/app_pending_cleanup.py
submit_app/apps.py
Testing steps:
Scenario 1:
1) Click on submit your app
2) Select an app to submit from "Choose File" option or Enter URL
3) Go back to the home page or click browser back button without submitting the app
4) Entry will be created in the AppPending table with submitter_approved value as "False" and the jar file will be uploaded to the s3 bucket
Expected output: Once the scheduler run at midnight this entry will be deleted from the AppPending table and the jar file will be deleted from the s3 bucket
Scenario 2:
1) Click on submit your app
2) Select an app to submit from "Choose File" option or Enter URL
3) Go back to the home page or click browser back button without submitting the app
4) Repeat step 1-2 for the same app with same version and this time submit the app by clicking "It's all good. Submit my app" button
5) Two entries should be created in the AppPending table with one entry submitter_approved value as "False" and other submitter_approved value as "True". Only one jar should be uploaded to the s3 bucket with the latest submission timestamp
Expected output: Once the scheduler run at midnight entry submitter_approved value as "False" will be deleted from the AppPending table and the jar file will not be deleted from the s3 bucket
Testing results:
Code changes are deployed to https://dev-appstore-6.bioviz.org. Admin username and password for devappstore6 is same as devappstore2
Note:
Run command "pip install -r python_packages.txt" to install new package "apscheduler" required for this task
cc.[~aloraine]
Make sure to update python_packages.txt with any new modules required. See commits for how to use pip freeze to make sure all dependencies are listed.