NYUCCL / psiTurk

An open platform for science on Amazon Mechanical Turk.
https://psiturk.org
MIT License
277 stars 140 forks source link

Add a 'server kill' option in command line tool? #91

Closed annacoenen closed 10 years ago

annacoenen commented 10 years ago

Not sure if it's possible, given that it will often require root access, but I could imagine this would be helpful for people who don't know how to kill a process themselves. I do quite frequently get the yellow 'unknown' server status. Or maybe there's another solution?

jbmartin commented 10 years ago

Does the unknown server status occur after you've issued the server off command in psiTurk, or after closing and relaunching psiTurk without issuing the server off command?

On Tue, Apr 29, 2014 at 10:26 AM, annacoenen notifications@github.comwrote:

Not sure if it's possible, given that it will often require root access, but I could imagine this would be helpful for people who don't know how to kill a process themselves. I do quite frequently get the yellow 'unknown' server status. Or maybe there's another solution?

— Reply to this email directly or view it on GitHubhttps://github.com/NYUCCL/psiTurk/issues/91 .

annacoenen commented 10 years ago

All of those :) I've had it happen under varying circumstances, mainly due to bad behavior on my side (e.g. leaving server on while putting computer to sleep, then waking it up, or killing psiturk rather than exiting it nicely), but I'm sure others might do things like that too, occasionally.

gureckis commented 10 years ago

i also have had the server dying on me lately but i haven't completely investigated why...

jbmartin commented 10 years ago

Unless things have changed, server off already issues a kill call to the underlying gunicorn pid. The only difference is that it does so with kids gloves on to prevent killing a potentially non psiTurk process (e.g. 'unknown' ). The question then is if it's okay to remove the kids gloves? With enough warnings, maybe...

jbmartin commented 10 years ago

Any thoughts on this issue, or can we close it?

gureckis commented 10 years ago

Can't we provide a command similar to 'pkill -f psiturk' (which is what i use this situation)? maybe there's a way to make the command line have a different process name than the server to facilitate that? i.e., 'pkill -f psiturk-server'

jbmartin commented 10 years ago

Yup. From Gunicorn's readthedocs:

If you install the Python package setproctitle Gunicorn will set the process names to something a bit more meaningful. This will affect the output you see in tools like ps and top. This helps for distinguishing the master process as well as between masters when running more than one app on a single machine. See the proc_name setting for more information.

gureckis commented 10 years ago

cool, so ideally we actually might like it if the server assumed a name related to the current experiment and user account perhaps... that way a kill request won't take down another user's server in a multi-user environment.

jbmartin commented 10 years ago

I added a bunch of safeguards to dev that should prevent orphaned gunicorn processes from occurring. Let me know if this is still a problem.