On 22-11-2013 09:57:07 -0500, Christopher Nelson wrote:
Hi,
I am writing some automation to control monetdbd programmatically from Python. While the rest of the monetdbd commands work fine, the command:
monetdbd start <farm>
never returns control to Python. I have tried this on both CPython 2.7 and PyPy 2.0.4.
The process forks a child and then lets the parent exit. If you don't want this "detach" behaviour you can use the -n flag. Using that flag monetdbd will not fork, and hence stay there for your process to monitor it, until you decide to send it a signal to stop.
cnelson@hpvm:~/workspace/cql-db-py/cql $ ps a PID TTY STAT TIME COMMAND 31608 pts/3 S 0:00 python store.py 31613 pts/3 Z 0:00 [monetdbd] <defunct>
You can see that the process appears to have finished, but never returns control to Python. If I run the 'stop' command from the prompt, everything clears up and finishes:
Perhaps the detach code is doing something wrong. IIRC it creates a session/group, but on the other hand, I don't know what your python code is doing, and what exactly it expects.
The error here occurs because the next thing that the script will try to do is 'stop' the monetdbd instance. Which of course I already did by hand. The point is that once I stop the monetdbd instance OOB, the original monetdbd where 'start' was called finally does return control to Python. Which indicates that it is probably not a Python problem.
Yeah, as I wrote above, which could be because the detach code isn't correct, but I've got no immediate ideas on what, if so. Fabian