Skip to content

Commit

Permalink
Added master_process.set_exception_handling_params.
Browse files Browse the repository at this point in the history
  • Loading branch information
idlesign committed Oct 29, 2017
1 parent be34470 commit 3f8a408
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ uwsgiconf changelog

Unreleased
----------
+ Added 'master_process.set_exception_handling_params'.
+ Added 'master_process.set_exception_handling_params'.
+ Added 'master_process.set_exception_handling_params'.
+ Added 'master_process.set_exception_handling_params'.
* 'Logging.set_filters' split into 'set_filters' and 'set_requests_filters'.
* Signal.register_handler target now defaults to 'worker'.

Expand Down
4 changes: 4 additions & 0 deletions tests/options/test_master_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ def test_master_process_basics(assert_lines):
'idle = 10',
], Section().master_process.set_idle_params(timeout=10))

assert_lines([
'catch-exceptions = true',
], Section().master_process.set_exception_handling_params(catch=True))


def test_master_attach_process_classic(assert_lines):

Expand Down
17 changes: 17 additions & 0 deletions uwsgiconf/options/master_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,23 @@ def set_exit_events(self, no_workers=None, idle=None, reload=None, sig_term=None
self._set('die-on-term', sig_term, cast=bool)
self.set_idle_params(exit=idle)

return self._section

def set_exception_handling_params(self, handler=None, catch=None):
"""Do exit on certain events
:param str|unicode|list[str|unicode] handler: Register one or more exception handling C-functions.
:param bool catch: Catch exceptions and report them as http output (including stack trace and env params).
.. warning:: Use only for testing purposes.
"""
self._set('exception-handler', handler, multi=True)
self._set('catch-exceptions', catch, cast=bool)

return self._section

def set_idle_params(self, timeout=None, exit=None):
"""Activate idle mode - put uWSGI in cheap mode after inactivity timeout.
Expand Down

0 comments on commit 3f8a408

Please sign in to comment.