From ed5ce61b2eee03469475ebe3154c56d81d6e543b Mon Sep 17 00:00:00 2001 From: Bogdan Popescu <68062990+bopopescu@users.noreply.github.com> Date: Tue, 21 Jul 2020 01:30:55 +0300 Subject: [PATCH] Discard master/slave terminology --- .../site-packages/gunicorn/arbiter.py | 60 +++++++++---------- .../site-packages/gunicorn/config.py | 6 +- .../site-packages/gunicorn/workers/base.py | 2 +- .../mysql/connector/constants.py | 2 +- .../connector/locales/eng/client_error.py | 4 +- .../mysqlx/locales/eng/client_error.py | 4 +- .../pip/_vendor/pkg_resources/__init__.py | 10 ++-- lib/python3.6/site-packages/pip/vcs/git.py | 4 +- .../site-packages/pkg_resources/__init__.py | 10 ++-- .../setuptools/command/easy_install.py | 2 +- 10 files changed, 52 insertions(+), 52 deletions(-) diff --git a/lib/python3.6/site-packages/gunicorn/arbiter.py b/lib/python3.6/site-packages/gunicorn/arbiter.py index 083ee6a..332d5c8 100644 --- a/lib/python3.6/site-packages/gunicorn/arbiter.py +++ b/lib/python3.6/site-packages/gunicorn/arbiter.py @@ -63,8 +63,8 @@ def __init__(self, app): self.systemd = False self.worker_age = 0 self.reexec_pid = 0 - self.master_pid = 0 - self.master_name = "Master" + self.main_pid = 0 + self.main_name = "Main" cwd = util.getcwd() @@ -126,14 +126,14 @@ def start(self): self.log.info("Starting gunicorn %s", __version__) if 'GUNICORN_PID' in os.environ: - self.master_pid = int(os.environ.get('GUNICORN_PID')) + self.main_pid = int(os.environ.get('GUNICORN_PID')) self.proc_name = self.proc_name + ".2" - self.master_name = "Master.2" + self.main_name = "Main.2" self.pid = os.getpid() if self.cfg.pidfile is not None: pidname = self.cfg.pidfile - if self.master_pid != 0: + if self.main_pid != 0: pidname += ".2" self.pidfile = Pidfile(pidname) self.pidfile.create(self.pid) @@ -149,7 +149,7 @@ def start(self): fds = range(systemd.SD_LISTEN_FDS_START, systemd.SD_LISTEN_FDS_START + listen_fds) - elif self.master_pid: + elif self.main_pid: fds = [] for fd in os.environ.pop('GUNICORN_FD').split(','): fds.append(int(fd)) @@ -169,8 +169,8 @@ def start(self): def init_signals(self): """\ - Initialize master signal handling. Most of the signals - are queued. Child signals only wake up the master. + Initialize main signal handling. Most of the signals + are queued. Child signals only wake up the main. """ # close old PIPE for p in self.PIPE: @@ -195,15 +195,15 @@ def signal(self, sig, frame): self.wakeup() def run(self): - "Main master loop." + "Main main loop." self.start() - util._setproctitle("master [%s]" % self.proc_name) + util._setproctitle("main [%s]" % self.proc_name) try: self.manage_workers() while True: - self.maybe_promote_master() + self.maybe_promote_main() sig = self.SIG_QUEUE.pop(0) if self.SIG_QUEUE else None if sig is None: @@ -252,7 +252,7 @@ def handle_hup(self): - Start the new worker processes with a new configuration - Gracefully shutdown the old worker processes """ - self.log.info("Hang up: %s", self.master_name) + self.log.info("Hang up: %s", self.main_name) self.reload() def handle_term(self): @@ -298,8 +298,8 @@ def handle_usr1(self): def handle_usr2(self): """\ SIGUSR2 handling. - Creates a new master/worker set as a slave of the current - master without affecting old workers. Use this to do live + Creates a new main/worker set as a subordinate of the current + main without affecting old workers. Use this to do live deployment with the ability to backout a change. """ self.reexec() @@ -313,22 +313,22 @@ def handle_winch(self): else: self.log.debug("SIGWINCH ignored. Not daemonized") - def maybe_promote_master(self): - if self.master_pid == 0: + def maybe_promote_main(self): + if self.main_pid == 0: return - if self.master_pid != os.getppid(): - self.log.info("Master has been promoted.") - # reset master infos - self.master_name = "Master" - self.master_pid = 0 + if self.main_pid != os.getppid(): + self.log.info("Main has been promoted.") + # reset main infos + self.main_name = "Main" + self.main_pid = 0 self.proc_name = self.cfg.proc_name del os.environ['GUNICORN_PID'] # rename the pidfile if self.pidfile is not None: self.pidfile.rename(self.cfg.pidfile) # reset proctitle - util._setproctitle("master [%s]" % self.proc_name) + util._setproctitle("main [%s]" % self.proc_name) def wakeup(self): """\ @@ -343,7 +343,7 @@ def wakeup(self): def halt(self, reason=None, exit_status=0): """ halt arbiter """ self.stop() - self.log.info("Shutting down: %s", self.master_name) + self.log.info("Shutting down: %s", self.main_name) if reason is not None: self.log.info("Reason: %s", reason) if self.pidfile is not None: @@ -378,7 +378,7 @@ def stop(self, graceful=True): killed gracefully (ie. trying to wait for the current connection) """ - unlink = self.reexec_pid == self.master_pid == 0 and not self.systemd + unlink = self.reexec_pid == self.main_pid == 0 and not self.systemd sock.close_sockets(self.LISTENERS, unlink) self.LISTENERS = [] @@ -396,17 +396,17 @@ def stop(self, graceful=True): def reexec(self): """\ - Relaunch the master and workers. + Relaunch the main and workers. """ if self.reexec_pid != 0: self.log.warning("USR2 signal ignored. Child exists.") return - if self.master_pid != 0: + if self.main_pid != 0: self.log.warning("USR2 signal ignored. Parent exists.") return - master_pid = os.getpid() + main_pid = os.getpid() self.reexec_pid = os.fork() if self.reexec_pid != 0: return @@ -414,7 +414,7 @@ def reexec(self): self.cfg.pre_exec(self) environ = self.cfg.env_orig.copy() - environ['GUNICORN_PID'] = str(master_pid) + environ['GUNICORN_PID'] = str(main_pid) if self.systemd: environ['LISTEN_PID'] = str(os.getpid()) @@ -474,7 +474,7 @@ def reload(self): self.pidfile.create(self.pid) # set new proc_name - util._setproctitle("master [%s]" % self.proc_name) + util._setproctitle("main [%s]" % self.proc_name) # spawn new workers for _ in range(self.cfg.workers): @@ -609,7 +609,7 @@ def spawn_workers(self): Spawn new workers as needed. This is where a worker process leaves the main loop - of the master process. + of the main process. """ for _ in range(self.num_workers - len(self.WORKERS.keys())): diff --git a/lib/python3.6/site-packages/gunicorn/config.py b/lib/python3.6/site-packages/gunicorn/config.py index 5f51145..1e78b51 100644 --- a/lib/python3.6/site-packages/gunicorn/config.py +++ b/lib/python3.6/site-packages/gunicorn/config.py @@ -1547,7 +1547,7 @@ def on_starting(server): pass default = staticmethod(on_starting) desc = """\ - Called just before the master process is initialized. + Called just before the main process is initialized. The callable needs to accept a single instance variable for the Arbiter. """ @@ -1684,7 +1684,7 @@ def pre_exec(server): pass default = staticmethod(pre_exec) desc = """\ - Called just before a new master process is forked. + Called just before a new main process is forked. The callable needs to accept a single instance variable for the Arbiter. """ @@ -1734,7 +1734,7 @@ def child_exit(server, worker): pass default = staticmethod(child_exit) desc = """\ - Called just after a worker has been exited, in the master process. + Called just after a worker has been exited, in the main process. The callable needs to accept two instance variables for the Arbiter and the just-exited Worker. diff --git a/lib/python3.6/site-packages/gunicorn/workers/base.py b/lib/python3.6/site-packages/gunicorn/workers/base.py index ce40796..0c4cd39 100644 --- a/lib/python3.6/site-packages/gunicorn/workers/base.py +++ b/lib/python3.6/site-packages/gunicorn/workers/base.py @@ -64,7 +64,7 @@ def notify(self): """\ Your worker subclass must arrange to have this method called once every ``self.timeout`` seconds. If you fail in accomplishing - this task, the master process will murder your workers. + this task, the main process will murder your workers. """ self.tmp.notify() diff --git a/lib/python3.6/site-packages/mysql/connector/constants.py b/lib/python3.6/site-packages/mysql/connector/constants.py index 93b986d..a6f4e0d 100644 --- a/lib/python3.6/site-packages/mysql/connector/constants.py +++ b/lib/python3.6/site-packages/mysql/connector/constants.py @@ -545,7 +545,7 @@ class RefreshOption(_Constants): 'HOSTS': (1 << 3, 'Flush host cache'), 'STATUS': (1 << 4, 'Flush status variables'), 'THREADS': (1 << 5, 'Flush thread cache'), - 'SLAVE': (1 << 6, 'Reset master info and restart slave thread'), + 'SLAVE': (1 << 6, 'Reset main info and restart subordinate thread'), } diff --git a/lib/python3.6/site-packages/mysql/connector/locales/eng/client_error.py b/lib/python3.6/site-packages/mysql/connector/locales/eng/client_error.py index a9ed8b9..c6a8209 100644 --- a/lib/python3.6/site-packages/mysql/connector/locales/eng/client_error.py +++ b/lib/python3.6/site-packages/mysql/connector/locales/eng/client_error.py @@ -57,8 +57,8 @@ CR_EMBEDDED_CONNECTION = u"Embedded server" CR_PROBE_SLAVE_STATUS = u"Error on SHOW SLAVE STATUS:" CR_PROBE_SLAVE_HOSTS = u"Error on SHOW SLAVE HOSTS:" -CR_PROBE_SLAVE_CONNECT = u"Error connecting to slave:" -CR_PROBE_MASTER_CONNECT = u"Error connecting to master:" +CR_PROBE_SLAVE_CONNECT = u"Error connecting to subordinate:" +CR_PROBE_MASTER_CONNECT = u"Error connecting to main:" CR_SSL_CONNECTION_ERROR = u"SSL connection error: %-.100s" CR_MALFORMED_PACKET = u"Malformed packet" CR_WRONG_LICENSE = u"This client library is licensed only for use with MySQL servers having '%s' license" diff --git a/lib/python3.6/site-packages/mysqlx/locales/eng/client_error.py b/lib/python3.6/site-packages/mysqlx/locales/eng/client_error.py index a9ed8b9..c6a8209 100644 --- a/lib/python3.6/site-packages/mysqlx/locales/eng/client_error.py +++ b/lib/python3.6/site-packages/mysqlx/locales/eng/client_error.py @@ -57,8 +57,8 @@ CR_EMBEDDED_CONNECTION = u"Embedded server" CR_PROBE_SLAVE_STATUS = u"Error on SHOW SLAVE STATUS:" CR_PROBE_SLAVE_HOSTS = u"Error on SHOW SLAVE HOSTS:" -CR_PROBE_SLAVE_CONNECT = u"Error connecting to slave:" -CR_PROBE_MASTER_CONNECT = u"Error connecting to master:" +CR_PROBE_SLAVE_CONNECT = u"Error connecting to subordinate:" +CR_PROBE_MASTER_CONNECT = u"Error connecting to main:" CR_SSL_CONNECTION_ERROR = u"SSL connection error: %-.100s" CR_MALFORMED_PACKET = u"Malformed packet" CR_WRONG_LICENSE = u"This client library is licensed only for use with MySQL servers having '%s' license" diff --git a/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py b/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py index b8e598b..986cb7f 100644 --- a/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py +++ b/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py @@ -644,9 +644,9 @@ def __init__(self, entries=None): self.add_entry(entry) @classmethod - def _build_master(cls): + def _build_main(cls): """ - Prepare the master working set. + Prepare the main working set. """ ws = cls() try: @@ -3016,9 +3016,9 @@ def _initialize(g=globals()): @_call_aside -def _initialize_master_working_set(): +def _initialize_main_working_set(): """ - Prepare the master working set and make the ``require()`` + Prepare the main working set and make the ``require()`` API available. This function has explicit effects on the global state @@ -3028,7 +3028,7 @@ def _initialize_master_working_set(): Invocation by other packages is unsupported and done at their own risk. """ - working_set = WorkingSet._build_master() + working_set = WorkingSet._build_main() _declare_state('object', working_set=working_set) require = working_set.require diff --git a/lib/python3.6/site-packages/pip/vcs/git.py b/lib/python3.6/site-packages/pip/vcs/git.py index 2187dd8..53aec99 100644 --- a/lib/python3.6/site-packages/pip/vcs/git.py +++ b/lib/python3.6/site-packages/pip/vcs/git.py @@ -118,7 +118,7 @@ def update(self, dest, rev_options): self.run_command(['fetch', '-q', '--tags'], cwd=dest) else: self.run_command(['fetch', '-q'], cwd=dest) - # Then reset to wanted revision (maybe even origin/master) + # Then reset to wanted revision (maybe even origin/main) if rev_options: rev_options = self.check_rev_options( rev_options[0], dest, rev_options, @@ -133,7 +133,7 @@ def obtain(self, dest): rev_options = [rev] rev_display = ' (to %s)' % rev else: - rev_options = ['origin/master'] + rev_options = ['origin/main'] rev_display = '' if self.check_destination(dest, url, rev_options, rev_display): logger.info( diff --git a/lib/python3.6/site-packages/pkg_resources/__init__.py b/lib/python3.6/site-packages/pkg_resources/__init__.py index a323857..dfb331e 100644 --- a/lib/python3.6/site-packages/pkg_resources/__init__.py +++ b/lib/python3.6/site-packages/pkg_resources/__init__.py @@ -643,9 +643,9 @@ def __init__(self, entries=None): self.add_entry(entry) @classmethod - def _build_master(cls): + def _build_main(cls): """ - Prepare the master working set. + Prepare the main working set. """ ws = cls() try: @@ -3015,9 +3015,9 @@ def _initialize(g=globals()): @_call_aside -def _initialize_master_working_set(): +def _initialize_main_working_set(): """ - Prepare the master working set and make the ``require()`` + Prepare the main working set and make the ``require()`` API available. This function has explicit effects on the global state @@ -3027,7 +3027,7 @@ def _initialize_master_working_set(): Invocation by other packages is unsupported and done at their own risk. """ - working_set = WorkingSet._build_master() + working_set = WorkingSet._build_main() _declare_state('object', working_set=working_set) require = working_set.require diff --git a/lib/python3.6/site-packages/setuptools/command/easy_install.py b/lib/python3.6/site-packages/setuptools/command/easy_install.py index 03dd676..db3014d 100644 --- a/lib/python3.6/site-packages/setuptools/command/easy_install.py +++ b/lib/python3.6/site-packages/setuptools/command/easy_install.py @@ -1728,7 +1728,7 @@ def update_dist_caches(dist_path, fix_zipimporter_caches): # There are several other known sources of stale zipimport.zipimporter # instances that we do not clear here, but might if ever given a reason to # do so: - # * Global setuptools pkg_resources.working_set (a.k.a. 'master working + # * Global setuptools pkg_resources.working_set (a.k.a. 'main working # set') may contain distributions which may in turn contain their # zipimport.zipimporter loaders. # * Several zipimport.zipimporter loaders held by local variables further