Skip to content

Instantly share code, notes, and snippets.

@rmyers
Created March 23, 2016 00:52
Show Gist options
  • Save rmyers/280bd6ce4c234cebdc23 to your computer and use it in GitHub Desktop.
Save rmyers/280bd6ce4c234cebdc23 to your computer and use it in GitHub Desktop.
Fix for catching exceptions in fake taskmanager
import eventlet
from trove.taskmanager import api
from trove.taskmanager.manager import Manager
+from trove.openstack.common import log as logging
+
+LOG = logging.getLogger(__name__)
class FakeApi(api.API):
@@ -35,7 +38,10 @@ class FakeApi(api.API):
manager, method = self.get_tm_method(msg['name'])
def func():
- method(manager, context, *msg['args'], **msg['kwargs'])
+ try:
+ method(manager, context, *msg['args'], **msg['kwargs'])
+ except:
+ LOG.exception("Error running %s", method)
eventlet.spawn_after(0.1, func)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment