doc.go 1.4 KB

12345678910111213141516171819202122232425262728
  1. /*
  2. === Porter Worker Pool and Job Queue System ===
  3. This software is intended to be deployed alongside the main Porter server and dashboard and act as a background
  4. worker pool for certain jobs that the Porter server should be running as separate processes / goroutines periodically
  5. or at-will, depending on the task at hand.
  6. TERMINOLOGIES
  7. - The terms `worker pool`, `pool`, `Go application` are interchangably used to denote this application.
  8. - Jobs should have their unique string identifiers, denoted as IDs for short.
  9. ARCHITECTURE
  10. - The worker pool is a Go application that takes in environment variables `MAX_WORKERS` and `MAX_QUEUE` to
  11. denote the maximum number of workers and maximum number of jobs in the queue, respectively.
  12. - The worker pool has specific jobs that it can execute, written separately with their own logic flow.
  13. - The individual jobs need to have a unique string identifier.
  14. - The jobs should be registered at startup time with their respective unique identifiers for the worker pool
  15. to correctly relay execution information to the correct job.
  16. - The worker pool has an exposed HTTP POST endpoint to enqueue jobs with their IDs. Depending on the kind of job,
  17. a job can expect to receive a body of JSON data in the HTTP request.
  18. - By exposing an HTTP endpoint, the worker pool can be called to enqueue jobs using crontab and other sources.
  19. */
  20. package main