Skip to content

Commit 116637a

Browse files
authored
Merge pull request #114 from Zac-HD/emancipate
Replace "slave" terminology
2 parents f923a3e + 1f74a87 commit 116637a

File tree

10 files changed

+42
-43
lines changed

10 files changed

+42
-43
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@
343343
to let KeyboardInterrupts pass through.
344344

345345
- EXECNET_DEBUG=2 will cause tracing to go to stderr,
346-
which with popen slave gateways will relay back
346+
which with popen worker gateways will relay back
347347
tracing to the instantiator process.
348348

349349

doc/basics.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ By setting the environment variable ``EXECNET_DEBUG`` you can
221221
configure a tracing mechanism:
222222

223223
:EXECNET_DEBUG=1: write per-process trace-files to ``execnet-debug-PID``
224-
:EXECNET_DEBUG=2: perform tracing to stderr (popen-gateway slaves will send this to their instantiator)
224+
:EXECNET_DEBUG=2: perform tracing to stderr (popen-gateway workers will send this to their instantiator)
225225

226226

227227
.. _`dumps/loads`:

doc/example/test_debug.rst

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ By setting the environment variable ``EXECNET_DEBUG`` you can
66
configure the execnet tracing mechanism:
77

88
:EXECNET_DEBUG=1: write per-process trace-files to ``${TEMPROOT}/execnet-debug-PID``
9-
:EXECNET_DEBUG=2: perform tracing to stderr (popen-gateway slaves will send this to their instantiator)
9+
:EXECNET_DEBUG=2: perform tracing to stderr (popen-gateway workers will send this to their instantiator)
1010

1111
Here is a simple example to see what goes on with a simple execution::
1212

@@ -18,26 +18,26 @@ which will show PID-prefixed trace entries::
1818

1919
[2326] gw0 starting to receive
2020
[2326] gw0 sent <Message.CHANNEL_EXEC channelid=1 '42'>
21-
[2327] creating slavegateway on <execnet.gateway_base.Popen2IO instance at 0x9f1c20c>
22-
[2327] gw0-slave starting to receive
23-
[2327] gw0-slave received <Message.CHANNEL_EXEC channelid=1 '42'>
24-
[2327] gw0-slave execution starts[1]: '42'
25-
[2327] gw0-slave execution finished
26-
[2327] gw0-slave sent <Message.CHANNEL_CLOSE channelid=1 ''>
27-
[2327] gw0-slave 1 sent channel close message
21+
[2327] creating workergateway on <execnet.gateway_base.Popen2IO instance at 0x9f1c20c>
22+
[2327] gw0-worker starting to receive
23+
[2327] gw0-worker received <Message.CHANNEL_EXEC channelid=1 '42'>
24+
[2327] gw0-worker execution starts[1]: '42'
25+
[2327] gw0-worker execution finished
26+
[2327] gw0-worker sent <Message.CHANNEL_CLOSE channelid=1 ''>
27+
[2327] gw0-worker 1 sent channel close message
2828
[2326] gw0 received <Message.CHANNEL_CLOSE channelid=1 ''>
2929
[2326] gw0 1 channel.__del__
3030
[2326] === atexit cleanup <Group ['gw0']> ===
3131
[2326] gw0 gateway.exit() called
3232
[2326] gw0 --> sending GATEWAY_TERMINATE
3333
[2326] gw0 sent <Message.GATEWAY_TERMINATE channelid=0 ''>
3434
[2326] gw0 joining receiver thread
35-
[2327] gw0-slave received <Message.GATEWAY_TERMINATE channelid=0 ''>
36-
[2327] gw0-slave putting None to execqueue
37-
[2327] gw0-slave io.close_read()
38-
[2327] gw0-slave leaving <Thread(receiver, started daemon -1220277392)>
39-
[2327] gw0-slave 1 channel.__del__
40-
[2327] gw0-slave io.close_write()
41-
[2327] gw0-slave slavegateway.serve finished
42-
[2327] gw0-slave gateway.join() called while receiverthread already finished
35+
[2327] gw0-worker received <Message.GATEWAY_TERMINATE channelid=0 ''>
36+
[2327] gw0-worker putting None to execqueue
37+
[2327] gw0-worker io.close_read()
38+
[2327] gw0-worker leaving <Thread(receiver, started daemon -1220277392)>
39+
[2327] gw0-worker 1 channel.__del__
40+
[2327] gw0-worker io.close_write()
41+
[2327] gw0-worker workergateway.serve finished
42+
[2327] gw0-worker gateway.join() called while receiverthread already finished
4343
[2326] gw0 leaving <Thread(receiver, started daemon -1221223568)>

doc/example/test_proxy.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
Managing Proxyed gateways
1+
Managing Proxied gateways
22
==========================
33

44
Simple Proxying
55
----------------
66

77
Using the via arg of specs we can create a gateway
8-
whose io os created on a remote gateway and
9-
proxyed to the master.
8+
whose io is created on a remote gateway and proxied to the master.
109

1110
The simlest use case, is where one creates one master process
12-
and uses it to controll new slaves and their environment
11+
and uses it to control new workers and their environment
1312

1413
::
1514

@@ -19,8 +18,8 @@ and uses it to controll new slaves and their environment
1918
>>> master = group.makegateway('popen//id=master')
2019
>>> master
2120
<Gateway id='master' receive-live, thread model, 0 active channels>
22-
>>> slave = group.makegateway()
23-
>>> slave
21+
>>> worker = group.makegateway()
22+
>>> worker
2423
<Gateway id='gw0' receive-live, thread model, 0 active channels>
2524
>>> group
2625
<Group ['master', 'gw0']>

execnet/gateway_base.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,7 @@ def readline(self):
936936
class BaseGateway(object):
937937
exc_info = sys.exc_info
938938
_sysex = sysex
939-
id = "<slave>"
939+
id = "<worker>"
940940

941941
def __init__(self, io, id, _startcount=2):
942942
self.execmodel = io.execmodel
@@ -1020,7 +1020,7 @@ def join(self, timeout=None):
10201020
self._receivepool.waitall()
10211021

10221022

1023-
class SlaveGateway(BaseGateway):
1023+
class WorkerGateway(BaseGateway):
10241024
def _local_schedulexec(self, channel, sourcetask):
10251025
sourcetask = loads_internal(sourcetask)
10261026
self._execpool.spawn(self.executetask, (channel, sourcetask))
@@ -1061,7 +1061,7 @@ def trace(msg):
10611061
trace("joining receiver thread")
10621062
self.join()
10631063
except KeyboardInterrupt:
1064-
# in the slave we can't really do anything sensible
1064+
# in the worker we can't really do anything sensible
10651065
trace("swallowing keyboardinterrupt, serve finished")
10661066

10671067
def executetask(self, item):
@@ -1550,5 +1550,5 @@ def init_popen_io(execmodel):
15501550

15511551

15521552
def serve(io, id):
1553-
trace("creating slavegateway on {!r}".format(io))
1554-
SlaveGateway(io=io, id=id, _startcount=2).serve()
1553+
trace("creating workergateway on {!r}".format(io))
1554+
WorkerGateway(io=io, id=id, _startcount=2).serve()

execnet/gateway_bootstrap.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def bootstrap_import(io, spec):
2929
"sys.stdout.write('1')",
3030
"sys.stdout.flush()",
3131
"execmodel = get_execmodel(%r)" % spec.execmodel,
32-
"serve(init_popen_io(execmodel), id='%s-slave')" % spec.id,
32+
"serve(init_popen_io(execmodel), id='%s-worker')" % spec.id,
3333
)
3434
s = io.read(1)
3535
assert s == "1".encode("ascii"), repr(s)
@@ -43,7 +43,7 @@ def bootstrap_exec(io, spec):
4343
"execmodel = get_execmodel(%r)" % spec.execmodel,
4444
"io = init_popen_io(execmodel)",
4545
"io.write('1'.encode('ascii'))",
46-
"serve(io, id='%s-slave')" % spec.id,
46+
"serve(io, id='%s-worker')" % spec.id,
4747
)
4848
s = io.read(1)
4949
assert s == "1".encode("ascii")
@@ -67,7 +67,7 @@ def bootstrap_socket(io, id):
6767
" execmodel = get_execmodel('thread')",
6868
"io = SocketIO(clientsock, execmodel)",
6969
"io.write('1'.encode('ascii'))",
70-
"serve(io, id='%s-slave')" % id,
70+
"serve(io, id='%s-worker')" % id,
7171
)
7272
s = io.read(1)
7373
assert s == "1".encode("ascii")

testing/test_basics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ def close(self, errortext=None):
282282
def test_exectask(execmodel):
283283
io = py.io.BytesIO()
284284
io.execmodel = execmodel
285-
gw = gateway_base.SlaveGateway(io, id="something")
285+
gw = gateway_base.WorkerGateway(io, id="something")
286286
ch = PseudoChannel()
287287
gw.executetask((ch, ("raise ValueError()", None, {})))
288288
assert "ValueError" in str(ch._closed[0])

testing/test_gateway.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -470,14 +470,14 @@ def test_popen_filetracing(self, testdir, monkeypatch, makegateway):
470470
fn = gw.remote_exec(
471471
"import execnet;channel.send(execnet.gateway_base.fn)"
472472
).receive()
473-
slavefile = py.path.local(fn)
474-
assert slavefile.check()
475-
slave_line = "creating slavegateway"
476-
for line in slavefile.readlines():
477-
if slave_line in line:
473+
workerfile = py.path.local(fn)
474+
assert workerfile.check()
475+
worker_line = "creating workergateway"
476+
for line in workerfile.readlines():
477+
if worker_line in line:
478478
break
479479
else:
480-
py.test.fail("did not find {!r} in tracefile".format(slave_line))
480+
py.test.fail("did not find {!r} in tracefile".format(worker_line))
481481
gw.exit()
482482

483483
@skip_win_pypy
@@ -487,8 +487,8 @@ def test_popen_stderr_tracing(self, capfd, monkeypatch, makegateway):
487487
gw = makegateway("popen")
488488
pid = gw.remote_exec("import os ; channel.send(os.getpid())").receive()
489489
out, err = capfd.readouterr()
490-
slave_line = "[%s] creating slavegateway" % pid
491-
assert slave_line in err
490+
worker_line = "[%s] creating workergateway" % pid
491+
assert worker_line in err
492492
gw.exit()
493493

494494
def test_no_tracing_by_default(self):

testing/test_multi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def fun(channel, arg):
221221
def test_terminate_with_proxying(self):
222222
group = Group()
223223
group.makegateway("popen//id=master")
224-
group.makegateway("popen//via=master//id=slave")
224+
group.makegateway("popen//via=master//id=worker")
225225
group.terminate(1.0)
226226

227227

testing/test_termination.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
)
1616

1717

18-
def test_exit_blocked_slave_execution_gateway(anypython, makegateway, pool):
18+
def test_exit_blocked_worker_execution_gateway(anypython, makegateway, pool):
1919
gateway = makegateway("popen//python=%s" % anypython)
2020
gateway.remote_exec(
2121
"""

0 commit comments

Comments
 (0)