Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mitogen
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
mitogen
Commits
8e2b07a5
Commit
8e2b07a5
authored
Mar 16, 2018
by
David Wilson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
issue #139: add profiling=True option to mitogen.main().
parent
017e8105
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
mitogen/__init__.py
mitogen/__init__.py
+11
-2
No files found.
mitogen/__init__.py
View file @
8e2b07a5
...
...
@@ -66,7 +66,7 @@ parent_id = None
parent_ids
=
[]
def
main
(
log_level
=
'INFO'
):
def
main
(
log_level
=
'INFO'
,
profiling
=
False
):
"""
Convenience decorator primarily useful for writing discardable test
scripts.
...
...
@@ -81,6 +81,13 @@ def main(log_level='INFO'):
Logging package level to configure via
:py:func:`mitogen.utils.log_to_file`.
:param bool profiling:
If :py:data:`True`, equivalent to setting
:py:attr:`mitogen.master.Router.profiling` prior to router
construction. This causes ``/tmp`` files to be created everywhere at
the end of a successful run with :py:mod:`cProfile` output for every
thread.
Example:
::
...
...
@@ -101,7 +108,9 @@ def main(log_level='INFO'):
def
wrapper
(
func
):
if
func
.
__module__
!=
'__main__'
:
return
func
from
mitogen
import
utils
import
mitogen.master
import
mitogen.utils
mitogen
.
master
.
Router
.
profiling
=
profiling
utils
.
log_to_file
(
level
=
log_level
)
return
utils
.
run_with_router
(
func
)
return
wrapper
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment