Commits

Ronny Pfannschmidt committed 3390ba5

update

Comments (0)

Files changed (5)

 # HG changeset patch
-# Parent 411f4e9fd277d5723f94d474ffdf34695179d40c
-unification of killing/waiting for io's
+# Parent da6994ca8402d9d29a367ed312cce0717ea46dad
+unify killing/shuttdown polling for all io's
 
 diff --git a/execnet/gateway.py b/execnet/gateway.py
 --- a/execnet/gateway.py
  from execnet import gateway_base
  importdir = os.path.dirname(os.path.dirname(execnet.__file__))
  
-@@ -216,12 +217,11 @@ class PopenCmdGateway(Gateway):
+@@ -221,12 +222,11 @@ class PopenCmdGateway(Gateway):
      _remotesetup = "io = init_popen_io()"
      def __init__(self, args, id):
          from subprocess import Popen, PIPE
                  "import os; channel.send(os.getpid())").receive()
  
  popen_bootstrapline = "import sys;exec(eval(sys.stdin.readline()))"
-@@ -286,6 +286,6 @@ class SshGateway(PopenCmdGateway):
+@@ -291,6 +291,6 @@ class SshGateway(PopenCmdGateway):
          try:
              super(SshGateway, self)._remote_bootstrap_gateway(io)
          except EOFError:
+# HG changeset patch
+# Parent 17efa3f77a9ce8f9bf4fce3859c29083bb5e9b3a
+enhance tracing for message writing in case of io fail
+
+diff --git a/execnet/gateway_base.py b/execnet/gateway_base.py
+--- a/execnet/gateway_base.py
++++ b/execnet/gateway_base.py
+@@ -698,9 +698,15 @@ class BaseGateway(object):
+         pass
+ 
+     def _send(self, msgcode, channelid=0, data=bytes()):
+-        header = struct.pack('!bii', msgcode, channelid, len(data))
+-        self._io.write(header+data)
+-        self._trace('sent', Message(msgcode, channelid, data))
++        message = Message(msgcode, channelid, data)
++        try:
++            message.to_io(self._io)
++            self._trace('sent', message)
++        except (IOError, ValueError):
++            e = sys.exc_info()[1]
++            self._trace('failed to send', message, e)
++            raise
++
+ 
+     def _local_schedulexec(self, channel, sourcetask):
+         channel.close("execution disallowed")
-linecache
-group-remote-exec-no-code-reload
+linecache #+lines
+group-remote-exec-no-code-reload #+lines
 io-wait-kill
 io-creation-split
 bootstrap-split
 io-on-remote
 topologic-shutdown
 test-remote-shutdown
-stash
+message-writing
+shutdown-testing
+# HG changeset patch
+# Parent 189f37d3a60b363e8f755bdd9dd552773d007351
+some tests for terminaton, strange
+
+diff --git a/testing/test_termination.py b/testing/test_termination.py
+--- a/testing/test_termination.py
++++ b/testing/test_termination.py
+@@ -112,3 +112,24 @@ def test_terminate_implicit_does_trykill
+     lines = [x for x in err.splitlines()
+                if '*sys-package' not in x]
+     assert not lines or "Killed" in err
++
++
++def test_master_killed():
++    group = execnet.Group()
++    master = group.makegateway('popen//id=master')
++    channel = master.remote_exec('channel.send(channel.receive())')
++    master._io.kill()
++    master._io.wait()
++    channel.send(1)
++    channel.receive(10)
++
++    group.terminate()
++
++
++def test_proxyed_slave_termination():
++    group = execnet.Group()
++    master = group.makegateway('popen//id=master')
++    watched = group.makegateway('popen//id=watched//via=master')
++    master.exit()
++    group.terminate()
++

stash

-# HG changeset patch
-# Parent 8d5b1ff1deffedfb230448345aafcfee279c9f51
-diff --git a/execnet/gateway_base.py b/execnet/gateway_base.py
---- a/execnet/gateway_base.py
-+++ b/execnet/gateway_base.py
-@@ -698,9 +698,15 @@ class BaseGateway(object):
-         pass
- 
-     def _send(self, msgcode, channelid=0, data=bytes()):
--        header = struct.pack('!bii', msgcode, channelid, len(data))
--        self._io.write(header+data)
--        self._trace('sent', Message(msgcode, channelid, data))
-+        message = Message(msgcode, channelid, data)
-+        try:
-+            message.to_io(self._io)
-+            self._trace('sent', message)
-+        except (IOError, ValueError):
-+            e = sys.exc_info()[1]
-+            self._trace('failed to send', message, e)
-+            raise
-+
- 
-     def _local_schedulexec(self, channel, sourcetask):
-         channel.close("execution disallowed")
-diff --git a/testing/test_termination.py b/testing/test_termination.py
---- a/testing/test_termination.py
-+++ b/testing/test_termination.py
-@@ -112,3 +112,24 @@ def test_terminate_implicit_does_trykill
-     lines = [x for x in err.splitlines()
-                if '*sys-package' not in x]
-     assert not lines or "Killed" in err
-+
-+
-+def test_master_killed():
-+    group = execnet.Group()
-+    master = group.makegateway('popen//id=master')
-+    channel = master.remote_exec('channel.send(channel.receive())')
-+    master._io.kill()
-+    master._io.wait()
-+    channel.send(1)
-+    channel.receive(10)
-+
-+    group.terminate()
-+
-+
-+def test_proxyed_slave_termination():
-+    group = execnet.Group()
-+    master = group.makegateway('popen//id=master')
-+    watched = group.makegateway('popen//id=watched//via=master')
-+    master.exit()
-+    group.terminate()
-+