Skip to content

Instantly share code, notes, and snippets.

@piyush0101
Created November 15, 2018 21:56
Show Gist options
  • Save piyush0101/5e233995879f1a73b38ab73d9c5f457c to your computer and use it in GitHub Desktop.
Save piyush0101/5e233995879f1a73b38ab73d9c5f457c to your computer and use it in GitHub Desktop.
Offloading contrail-schema CPU intensive tasks to a gipc child process
@@ -1,6 +1,6 @@
import socket
import gevent
+import gipc
import cStringIO
from pprint import pformat
@@ -19,7 +19,6 @@ class VncAmqpHandle(object):
self.q_name_prefix = q_name_prefix
self._db_resync_done = gevent.event.Event()
self._args = args
def establish(self):
q_name = '.'.join([self.q_name_prefix, socket.gethostname()])
@@ -198,8 +197,8 @@ class VncAmqpHandle(object):
kwargs = {}
kwargs['cls'] = cls
kwargs['res_id_list'] = res_id_list
+ eval_gprocess = gipc.start_process(self.evaluate_resources, kwargs=kwargs)
+ eval_gprocess.join()
def evaluate_resources(self, **kwargs):
cls = kwargs['cls']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment