1

I have a Flask-based program that (as to me) is essentially equivalent to the example in SO answer https://stackoverflow.com/a/14180227 (source: https://github.com/stackforge/ironic-discoverd/blob/master/ironic_discoverd/main.py), simplified:

 eventlet.monkey_patch(thread=False)  # change to True to break

 @app.route('/', methods=['GET', 'POST'])
 def api():
    eventlet.greenthread.spawn_n(do_some_job)  # is not called

 def main():
    app.run()

When I use eventlet.monkey_patch(thread=False) everything is fine. When I set thread=True, eventlet.greenthread.spawn_n (e.g. https://github.com/stackforge/ironic-discoverd/blob/master/ironic_discoverd/introspect.py#L76) here just does nothing, i.e. control is never yielded to it, though Flask should have been patched.

Any ideas?

Eventlet 0.15.2, Python 2.7.5, Flask 0.10.1

Community
  • 1
  • 1
Divius
  • 11
  • 1
  • Do you have `import flask` before or after monkey_patch? Do you need `thread=True`? – temoto Jan 23 '15 at 02:27
  • @temoto `import flask` is after monkey patching, `thread=True` is the default, so I suppose my code should work with it, but I don't insist :) – Divius Jan 24 '15 at 14:13
  • you are correct, it must work, in both cases in fact. – temoto Jan 24 '15 at 14:51

0 Answers0