Hello community, here is the log from the commit of package python-cotyledon for openSUSE:Factory checked in at 2019-03-10 09:35:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-cotyledon (Old) and /work/SRC/openSUSE:Factory/.python-cotyledon.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-cotyledon" Sun Mar 10 09:35:32 2019 rev:5 rq:682466 version:1.7.3 Changes: -------- --- /work/SRC/openSUSE:Factory/python-cotyledon/python-cotyledon.changes 2018-11-30 16:32:11.181378860 +0100 +++ /work/SRC/openSUSE:Factory/.python-cotyledon.new.28833/python-cotyledon.changes 2019-03-10 09:35:34.744173315 +0100 @@ -1,0 +2,7 @@ +Thu Mar 7 13:33:25 UTC 2019 - Tomáš Chvátal <tchva...@suse.com> + +- Update to 1.7.3: + * No upstream changelog +- Remove merged fix_arm.patch + +------------------------------------------------------------------- Old: ---- cotyledon-1.7.1.tar.gz fix_arm.patch New: ---- cotyledon-1.7.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-cotyledon.spec ++++++ --- /var/tmp/diff_new_pack.B91SCv/_old 2019-03-10 09:35:35.204173204 +0100 +++ /var/tmp/diff_new_pack.B91SCv/_new 2019-03-10 09:35:35.204173204 +0100 @@ -1,7 +1,7 @@ # # spec file for package python # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,15 +19,13 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %global sname cotyledon Name: python-%{sname} -Version: 1.7.1 +Version: 1.7.3 Release: 0 Summary: A framework for defining long-running services License: Apache-2.0 Group: Development/Languages/Python URL: https://github.com/sileht/cotyledon Source: https://files.pythonhosted.org/packages/source/c/%{sname}/%{sname}-%{version}.tar.gz -# PATCH-FIX-UPSTREAM: https://github.com/sileht/cotyledon/pull/19 -Patch1: fix_arm.patch BuildRequires: %{python_module mock} BuildRequires: %{python_module oslo.config >= 3.14.0} BuildRequires: %{python_module pytest} @@ -57,7 +55,6 @@ %prep %setup -q -n %{sname}-%{version} -%patch1 -p1 rm tox.ini %build @@ -71,7 +68,7 @@ %check export PYTHONDONTWRITEBYTECODE=1 -%python_expand PYTHONPATH=%{buildroot}%{$python_sitelib} py.test-%{$python_version} -v cotyledon/tests +%pytest cotyledon/tests %files %{python_files} %license LICENSE ++++++ cotyledon-1.7.1.tar.gz -> cotyledon-1.7.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cotyledon-1.7.1/.travis.yml new/cotyledon-1.7.3/.travis.yml --- old/cotyledon-1.7.1/.travis.yml 2018-08-28 11:24:33.000000000 +0200 +++ new/cotyledon-1.7.3/.travis.yml 2018-12-26 12:59:47.000000000 +0100 @@ -1,8 +1,16 @@ -sudo: required -dist: xenial +sudo: false language: python -python: - - 2.7 - - 3.7 +matrix: + include: + - python: 2.7 + - python: 3.7 + dist: xenial + sudo: true +branches: + only: + - master +cache: + - apt + - pip install: pip install tox-travis script: tox diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cotyledon-1.7.1/PKG-INFO new/cotyledon-1.7.3/PKG-INFO --- old/cotyledon-1.7.1/PKG-INFO 2018-08-28 11:26:04.000000000 +0200 +++ new/cotyledon-1.7.3/PKG-INFO 2018-12-26 13:02:14.000000000 +0100 @@ -1,6 +1,6 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: cotyledon -Version: 1.7.1 +Version: 1.7.3 Summary: Cotyledon provides a framework for defining long-running services. Home-page: https://github.com/sileht/cotyledon Author: Mehdi Abaakouk @@ -19,3 +19,6 @@ Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Provides-Extra: test +Provides-Extra: oslo +Provides-Extra: doc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cotyledon-1.7.1/README.rst new/cotyledon-1.7.3/README.rst --- old/cotyledon-1.7.1/README.rst 2018-08-28 11:24:33.000000000 +0200 +++ new/cotyledon-1.7.3/README.rst 2018-12-26 12:59:47.000000000 +0100 @@ -13,9 +13,6 @@ .. image:: https://travis-ci.org/sileht/cotyledon.png?branch=master :target: https://travis-ci.org/sileht/cotyledon -.. image:: https://tea-ci.org/api/badges/sileht/cotyledon/status.svg - :target: https://tea-ci.org/sileht/cotyledon - Cotyledon provides a framework for defining long-running services. It provides handling of Unix signals, spawning of workers, supervision of diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cotyledon-1.7.1/cotyledon/_service_manager.py new/cotyledon-1.7.3/cotyledon/_service_manager.py --- old/cotyledon-1.7.1/cotyledon/_service_manager.py 2018-08-28 11:24:33.000000000 +0200 +++ new/cotyledon-1.7.3/cotyledon/_service_manager.py 2018-12-26 12:59:47.000000000 +0100 @@ -117,6 +117,7 @@ 'terminate': [], 'reload': [], 'new_worker': [], + 'dead_worker': [], } _utils.setproctitle("%s: master process [%s]" % @@ -135,7 +136,7 @@ signal.signal(signal.SIGCHLD, self._signal_catcher) def register_hooks(self, on_terminate=None, on_reload=None, - on_new_worker=None): + on_new_worker=None, on_dead_worker=None): """Register hook methods This can be callable multiple times to add more hooks, hooks are @@ -149,6 +150,8 @@ :param on_new_worker: method called in the child process when this one is ready :type on_new_worker: callable(service_id, worker_id, service_obj) + :param on_new_worker: method called when a child died + :type on_new_worker: callable(service_id, worker_id, exit_code) If window support is planned, hooks callable must support to be pickle.pickle(). See CPython multiprocessing module documentation @@ -164,6 +167,9 @@ if on_new_worker is not None: _utils.check_callable(on_new_worker, 'on_new_worker') self._hooks['new_worker'].append(on_new_worker) + if on_dead_worker is not None: + _utils.check_callable(on_dead_worker, 'on_dead_worker') + self._hooks['dead_worker'].append(on_dead_worker) def _run_hooks(self, name, *args, **kwargs): _utils.run_hooks(name, self._hooks[name], *args, **kwargs) @@ -227,16 +233,13 @@ self._got_sig_chld.wait() self._got_sig_chld.clear() - if self._dead.is_set(): - return - info = self._get_last_worker_died() while info is not None: + if self._dead.is_set(): + return service_id, worker_id = info self._start_worker(service_id, worker_id) info = self._get_last_worker_died() - if self._dead.is_set(): - return self._adjust_workers() @@ -269,6 +272,11 @@ os.killpg(0, signal.SIGHUP) signal.signal(signal.SIGHUP, self._signal_catcher) + def shutdown(self): + LOG.info("Manager shutdown requested") + os.kill(os.getpid(), signal.SIGTERM) + self._dead.wait() + def _shutdown(self): LOG.info('Caught SIGTERM signal, graceful exiting of master process') signal.signal(signal.SIGTERM, signal.SIG_IGN) @@ -285,6 +293,12 @@ self._got_sig_chld.set() self._child_supervisor.join() + # NOTE(sileht): During startup if we receive SIGTERM, python + # multiprocess may fork the process after we send the killpg(0) + # To workaround the issue we sleep a bit, so multiprocess can finish + # its work. + time.sleep(0.1) + self._run_hooks('terminate') LOG.debug("Killing services with signal SIGTERM") @@ -323,6 +337,8 @@ processes = list(self._running_services[service_id].items()) for process, worker_id in processes: if not process.is_alive(): + self._run_hooks('dead_worker', service_id, worker_id, + process.exitcode) if process.exitcode < 0: sig = _utils.signal_to_name(process.exitcode) LOG.info('Child %(pid)d killed by signal %(sig)s', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cotyledon-1.7.1/cotyledon/tests/examples.py new/cotyledon-1.7.3/cotyledon/tests/examples.py --- old/cotyledon-1.7.1/cotyledon/tests/examples.py 2018-08-28 11:24:33.000000000 +0200 +++ new/cotyledon-1.7.3/cotyledon/tests/examples.py 2018-12-26 12:59:47.000000000 +0100 @@ -142,5 +142,31 @@ p.run() +def exit_on_special_child_app(): + p = cotyledon.ServiceManager() + sid = p.add(LigthService, 1) + p.add(FullService, 2) + + def on_dead_worker(service_id, worker_id, exit_code): + # Shutdown everybody if LigthService died + if service_id == sid: + p.shutdown() + + p.register_hooks(on_dead_worker=on_dead_worker) + p.run() + + +def sigterm_during_init(): + + def kill(): + os.kill(os.getpid(), signal.SIGTERM) + + # Kill in 0.01 sec + threading.Timer(0.01, kill).start() + p = cotyledon.ServiceManager() + p.add(LigthService, 10) + p.run() + + if __name__ == '__main__': globals()[sys.argv[1]]() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cotyledon-1.7.1/cotyledon/tests/test_functional.py new/cotyledon-1.7.3/cotyledon/tests/test_functional.py --- old/cotyledon-1.7.1/cotyledon/tests/test_functional.py 2018-08-28 11:24:33.000000000 +0200 +++ new/cotyledon-1.7.3/cotyledon/tests/test_functional.py 2018-12-26 12:59:47.000000000 +0100 @@ -105,8 +105,8 @@ @staticmethod def hide_pids(lines): - return [re.sub(b"Child \d+", b"Child XXXX", - re.sub(b" \[[^\]]*\]", b" [XXXX]", line)) + return [re.sub(b"Child \\d+", b"Child XXXX", + re.sub(b" \\[[^\\]]*\\]", b" [XXXX]", line)) for line in lines] @staticmethod @@ -341,9 +341,9 @@ @unittest.skipIf(os.name != 'posix', 'no posix support') def test_badly_coded(self): - time.sleep(0.5) + time.sleep(2) self.subp.terminate() - time.sleep(0.5) + time.sleep(2) self.assertEqual(0, self.subp.poll(), self.get_lines()) self.assertFalse(pid_exists(self.subp.pid)) @@ -405,3 +405,12 @@ b'DEBUG:cotyledon.oslo_config_glue:Full set of CONF:', lines) self.subp.terminate() + + +class TestTermDuringStartupCotyledon(Base): + name = 'sigterm_during_init' + + def test_sigterm(self): + lines = self.hide_pids(self.get_lines()) + self.assertIn(b'DEBUG:cotyledon._service_manager:Shutdown finish', + lines) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cotyledon-1.7.1/cotyledon.egg-info/PKG-INFO new/cotyledon-1.7.3/cotyledon.egg-info/PKG-INFO --- old/cotyledon-1.7.1/cotyledon.egg-info/PKG-INFO 2018-08-28 11:26:01.000000000 +0200 +++ new/cotyledon-1.7.3/cotyledon.egg-info/PKG-INFO 2018-12-26 13:02:14.000000000 +0100 @@ -1,6 +1,6 @@ -Metadata-Version: 1.1 +Metadata-Version: 2.1 Name: cotyledon -Version: 1.7.1 +Version: 1.7.3 Summary: Cotyledon provides a framework for defining long-running services. Home-page: https://github.com/sileht/cotyledon Author: Mehdi Abaakouk @@ -19,3 +19,6 @@ Classifier: Programming Language :: Python :: 3.5 Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 +Provides-Extra: test +Provides-Extra: oslo +Provides-Extra: doc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cotyledon-1.7.1/cotyledon.egg-info/requires.txt new/cotyledon-1.7.3/cotyledon.egg-info/requires.txt --- old/cotyledon-1.7.1/cotyledon.egg-info/requires.txt 2018-08-28 11:26:01.000000000 +0200 +++ new/cotyledon-1.7.3/cotyledon.egg-info/requires.txt 2018-12-26 13:02:14.000000000 +0100 @@ -1,11 +1,13 @@ -setproctitle; sys_platform != 'win32' + +[:sys_platform != "win32"] +setproctitle [doc] sphinx_rtd_theme sphinx [oslo] -oslo.config>=3.14.0 # Apache-2.0 +oslo.config>=3.14.0 [test] mock diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cotyledon-1.7.1/release.sh new/cotyledon-1.7.3/release.sh --- old/cotyledon-1.7.1/release.sh 2018-08-28 11:24:33.000000000 +0200 +++ new/cotyledon-1.7.3/release.sh 2018-11-28 12:22:24.000000000 +0100 @@ -9,7 +9,7 @@ status=$(git status -sz) [ -z "$status" ] || false git checkout master -tox -epy35,py27,pep8 +tox -epy37,py27,pep8 git push git tag -s $version -m "Release version ${version}" git checkout $version diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/cotyledon-1.7.1/tox.ini new/cotyledon-1.7.3/tox.ini --- old/cotyledon-1.7.1/tox.ini 2018-08-28 11:24:33.000000000 +0200 +++ new/cotyledon-1.7.3/tox.ini 2018-12-26 12:59:47.000000000 +0100 @@ -48,4 +48,4 @@ [travis] python = - 3.7: py37, pep8, cover, docs + 3.7: py37, pep8, docs