Skip to content

Commit 3b765a5

Browse files
authored
Change variable names (#3971)
1 parent ed66bc4 commit 3b765a5

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

pymc3/sampling.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ def __init__(self, steppers, parallelize, progressbar=True):
10031003
"""
10041004
self.nchains = len(steppers)
10051005
self.is_parallelized = False
1006-
self._master_ends = []
1006+
self._primary_ends = []
10071007
self._processes = []
10081008
self._steppers = steppers
10091009
if parallelize:
@@ -1017,11 +1017,11 @@ def __init__(self, steppers, parallelize, progressbar=True):
10171017
for c, stepper in (
10181018
enumerate(progress_bar(steppers)) if progressbar else enumerate(steppers)
10191019
):
1020-
slave_end, master_end = multiprocessing.Pipe()
1020+
secondary_end, primary_end = multiprocessing.Pipe()
10211021
stepper_dumps = pickle.dumps(stepper, protocol=4)
10221022
process = multiprocessing.Process(
1023-
target=self.__class__._run_slave,
1024-
args=(c, stepper_dumps, slave_end),
1023+
target=self.__class__._run_secondary,
1024+
args=(c, stepper_dumps, secondary_end),
10251025
name="ChainWalker{}".format(c),
10261026
)
10271027
# we want the child process to exit if the parent is terminated
@@ -1030,7 +1030,7 @@ def __init__(self, steppers, parallelize, progressbar=True):
10301030
# By doing it in the constructor, the sampling progress bar
10311031
# will not be confused by the process start.
10321032
process.start()
1033-
self._master_ends.append(master_end)
1033+
self._primary_ends.append(primary_end)
10341034
self._processes.append(process)
10351035
self.is_parallelized = True
10361036
except Exception:
@@ -1053,16 +1053,16 @@ def __enter__(self):
10531053
def __exit__(self, exc_type, exc_val, exc_tb):
10541054
if len(self._processes) > 0:
10551055
try:
1056-
for master_end in self._master_ends:
1057-
master_end.send(None)
1056+
for primary_end in self._primary_ends:
1057+
primary_end.send(None)
10581058
for process in self._processes:
10591059
process.join(timeout=3)
10601060
except Exception:
10611061
_log.warning("Termination failed.")
10621062
return
10631063

10641064
@staticmethod
1065-
def _run_slave(c, stepper_dumps, slave_end):
1065+
def _run_secondary(c, stepper_dumps, secondary_end):
10661066
"""This method is started on a separate process to perform stepping of a chain.
10671067
10681068
Parameters
@@ -1071,7 +1071,7 @@ def _run_slave(c, stepper_dumps, slave_end):
10711071
number of this chain
10721072
stepper : BlockedStep
10731073
a step method such as CompoundStep
1074-
slave_end : multiprocessing.connection.PipeConnection
1074+
secondary_end : multiprocessing.connection.PipeConnection
10751075
This is our connection to the main process
10761076
"""
10771077
# re-seed each child process to make them unique
@@ -1086,7 +1086,7 @@ def _run_slave(c, stepper_dumps, slave_end):
10861086
if isinstance(sm, arraystep.PopulationArrayStepShared):
10871087
population_steppers.append(sm)
10881088
while True:
1089-
incoming = slave_end.recv()
1089+
incoming = secondary_end.recv()
10901090
# receiving a None is the signal to exit
10911091
if incoming is None:
10921092
break
@@ -1099,7 +1099,7 @@ def _run_slave(c, stepper_dumps, slave_end):
10991099
for popstep in population_steppers:
11001100
popstep.population = population
11011101
update = stepper.step(population[c])
1102-
slave_end.send(update)
1102+
secondary_end.send(update)
11031103
except Exception:
11041104
_log.exception("ChainWalker{}".format(c))
11051105
return
@@ -1122,10 +1122,10 @@ def step(self, tune_stop, population):
11221122
updates = [None] * self.nchains
11231123
if self.is_parallelized:
11241124
for c in range(self.nchains):
1125-
self._master_ends[c].send((tune_stop, population))
1125+
self._primary_ends[c].send((tune_stop, population))
11261126
# Blockingly get the step outcomes
11271127
for c in range(self.nchains):
1128-
updates[c] = self._master_ends[c].recv()
1128+
updates[c] = self._primary_ends[c].recv()
11291129
else:
11301130
for c in range(self.nchains):
11311131
if tune_stop:

0 commit comments

Comments
 (0)