One of our open source projects is Package pm, which we’re using at VividCortex to inspect and manage API-sever programs. Package pm replaces an internal-only project, and we are happy to share it with the open source community.
Package pm is a process manager with an HTTP monitoring/control interface. In pm, processes are user-defined routines within a running program; this is ideal for server programs, as clients can generate specific requests for action. Meanwhile, the library keeps track of all the tasks and makes the information available through HTTP. A client can also cancel a particular task. Since there is no statement in Go to kill a routine, cancellations are implemented as panics.
Using pm starts by opening a server port to handle requests for task information through HTTP. You can do it like this (although you probably want to add error checking/handling code):
go pm.ListenAndServe (“:0081)
Then, to track a task, you need to declare it with
Start() with a process identifier and, optionally, a set of attributes.
Then, you could do something like this:
curl http://localhost:8081/procs/ curl http://localhost:8081/procs/<id>/history
In return, you will get JSON responses including the set of processess currently running and the full history for your chosen id.
To mark a task as finished, you will need a deferred
Done() call, which must be called whether or not the task succeeded.
Each task can change its status as often as required with a
As pm is in beta, it will be changing rapidly. Feel free to make suggestions, and we welcome your pull requests. In the meantime, our issues list can tell you what we have in the works for pm.