Merge pull request #16022 from edx/jeskew/toxify_edx_platform_testing

Add tox testing to edx-platform.
This commit is contained in:
John Eskew
2017-09-26 11:14:11 -04:00
committed by GitHub
15 changed files with 32 additions and 61 deletions

View File

@@ -1,40 +0,0 @@
"""
Workflows useful for reporting on runtime characteristics of the system
"""
import gc
import os
import signal
import tempfile
from datetime import datetime
from meliae import scanner
def dump_memory(signum, frame):
"""
Dump memory stats for the current process to a temp directory.
Uses the meliae output format.
"""
timestamp = datetime.now().isoformat()
format_str = '{}/meliae.{}.{}.{{}}.dump'.format(
tempfile.gettempdir(),
timestamp,
os.getpid(),
)
scanner.dump_all_objects(format_str.format('pre-gc'))
# force garbarge collection
for gen in xrange(3):
gc.collect(gen)
scanner.dump_all_objects(
format_str.format("gc-gen-{}".format(gen))
)
def install_memory_dumper(dump_signal=signal.SIGPROF):
"""
Install a signal handler on `signal` to dump memory stats for the current process.
"""
signal.signal(dump_signal, dump_memory)