-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wooey and while True #198
Comments
Does your script have a blind |
It actually doesn't have any blind try/except clauses |
Can you provide the script? I just tested and celery successfully terminated:
This is the script I tested with:
|
import sys
import time
import argparse
import logging
import requests # pip install requests
logging.basicConfig(level=logging.INFO)
parser = argparse.ArgumentParser()
parser.add_argument('--m', type=int)
args = parser.parse_args()
def main():
print('Hello')
logging.info('start')
while True:
print('Hello True')
logging.info('i am still running')
requests.get('http://127.0.0.1:8000')
time.sleep(10)
if __name__ == "__main__":
sys.exit(main()) And it sends requests even after clicking Stop button. How I run celery: #!/bin/sh
cd /opt
source venv/bin/activate
cd DO_wooey
python manage.py celery worker -c 5 --beat -l info |
Sorry it's taken me a bit to get to this. I just tried your script and the
I would look at your installed dependencies. |
What version of python are you using and can you provide the output of |
I think I know the reason -- the default broker is To fix this, you need to define a "real" broker like rabbit in your user_settings ( |
No, I use real broker. |
Ok, to debug this I'll need a step by step to reproduce on my end from a clean setup. |
I inspected Wooey's source code and found that jobs' processes are killed by SIGKILL -9. There is no way to block or to try to catch the signal. |
This is tricky. The stop behavior in celery is this:
There seems to be no good way to stop a stuck process that doesn't either nuke the entire worker or risk not actually working (a process can ignore SIGHUPs). I think a better solution would be to have a
I think the reason it is rerunning is because you have
|
@toert I take it this means you are able stop scripts now? |
Actually not. Take a look at https://github.com/toert/DO_wooey . |
What OS are you using? I setup a Wooey server using that repository in python 3.6.5 and halting scripts worked as expected. Also, you might want to upgrade the version of Wooey you are using to at least the latest in 0.9.x (if not 0.10.x, though 0.10.x has a few changes wrt celery that will require updating some of your settings) |
If I start an executing a script with "while True" and after some time I decide to stop it via Stop button then it will not stop and will work infinitely.
My solution of the problem is killing all Celery workers as processes.
Do you have any ideas how can I stop infinitely scripts via web interface, not CLI?
The text was updated successfully, but these errors were encountered: