Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

NT-159 correction on default value evaluated #17

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions turbogears/memory_profiler_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class MemoryProfilerState(Enum):
'{}/turbogears_memory_profiler'.format(tempfile.gettempdir()))
TURBOGEARS_PROFILER_FIFO_NAME = os.environ.get('TURBOGEARS_PROFILER_FIFO_NAME', 'turbogears_memory_config_fifo_{}')
TURBOGEARS_PROFILER_LOG_TO_CONSOLE = os.environ.get('TURBOGEARS_PROFILER_LOG_TO_CONSOLE', 'False') == 'True'
TURBOGEARS_PROFILER_ACTIVATE = os.environ.get('TURBOGEARS_PROFILER_ACTIVATE', 'False') == 'True'

# setup thread log handler to monitor state of memory profile logging
thread_log = logging.getLogger("memory_profiler_thread_log")
Expand Down Expand Up @@ -69,8 +70,6 @@ class MemoryProfilerState(Enum):
)




def toggle_memory_profile_via_fifo(_thread_log):
"""
Execution body of a thread that monitors any input on a named pipe located at
Expand Down Expand Up @@ -224,6 +223,10 @@ def _parse_pympler_command(command_args):


def create_config_thread(_thread_log):
if not TURBOGEARS_PROFILER_ACTIVATE:
_thread_log.info("TURBOGEARS_PROFILER deactivated, add TURBOGEARS_PROFILER_ACTIVATE=True "
"to activate it in this environment.")
return None
# start configuration pipe monitoring thread on import
_config_thread = threading.Thread(target=toggle_memory_profile_via_fifo, args=(_thread_log,),
name='toggle_memory_profile_via_fifo')
Expand Down