mantiumai / chirps

Discover sensitive/confidential information stored in a vector database
GNU General Public License v3.0
57 stars 6 forks source link

periodic task framework & worker status enhancement #189

Closed zimventures closed 1 year ago

zimventures commented 1 year ago

This PR adds support for execution of periodic tasks within Chirps. Celery Beat is the technology being used in order to perform the task execution.

Worker Health check

The new periodic task execution is being used in order to perform health checks on Celery workers. Each time a health check is run, it will create CeleryWorker entries in the database. The updated worker status view will then look to see if any of the workers haven't been reached in the last couple of minutes. If they are, the indicator will go red. When the workers are available again, the indicator will go green.

This is in juxtaposition to the previous logic that simply performed the health check directly in the call to /worker/status, which would hang while the check was being performed.

Other items

Hit some VERY weird bug whereby the /worker/status/ view was hanging for 5+ seconds before being executed and finally returning. Simply changing its name to stats seems to have fixed it.

Removed some commented-out template code.

Next Steps...

The current logic does not handle when workers simply go away (they aren't ever coming back). In that case, the database entries will not go away and will always cause the health check to fail. In order to support this, a new worker management view should be presented to allow the user to manage the workers.

Closes out #182