Skip to content

Draft: Flint: Spy helper for Flint

Valentin Valls requested to merge spy-flint into master

This MR provides an helper on top of py-spy in order to check stack and process sample profiling of Flint.

The power of this approach, thanks py-spy is no be totally decoupled from the code we introspect. With that, there is no more need of Flint side watchdog, which is a bunch of complex code mostly unused, which could be removed.

Can be tested the following way.

The helper is just a simplified access for BLISS end users. It is not needed to use py-spy.

Setup the env

conda install py-psy

Monitoring

SCAN_DISPLAY.spy_flint_if_stucked = True
SCAN_DISPLAY.spy_log_root = "/tmp"

import gevent
f = flint()

with gevent.Timeout(2):
    f.test_infinit_loop()

This will log stuffs autonatically

WARNING 2022-03-25 15:34:35,640 flint: Spy profiling saved at: /tmp/flint_spy_2022-03-25_15:34:30.970048.txt
WARNING 2022-03-25 15:34:40,994 flint: Spy profiling saved at: /tmp/flint_spy_2022-03-25_15:34:35.640616.txt

Manual

from bliss.flint.client.proxy import get_flint;
f = get_flint(proxy=True);
f.spy("dump")         # print the actual Flint stack

# or

f.spy("raw")          # profiling in txt file

# or

f.spy("flamegraph")   # profiling as svg file
Edited by Valentin Valls

Merge request reports