Probing running python process for information

时间:2016-04-21 22:07:03

标签: python linux python-3.x

I've created a python (and C, but the "controlling" part is Python) program for carrying out Bayesian inversion using Markov chain Monte Carlo methods. Unfortunately, McMC can take several days to run. Part of my research is in reducing the time, but we can only reduce so much.

I'm running it on a headless Centos 7 machine using nohup since maintaining a connection and receiving prints for several days is not practical. However, I would like to be able to check in on my program occasionally to see how many iterations it's done, how many proposals have been accepted, whether it's out of burn-in, etc.

Is there something I can use to interact with the python process to get this info?

1 个答案:

答案 0 :(得分:2)

我建议SAWs(科学应用Web服务器)。它在您的进程中创建一个线程来处理HTTP请求。感兴趣的变量以JSON格式返回给客户端。

对于python运行时管理的变量,将它们写入硬盘(或任何共享内存)上的(JSON)文件,并使用SimpleHTTPServer来提供它。只要您遵循SAW的JSON格式,仍然可以使用客户端的SAW Web界面。