Skip to content

Instantly share code, notes, and snippets.

@hpk42
Created June 19, 2012 22:04
Show Gist options
  • Save hpk42/2956799 to your computer and use it in GitHub Desktop.
Save hpk42/2956799 to your computer and use it in GitHub Desktop.
(1)hpk@t2:~/p/execnet$ tox -epy32 testing/test_multi.py
GLOB sdist-make: /home/hpk/p/execnet/setup.py
py32 sdist-reinst: /home/hpk/p/execnet/.tox/dist/execnet-1.1.dev1.zip
py32 runtests: commands[0]
===================================== test session starts ======================================
platform linux2 -- Python 3.2.3 -- pytest-2.2.5.dev2
gateway test setup scope: session
execnet: /home/hpk/p/execnet/execnet/__init__.py -- 1.1.dev1
collected 14 items
test_multi.py .............F
=========================================== FAILURES ===========================================
____________________________ TestGroup.test_terminate_with_proxying ____________________________
self = <testing.test_multi.TestGroup object at 0x1f215d0>
def test_terminate_with_proxying(self):
group = Group()
master = group.makegateway('popen//id=master')
slave = group.makegateway('popen//via=master//id=slave')
> group.terminate(1.0)
test_multi.py:188:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Group []>, timeout = 1.0
def terminate(self, timeout=None):
""" trigger exit of member gateways and wait for termination
of member gateways and associated subprocesses. After waiting
timeout seconds try to to kill local sub processes of popen-
and ssh-gateways. Timeout defaults to None meaning
open-ended waiting and no kill attempts.
"""
while self:
#XXX multiplies the maximal timeout by the levels of indirection
vias = {}
for gw in self:
if gw.spec.via:
vias[gw.spec.via] = True
for gw in self:
if gw.id not in vias:
gw.exit()
def join_receiver_and_wait_for_subprocesses():
for gw in self._gateways_to_join:
gw.join()
while self._gateways_to_join:
gw = self._gateways_to_join[0]
gw._io.wait()
del self._gateways_to_join[0]
from execnet.threadpool import WorkerPool
pool = WorkerPool(1)
reply = pool.dispatch(join_receiver_and_wait_for_subprocesses)
try:
> reply.get(timeout=timeout)
../execnet/multi.py:166:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <execnet.threadpool.Reply object at 0x1f26e10>, timeout = 1.0
def get(self, timeout=None):
""" get the result object from an asynchronous function execution.
if the function execution raised an exception,
then calling get() will reraise that exception
including its traceback.
"""
if self._queue is None:
raise EOFError("reply has already been delivered")
try:
result = self._queue.get(timeout=timeout)
except queue.Empty:
raise IOError("timeout waiting for %r" %(self.task, ))
if result is ERRORMARKER:
self._queue = None
excinfo = self._excinfo
> reraise(excinfo[0], excinfo[1], excinfo[2])
../execnet/threadpool.py:54:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'IndexError'>, val = IndexError('list assignment index out of range',)
tb = <traceback object at 0x1f28638>
> ???
<string>:1:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <WorkerThread(Thread-6, started daemon 139846836262656)>
def _run_once(self):
reply = self._queue.get()
if reply is SystemExit:
return False
assert self not in self._pool._ready
task = reply.task
try:
func, args, kwargs = task
> result = func(*args, **kwargs)
../execnet/threadpool.py:72:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def join_receiver_and_wait_for_subprocesses():
for gw in self._gateways_to_join:
gw.join()
while self._gateways_to_join:
gw = self._gateways_to_join[0]
gw._io.wait()
> del self._gateways_to_join[0]
E IndexError: list assignment index out of range
../execnet/multi.py:161: IndexError
--------------------------------------- Captured stderr ----------------------------------------
Exception in thread io-forward-slave:
Traceback (most recent call last):
File "/home/hpk/p/execnet/execnet/gateway_base.py", line 121, in from_io
header = io.read(9) # type 1, channel 4, payload 4
File "/home/hpk/p/execnet/execnet/gateway_base.py", line 93, in read
raise EOFError("expected %d bytes, got %d" %(numbytes, len(buf)))
EOFError: expected 9 bytes, got 0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/hpk/.pythonbrew/pythons/Python-3.2.3/lib/python3.2/threading.py", line 740, in _bootstrap_inner
self.run()
File "/home/hpk/.pythonbrew/pythons/Python-3.2.3/lib/python3.2/threading.py", line 693, in run
self._target(*self._args, **self._kwargs)
File "", line 146, in iothread
File "/home/hpk/p/execnet/execnet/gateway_base.py", line 124, in from_io
raise EOFError('couldnt load message header, ' + e.args[0])
EOFError: couldnt load message header, expected 9 bytes, got 0
------------- generated xml file: /home/hpk/p/execnet/.tox/py32/log/junit-py32.xml -------------
=================================== short test summary info ====================================
FAIL test_multi.py::TestGroup::()::test_terminate_with_proxying
============================= 1 failed, 13 passed in 1.86 seconds ==============================
ERROR: InvocationError: '/home/hpk/p/execnet/.tox/py32/bin/py.test -rsfxX --junitxml=/home/hpk/p/execnet/.tox/py32/log/junit-py32.xml test_multi.py'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment