Skip to content

Instantly share code, notes, and snippets.

@hpk42
Created June 18, 2012 13:55
Show Gist options
  • Save hpk42/2948481 to your computer and use it in GitHub Desktop.
Save hpk42/2948481 to your computer and use it in GitHub Desktop.
self = <testing.test_multi.TestGroup object at 0x24fde90>
def test_terminate_with_proxying(self):
group = Group()
master = group.makegateway('popen//id=master')
> slave = group.makegateway('popen//via=master//id=slave')
test_multi.py:187:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <Group ['master']>, spec = <XSpec 'popen//via=master//id=slave'>
def makegateway(self, spec=None):
"""create and configure a gateway to a Python interpreter.
The ``spec`` string encodes the target gateway type
and configuration information. The general format is::
key1=value1//key2=value2//...
If you leave out the ``=value`` part a True value is assumed.
Valid types: ``popen``, ``ssh=hostname``, ``socket=host:port``.
Valid configuration::
id=<string> specifies the gateway id
python=<path> specifies which python interpreter to execute
chdir=<path> specifies to which directory to change
nice=<path> specifies process priority of new process
env:NAME=value specifies a remote environment variable setting.
If no spec is given, self.defaultspec is used.
"""
if not spec:
spec = self.defaultspec
if not isinstance(spec, XSpec):
spec = XSpec(spec)
self.allocate_id(spec)
if spec.via:
assert not spec.socket
master = self[spec.via]
channel = master.remote_exec(gateway_io)
channel.send(vars(spec))
io = gateway_io.RemoteIO(channel)
> gw = gateway_bootstrap.bootstrap(io, spec)
../execnet/multi.py:83:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
io = <execnet.gateway_io.RemoteIO object at 0x25033d0>
spec = <XSpec 'popen//via=master//id=slave'>
def bootstrap(io, spec):
if spec.popen:
> bootstrap_popen(io, spec)
../execnet/gateway_bootstrap.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
io = <execnet.gateway_io.RemoteIO object at 0x25033d0>
spec = <XSpec 'popen//via=master//id=slave'>
def bootstrap_popen(io, spec):
sendexec(io,
"import sys",
"sys.path.insert(0, %r)" % importdir,
"from execnet.gateway_base import serve, init_popen_io",
"sys.stdout.write('1')",
"sys.stdout.flush()",
"serve(init_popen_io(), id='%s-slave')" % spec.id,
)
> s = io.read(1)
../execnet/gateway_bootstrap.py:25:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <execnet.gateway_io.RemoteIO object at 0x25033d0>, nbytes = 1
def read(self, nbytes):
> return self.io.read(nbytes)
../execnet/gateway_io.py:108:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <ChannelFile 3 open>, n = 1
def read(self, n):
while len(self._buffer) < n:
try:
> self._buffer += self.channel.receive()
E TypeError: Can't convert 'bytes' object to str implicitly
../execnet/gateway_base.py:613: TypeError
- generated xml file: /home/hpk/p/execnet-patches/.tox/py32/log/junit-py32.xml -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment