@@ -1003,7 +1003,7 @@ def __init__(self, steppers, parallelize, progressbar=True):
1003
1003
"""
1004
1004
self .nchains = len (steppers )
1005
1005
self .is_parallelized = False
1006
- self ._master_ends = []
1006
+ self ._primary_ends = []
1007
1007
self ._processes = []
1008
1008
self ._steppers = steppers
1009
1009
if parallelize :
@@ -1017,11 +1017,11 @@ def __init__(self, steppers, parallelize, progressbar=True):
1017
1017
for c , stepper in (
1018
1018
enumerate (progress_bar (steppers )) if progressbar else enumerate (steppers )
1019
1019
):
1020
- slave_end , master_end = multiprocessing .Pipe ()
1020
+ secondary_end , primary_end = multiprocessing .Pipe ()
1021
1021
stepper_dumps = pickle .dumps (stepper , protocol = 4 )
1022
1022
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 ),
1025
1025
name = "ChainWalker{}" .format (c ),
1026
1026
)
1027
1027
# we want the child process to exit if the parent is terminated
@@ -1030,7 +1030,7 @@ def __init__(self, steppers, parallelize, progressbar=True):
1030
1030
# By doing it in the constructor, the sampling progress bar
1031
1031
# will not be confused by the process start.
1032
1032
process .start ()
1033
- self ._master_ends .append (master_end )
1033
+ self ._primary_ends .append (primary_end )
1034
1034
self ._processes .append (process )
1035
1035
self .is_parallelized = True
1036
1036
except Exception :
@@ -1053,16 +1053,16 @@ def __enter__(self):
1053
1053
def __exit__ (self , exc_type , exc_val , exc_tb ):
1054
1054
if len (self ._processes ) > 0 :
1055
1055
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 )
1058
1058
for process in self ._processes :
1059
1059
process .join (timeout = 3 )
1060
1060
except Exception :
1061
1061
_log .warning ("Termination failed." )
1062
1062
return
1063
1063
1064
1064
@staticmethod
1065
- def _run_slave (c , stepper_dumps , slave_end ):
1065
+ def _run_secondary (c , stepper_dumps , secondary_end ):
1066
1066
"""This method is started on a separate process to perform stepping of a chain.
1067
1067
1068
1068
Parameters
@@ -1071,7 +1071,7 @@ def _run_slave(c, stepper_dumps, slave_end):
1071
1071
number of this chain
1072
1072
stepper : BlockedStep
1073
1073
a step method such as CompoundStep
1074
- slave_end : multiprocessing.connection.PipeConnection
1074
+ secondary_end : multiprocessing.connection.PipeConnection
1075
1075
This is our connection to the main process
1076
1076
"""
1077
1077
# re-seed each child process to make them unique
@@ -1086,7 +1086,7 @@ def _run_slave(c, stepper_dumps, slave_end):
1086
1086
if isinstance (sm , arraystep .PopulationArrayStepShared ):
1087
1087
population_steppers .append (sm )
1088
1088
while True :
1089
- incoming = slave_end .recv ()
1089
+ incoming = secondary_end .recv ()
1090
1090
# receiving a None is the signal to exit
1091
1091
if incoming is None :
1092
1092
break
@@ -1099,7 +1099,7 @@ def _run_slave(c, stepper_dumps, slave_end):
1099
1099
for popstep in population_steppers :
1100
1100
popstep .population = population
1101
1101
update = stepper .step (population [c ])
1102
- slave_end .send (update )
1102
+ secondary_end .send (update )
1103
1103
except Exception :
1104
1104
_log .exception ("ChainWalker{}" .format (c ))
1105
1105
return
@@ -1122,10 +1122,10 @@ def step(self, tune_stop, population):
1122
1122
updates = [None ] * self .nchains
1123
1123
if self .is_parallelized :
1124
1124
for c in range (self .nchains ):
1125
- self ._master_ends [c ].send ((tune_stop , population ))
1125
+ self ._primary_ends [c ].send ((tune_stop , population ))
1126
1126
# Blockingly get the step outcomes
1127
1127
for c in range (self .nchains ):
1128
- updates [c ] = self ._master_ends [c ].recv ()
1128
+ updates [c ] = self ._primary_ends [c ].recv ()
1129
1129
else :
1130
1130
for c in range (self .nchains ):
1131
1131
if tune_stop :
0 commit comments