Re: Programmatically shutting down Pylons server
On Apr 30, 2010, at 7:12 AM, Alec Munro wrote: Ok, the problem seems to be that fact that the file being run is a batch file. I printed out the resulting java call, and used that instead, and it works. However, now I need to modify my script to handle some of what jython.bat does. Ah well. It's probably just an oddity of Windows, maybe it kills the bat process but the child process is unaffected. The bat file runs java via: cmd.exe /c exit /b java. Maybe there's another way to invoke it that would work better? Eventually the Jython .bat file launcher will be replaced with a native .exe launcher -- if not by Jython 2.5.2 then likely the next release. That should solve this issue among other things: http://bugs.jython.org/issue1491 -- Philip Jenvey -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Programmatically shutting down Pylons server
On Apr 24, 6:13 pm, Philip Jenvey pjen...@underboss.org wrote: On Apr 22, 2010, at 12:36 AM, Alec Munro wrote: Hi List, I have a Java class that I need to access from Python, and my solution for the time being is to wrap it in a Jython web service, using Pylons. I'm using subprocess.Popen to start this server, but I need a good way to stop it. Using any of the kill functionality from subprocess or the win32 modules always leaves me with dangling processes. I'm hoping that I can simply expose a web service call that will shutdown Pylons. However, short of sys.exit(), I haven't been able to find anything, and I'm not even sure if that will work. Do you mean you're running a Pylons web service in Jython, and having another Python process start it up via subprocess? Exactly If so I'm not sure why sending the subprocess a kill/terminate signal would cause it to dangle, it could depend on what the parent process is doing. You may need to pass close_fds=True to Popen. Can you kill it normally when it's ran outside of your other process? If I run the same command from the command line, and issue a CTRL-c, then it does kill it. The command is: C:\jython2.5.1\jython.bat C:\jython2.5.1\bin\paster serve development.ini I'm wondering if it could be a problem because it's a batch file? A web service call to shutdown Pylons via sys.exit could work, but I'd want to know why the process was dangling when killed. It may even zombie after calling sys.exit() on itself due to the same issue. Unfortunately, this doesn't seem to do it either. :( -- Philip Jenvey -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/pylons-discuss?hl=en. Thanks, and if anyone has any more ideas, I'm happy to hear them. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Programmatically shutting down Pylons server
Ok, the problem seems to be that fact that the file being run is a batch file. I printed out the resulting java call, and used that instead, and it works. However, now I need to modify my script to handle some of what jython.bat does. Ah well. -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Re: Programmatically shutting down Pylons server
On Apr 22, 2010, at 12:36 AM, Alec Munro wrote: Hi List, I have a Java class that I need to access from Python, and my solution for the time being is to wrap it in a Jython web service, using Pylons. I'm using subprocess.Popen to start this server, but I need a good way to stop it. Using any of the kill functionality from subprocess or the win32 modules always leaves me with dangling processes. I'm hoping that I can simply expose a web service call that will shutdown Pylons. However, short of sys.exit(), I haven't been able to find anything, and I'm not even sure if that will work. Do you mean you're running a Pylons web service in Jython, and having another Python process start it up via subprocess? If so I'm not sure why sending the subprocess a kill/terminate signal would cause it to dangle, it could depend on what the parent process is doing. You may need to pass close_fds=True to Popen. Can you kill it normally when it's ran outside of your other process? A web service call to shutdown Pylons via sys.exit could work, but I'd want to know why the process was dangling when killed. It may even zombie after calling sys.exit() on itself due to the same issue. -- Philip Jenvey -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.
Programmatically shutting down Pylons server
Hi List, I have a Java class that I need to access from Python, and my solution for the time being is to wrap it in a Jython web service, using Pylons. I'm using subprocess.Popen to start this server, but I need a good way to stop it. Using any of the kill functionality from subprocess or the win32 modules always leaves me with dangling processes. I'm hoping that I can simply expose a web service call that will shutdown Pylons. However, short of sys.exit(), I haven't been able to find anything, and I'm not even sure if that will work. Any ideas? Thanks, Alec -- You received this message because you are subscribed to the Google Groups pylons-discuss group. To post to this group, send email to pylons-disc...@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.