Esempio n. 1
0
 def __init__(self, instance):
     super(BulkInstanceInteropHelper, self).__init__(instance)
     self.proc = procutils.start_subprocess()
     try:
         procutils.run_in_subprocess(self.proc, _connect,
                                     self._get_conn_params())
     except Exception:
         with excutils.save_and_reraise_exception():
             procutils.shutdown_subprocess(self.proc, _cleanup)
Esempio n. 2
0
 def __init__(self, instance):
     super(BulkInstanceInteropHelper, self).__init__(instance)
     self.proc = procutils.start_subprocess()
     try:
         procutils.run_in_subprocess(self.proc, _connect,
                                     self._get_conn_params())
     except Exception:
         with excutils.save_and_reraise_exception():
             procutils.shutdown_subprocess(self.proc, _cleanup)
Esempio n. 3
0
    def _run(self, func, *args, **kwargs):
        proc = procutils.start_subprocess()

        try:
            procutils.run_in_subprocess(proc, _connect,
                                        self._get_conn_params())
            return procutils.run_in_subprocess(proc, func, args, kwargs)
        except Exception:
            with excutils.save_and_reraise_exception():
                procutils.shutdown_subprocess(proc, _cleanup)
        finally:
            procutils.shutdown_subprocess(proc, _cleanup)
Esempio n. 4
0
    def _run(self, func, *args, **kwargs):
        proc = procutils.start_subprocess()

        try:
            procutils.run_in_subprocess(proc, _connect,
                                        self._get_conn_params())
            return procutils.run_in_subprocess(proc, func, args, kwargs)
        except Exception:
            with excutils.save_and_reraise_exception():
                procutils.shutdown_subprocess(proc, _cleanup)
        finally:
            procutils.shutdown_subprocess(proc, _cleanup)
Esempio n. 5
0
    def func():
        proc = procutils.start_subprocess()

        try:
            conn_params = (gateway_host, gateway_username, gateway_private_key,
                           proxy_command, None, None)
            procutils.run_in_subprocess(proc, _connect, conn_params)
            cmd = "nc {host} {port}".format(host=host, port=port)
            procutils.run_in_subprocess(
                proc, _execute_command_interactive, (cmd,), interactive=True)
            return proc
        except Exception:
            with excutils.save_and_reraise_exception():
                procutils.shutdown_subprocess(proc, _cleanup)
Esempio n. 6
0
    def func():
        proc = procutils.start_subprocess()

        try:
            conn_params = (gateway_host, gateway_username, gateway_private_key,
                           proxy_command, None, None)
            procutils.run_in_subprocess(proc, _connect, conn_params)
            cmd = "nc {host} {port}".format(host=host, port=port)
            procutils.run_in_subprocess(
                proc, _execute_command_interactive, (cmd,), interactive=True)
            return proc
        except Exception:
            with excutils.save_and_reraise_exception():
                procutils.shutdown_subprocess(proc, _cleanup)
Esempio n. 7
0
 def close(self):
     procutils.shutdown_subprocess(self.proc, _cleanup)
Esempio n. 8
0
 def close(self):
     procutils.shutdown_subprocess(self.proc, _cleanup)