Introduced changes:
- pre-commit config and rules
- Add pre-commit to pep8 gate, Flake8 is covered in the pre-commit hooks.
- Applying fixes for pre-commit compliance in all code.
Also commit hash will be used instead of version tags in pre-commit to
prevend arbitrary code from running in developer's machines.
pre-commit will be used to:
- trailing whitespace;
- Replaces or checks mixed line ending (mixed-line-ending);
- Forbid files which have a UTF-8 byte-order marker
(check-byte-order-marker);
- Checks that non-binary executables have a proper
shebang (check-executables-have-shebangs);
- Check for files that contain merge conflict strings
(check-merge-conflict);
- Check for debugger imports and py37+ breakpoint()
calls in python source (debug-statements);
- Attempts to load all yaml files to verify syntax (check-yaml);
- Run flake8 checks (flake8) (local)
For further details about tests please refer to:
https://github.com/pre-commit/pre-commit-hooks
Change-Id: Ib18f38dbec90c62e870307bf22a8b4f193237bce
Signed-off-by: Moisés Guimarães de Medeiros <moguimar@redhat.com>
Switch to openstackdocstheme 2.2.0 and reno 3.1.0 versions. Using
these versions will allow especially:
* Linking from HTML to PDF document
* Allow parallel building of documents
* Fix some rendering
Update Sphinx version as well.
Remove docs requirements from lower-constraints, they are not needed
during install or test but only for docs building.
openstackdocstheme renames some variables, so follow the renames
before the next release removes them. A couple of variables are also
not needed anymore, remove them.
Set openstackdocs_auto_name to use 'project' as name.
Depends-On: https://review.opendev.org/728938
Change-Id: I4f21de08de3bfd89bf8e331b6c819932cde8ca2f
This repo is now testing only with Python 3, so let's make
a few cleanups:
- Remove obsolete sections from setup.cfg
- Update classifiers
- Cleanup doc/source/conf.py to remove now obsolete content.
- Use newer openstackdocstheme version
Change-Id: I2c59ca525fa329b91720149cff3faee00fafff97
Sphinx 1.8 introduced [1] the '--keep-going' argument which, as its name
suggests, keeps the build running when it encounters non-fatal errors.
This is exceptionally useful in avoiding a continuous edit-build loop
when undertaking large doc reworks where multiple errors may be
introduced.
[1] https://github.com/sphinx-doc/sphinx/commit/e3483e9b045
Change-Id: I7b4cc4b171e5605f2967378e9949d31ac0e1290c
- Use some more :roles: to make more things linky.
- Add some ``decoration`` around literals.
- Fix up some grammar.
Change-Id: I6b51a8774e502a34757a50aef5f4bc1fb37d8b96
It seems that the code for handling SIGHUP currently calls stop()
on the service, then calls reset(), then calls start() on it again.
This is effectively a full service restart, which breaks the whole
point behind using SIGHUP for hot and quick reloads. It also breaks
our downstream projects in a few ways where they lose RPC on reload
due to the fact that they don't expect to have stop() called on a
reset().
This patch removes the stop and start when the restart_method is
set to 'mutate' because in that case we should just be signaling
the service to check for changes in its mutable config options.
It also changes the signal sent to children in that case to
SIGHUP, since SIGTERM will cause unnecessary restarts of child
processes.
The previous behavior is maintained for the 'reload' restart_method
since that does a complete reload of the service config, which is
not safe to do without restarting the service completely.
Change-Id: I86a34c22d41d87a9cce2d4ac6d95562d05823ecf
Closes-Bug: #1794708
Co-Authored-By: Ben Nemec <bnemec@redhat.com>
This patch enables profiling (capturing function call trace like
cProfile [1]) worker processes on the fly while service is running.
User requests the oslo service process to start profiling by writing
"prof()" command to backdoor socket, once the service (like
neutron-server) finishes expected processing (example finishing API
call), user again writes "prof()" command with file name as argument
to dump the function calltrace stats. Stats file (in pstat format
with user provided filename by adding .prof) will be generated in
temp directory.
For example, to profile neutron server process,
1) echo "prof()" | nc localhost 8002
2) Issue neutron command (or run rally scenarios tests)
neutron net-create n1
neutron port-create --name p1 n1
neutron port-delete p1
neutron net-delete n1
3) echo "prof('neutron')" | nc localhost 8002
where 8002 is the port which we set like below in neutron.conf
backdoor_port=8002
We can later print the stats from the trace file like below
stats = pstats.Stats('/tmp/neutron.prof')
stats.print_stats()
The trace file will look like in (for above neutron API calls) [2].
We use Yappi with context set to greenlet [3] to profile greenlets.
We can't use GreenletProfiler [4], which does the same [5]
1) as it is no more maintained
2) Also compiling yappi source inside GreenletProfiler is failing for
python3.
[1] https://docs.python.org/2/library/profile.html
[2] https://gist.github.com/venkataanil/64d5e672bf0206dc151e73fc1058a983
[3] https://bitbucket.org/sumerc/yappi/pull-requests/3
[4] https://pypi.org/project/GreenletProfiler/
[5] https://emptysqua.re/blog/greenletprofiler/
Depends-On: Ibea0cdb732923f1b53d5cb6aeeb4041fb5973494
Change-Id: Id2418093494f1e233a653f6c73bd6894e4a40184
Consumers of loopingcall may wish to exercise their code in test cases
without incurring actual wall clock sleep time in their test runs.
Heretofore, this required digging into the internals of the loopingcall
module and mocking something private (or something hidden by something
private).
This patch exposes a public oslo_service.fixture.SleepFixture for this
purpose. It can be maintained opaquely as internals change without
affecting its consumers.
See [1] for (one example of) the motivation behind this change.
[1] https://review.openstack.org/#/c/615724/
Change-Id: I0089c7778957456db66599abffaaad3a5332243c
Fixes a bunch of long lines and ensures that doc8
will not complain about any future issues by adding it
to the commands performed during running the py27 tox
environment.
Change-Id: I9ae2f2a05a408dbfe105bf38ea0ae235701fbe0e
Change I3e7264a1efcbf66a9afc69d8ed20f600c985c296 chenged behavior of
services when they receive SIGHUP. This needs to be documented.
Change-Id: I5a8de19ba4d7a5e2b27d88da8668f6171b7b2112
This seems to better match what the other oslo
libraries are calling this section, so we might as
well call it that to.
Change-Id: I4121c980e586233b12d582085a66625dd62b87e7
Expand the description of the library in the README and the introduction
in the sphinx documentation.
Change-Id: Iab72b27f37e589eaaf354b93271d366285b97f71
Add automatically generated documentation for the configuration options
using oslo_config.sphinxext.
Change-Id: Ie698129e855dd35b2d0a4a1be625c2137f15f5e7
Because of copy-pasted wsgi functionality in projects(nova, cinder,
glance, etc.) it is added to oslo.service with perspective to remove
it from other projects.
DocImpact
Change-Id: If8840168f10cc3561f4f01e6d456d6b4fd1de8b5
* Add SIGINT to the list of handled signals.
* Add a note that SIGHUP is not supported on Windows.
Change-Id: I90a1b422e00a5d2978e74f3798e17d58a58572bc
Related-Bug: #1481607
This change adds description of various ways of launching a service
and provides information on supported signals.
Description of launcher classes is moved from oslo_service.service.py
to usage.rst
Change-Id: I7b6a5337de4c25ad16bd33be48daa8ef8bf3b6f5
Describe the entry points of the oslo.service library for the oslo.config generator.
Change-Id: I88016e24bd982bfe56c5eb7f9528eb8acbb73a14
Closes-Bug: 1469066
Updated library's description in README.rst with one that is used
on Launchpad and PyPi.
Added API documentation for oslo_serive modules.
Updated usage documentation with information with the adoption
guidelines.
DocImpact
bp graduate-oslo-service
Change-Id: I4beaf30f47fb007b311e5a45ed7953c0f8df97c3