Cannot get cell execution time from Jupyter API?

Hello everyone,

Do you know why we cannot get cell execution time from Jupyter API?
I have looked into :

https://jupyter-notebook.readthedocs.io/en/stable/extending/contents.html

But could not find the solution.

We would like to access it to monitor time spent running at a notebook/kernel/cell level for our project.

Thanks a lot in advance.
J.

The contents api is pretty much unaware of what the kernel api is doing… about the only thing it could do would be to read off whatever a client (e.g. jupyterlab) claims in notebook metadata.

Are you trying to measure:

  • the time from “press run” to “get pixels on screen”?
  • the time the message spent in-flight to the server?
  • the time the message spent in-flight between the server and the kernel?
  • the actual execution time from execute_request being received to execute_response or idle or whatever comes back?
  • the return trip?
  • whatever the client claims?

Depending on how precise need it to be, you’d likely need to investigate where your notebook/jupyter_server is actually passing messages, or instrument the kernel itself. There are also some tools in the opencensus (e.g. GitHub - Quansight/jupyter-jaeger: @jupyter integration for @jaegertracing) realm that might work.

2 Likes

@bollwyvl Thanks a lot for the valuable feedback.

We try to measure cell execution time that the human sees so I guess : “he time from “press run” to “get pixels on screen”?” is the answer.

Will investigate more with the tools you provided. Thanks again.

1 Like