Closed yjmade closed 5 years ago
Oh man, I've wanted this for a long while :)
Oh man, I've wanted this for a long while :)
Let's hope the author can review and merge it.
Ping @jiffyclub ?
On Mon, Jan 7, 2019 at 8:20 PM Jay Young notifications@github.com wrote:
Oh man, I've wanted this for a long while :)
Let's hope the author can review and merge it.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jiffyclub/snakeviz/pull/110#issuecomment-452170558, or mute the thread https://github.com/notifications/unsubscribe-auth/AASszMps2rQYLPFnkAAeG0ZAbkdGsskvks5vBBycgaJpZM4SzFBI .
Sorry for letting this sit so long, thanks for the PR! Couple small comments, but otherwise looks reasonable!
@jiffyclub all concern has been resolved. And also I improved a little by instead of sleep 0.5 seconds after start the snakeviz deamon, it now check the stdout and wait until it see the snakeviz is ready, then send the html to browser. By this way it solved the problem that sometimes notebook shows connection refused.
I tested this out and it works great! I think it would be nice to add an option to the %snakeviz
magic to control whether the page ends up embedded or in a new tab, just in case people want the choice. (On my laptop, for example, the embedded visualization is pretty cramped since the Notebook doesn't use the full width of my browser.)
I looked into the best way to do this and I think we'd have to refactor the magic in the form of something like the %prun
magic so we could access the self.parse_options
method of the Magics
class. I'm happy to take this on if its ok with you.
@yjmade I made a new PR adding a flag to allow users to control whether snakeviz is embedded in the notebook, please check it out in #121. Thanks!
I like the idea of giving user control. But the former new tab way will mostly not work, because most use of Jupyter notebook (in my experience), the browser and the daemon is not in the same machine, the snakeviz cli open the browser by invoke the browser command in the daemon's host but not the client's.
Check if %snakeviz magic is running in jupyter notebook, then embed the visualization inside the notebook as a html cell #59 #88