@@ -63,8 +63,8 @@ def __init__(self, app):
6363 self .systemd = False
6464 self .worker_age = 0
6565 self .reexec_pid = 0
66- self .master_pid = 0
67- self .master_name = "Master "
66+ self .main_pid = 0
67+ self .main_name = "Main "
6868
6969 cwd = util .getcwd ()
7070
@@ -126,14 +126,14 @@ def start(self):
126126 self .log .info ("Starting gunicorn %s" , __version__ )
127127
128128 if 'GUNICORN_PID' in os .environ :
129- self .master_pid = int (os .environ .get ('GUNICORN_PID' ))
129+ self .main_pid = int (os .environ .get ('GUNICORN_PID' ))
130130 self .proc_name = self .proc_name + ".2"
131- self .master_name = "Master .2"
131+ self .main_name = "Main .2"
132132
133133 self .pid = os .getpid ()
134134 if self .cfg .pidfile is not None :
135135 pidname = self .cfg .pidfile
136- if self .master_pid != 0 :
136+ if self .main_pid != 0 :
137137 pidname += ".2"
138138 self .pidfile = Pidfile (pidname )
139139 self .pidfile .create (self .pid )
@@ -149,7 +149,7 @@ def start(self):
149149 fds = range (systemd .SD_LISTEN_FDS_START ,
150150 systemd .SD_LISTEN_FDS_START + listen_fds )
151151
152- elif self .master_pid :
152+ elif self .main_pid :
153153 fds = []
154154 for fd in os .environ .pop ('GUNICORN_FD' ).split (',' ):
155155 fds .append (int (fd ))
@@ -169,8 +169,8 @@ def start(self):
169169
170170 def init_signals (self ):
171171 """\
172- Initialize master signal handling. Most of the signals
173- are queued. Child signals only wake up the master .
172+ Initialize main signal handling. Most of the signals
173+ are queued. Child signals only wake up the main .
174174 """
175175 # close old PIPE
176176 for p in self .PIPE :
@@ -195,15 +195,15 @@ def signal(self, sig, frame):
195195 self .wakeup ()
196196
197197 def run (self ):
198- "Main master loop."
198+ "Main main loop."
199199 self .start ()
200- util ._setproctitle ("master [%s]" % self .proc_name )
200+ util ._setproctitle ("main [%s]" % self .proc_name )
201201
202202 try :
203203 self .manage_workers ()
204204
205205 while True :
206- self .maybe_promote_master ()
206+ self .maybe_promote_main ()
207207
208208 sig = self .SIG_QUEUE .pop (0 ) if self .SIG_QUEUE else None
209209 if sig is None :
@@ -252,7 +252,7 @@ def handle_hup(self):
252252 - Start the new worker processes with a new configuration
253253 - Gracefully shutdown the old worker processes
254254 """
255- self .log .info ("Hang up: %s" , self .master_name )
255+ self .log .info ("Hang up: %s" , self .main_name )
256256 self .reload ()
257257
258258 def handle_term (self ):
@@ -298,8 +298,8 @@ def handle_usr1(self):
298298 def handle_usr2 (self ):
299299 """\
300300 SIGUSR2 handling.
301- Creates a new master /worker set as a slave of the current
302- master without affecting old workers. Use this to do live
301+ Creates a new main /worker set as a subordinate of the current
302+ main without affecting old workers. Use this to do live
303303 deployment with the ability to backout a change.
304304 """
305305 self .reexec ()
@@ -313,22 +313,22 @@ def handle_winch(self):
313313 else :
314314 self .log .debug ("SIGWINCH ignored. Not daemonized" )
315315
316- def maybe_promote_master (self ):
317- if self .master_pid == 0 :
316+ def maybe_promote_main (self ):
317+ if self .main_pid == 0 :
318318 return
319319
320- if self .master_pid != os .getppid ():
321- self .log .info ("Master has been promoted." )
322- # reset master infos
323- self .master_name = "Master "
324- self .master_pid = 0
320+ if self .main_pid != os .getppid ():
321+ self .log .info ("Main has been promoted." )
322+ # reset main infos
323+ self .main_name = "Main "
324+ self .main_pid = 0
325325 self .proc_name = self .cfg .proc_name
326326 del os .environ ['GUNICORN_PID' ]
327327 # rename the pidfile
328328 if self .pidfile is not None :
329329 self .pidfile .rename (self .cfg .pidfile )
330330 # reset proctitle
331- util ._setproctitle ("master [%s]" % self .proc_name )
331+ util ._setproctitle ("main [%s]" % self .proc_name )
332332
333333 def wakeup (self ):
334334 """\
@@ -343,7 +343,7 @@ def wakeup(self):
343343 def halt (self , reason = None , exit_status = 0 ):
344344 """ halt arbiter """
345345 self .stop ()
346- self .log .info ("Shutting down: %s" , self .master_name )
346+ self .log .info ("Shutting down: %s" , self .main_name )
347347 if reason is not None :
348348 self .log .info ("Reason: %s" , reason )
349349 if self .pidfile is not None :
@@ -378,7 +378,7 @@ def stop(self, graceful=True):
378378 killed gracefully (ie. trying to wait for the current connection)
379379 """
380380
381- unlink = self .reexec_pid == self .master_pid == 0 and not self .systemd
381+ unlink = self .reexec_pid == self .main_pid == 0 and not self .systemd
382382 sock .close_sockets (self .LISTENERS , unlink )
383383
384384 self .LISTENERS = []
@@ -396,25 +396,25 @@ def stop(self, graceful=True):
396396
397397 def reexec (self ):
398398 """\
399- Relaunch the master and workers.
399+ Relaunch the main and workers.
400400 """
401401 if self .reexec_pid != 0 :
402402 self .log .warning ("USR2 signal ignored. Child exists." )
403403 return
404404
405- if self .master_pid != 0 :
405+ if self .main_pid != 0 :
406406 self .log .warning ("USR2 signal ignored. Parent exists." )
407407 return
408408
409- master_pid = os .getpid ()
409+ main_pid = os .getpid ()
410410 self .reexec_pid = os .fork ()
411411 if self .reexec_pid != 0 :
412412 return
413413
414414 self .cfg .pre_exec (self )
415415
416416 environ = self .cfg .env_orig .copy ()
417- environ ['GUNICORN_PID' ] = str (master_pid )
417+ environ ['GUNICORN_PID' ] = str (main_pid )
418418
419419 if self .systemd :
420420 environ ['LISTEN_PID' ] = str (os .getpid ())
@@ -474,7 +474,7 @@ def reload(self):
474474 self .pidfile .create (self .pid )
475475
476476 # set new proc_name
477- util ._setproctitle ("master [%s]" % self .proc_name )
477+ util ._setproctitle ("main [%s]" % self .proc_name )
478478
479479 # spawn new workers
480480 for _ in range (self .cfg .workers ):
@@ -609,7 +609,7 @@ def spawn_workers(self):
609609 Spawn new workers as needed.
610610
611611 This is where a worker process leaves the main loop
612- of the master process.
612+ of the main process.
613613 """
614614
615615 for _ in range (self .num_workers - len (self .WORKERS .keys ())):
0 commit comments