-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup DB and Add Pagination to Conform to OGC Specs #39
Conversation
I see there is mutex lock/unlock going on and have some questions:
|
@mxkpp I will make this an issue to research later. |
@ar-siddiqui was this resolved, or an issue opened to track? EDIT: nvm I just made this one, please lmk if it is duplicated. |
This PR makes changes to the app that were required to comply with the pagination requirements of OGC specs: '/req/job-list/limit-definition
and
/req/core/pl-limit-definition`. The solution implemented also overcame the shortcoming of the cache (as discussed in the paper).The following enhancements have been implemented:
/jobs
andprocesses
routes now supportoffset
andlimit
parameters and include links to previous and next pages. This was a requirement of OGC Specs.Add GitHub Actions like symbols to job statuses
Update HTML pages to be sync with recent code changes
Update tests to reduce testing time from ~5 min to ~4 min
Make echo logs colorful to easily identify requests that were failed or bad
Use of SQLite database in place of snapshots to persist job records.
Get rid of the
JobsCache
hashmap and introduce theActiveJobs
hashmap.ActiveJobs
keep a record of currently active jobs. As soon as a job reaches a terminated state (SUCCESSFUL, FAILED, DISMISSED). The job is being removed from theActiveJobs
and status, logs, etc are updated in the database.Introduce a
hit and miss
strategy in handlers. A job id is first checked inActiveJobs
, if it is there (hit) then return a response immediately without checking the database, else if job is not inActiveJobs
(miss) then look in the database. This is similar to the cache hit-and-miss concept.System design before and after:
Benefits achieved with this PR:
Use of the database allows easy pagination, before we were using hashmap to store jobs which has no particular order.
SQLite is a file-based database and will be in sync with the system all the time. Hence it solves the issue of losing data if the server crashes in between snapshots without adding the complexity of standing up a new database server.
SQLite file can be viewed and updated by software such as DBeaver previously the only way to look at jobs was through API, providing no control over raw data.
JobsCache
was never a cache, to begin with, it was serving as a data store.No need to calculate and track the size of jobs in memory as only active jobs are stored in memory. The remaining jobs are in the database (disk).
Fix #37 Fix #27 Fix #18