-
-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add execution start and end time metadata for code cells #29
Add execution start and end time metadata for code cells #29
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 I think we would want to add a test, for example see:
async def test_post_execute(jp_fetch, pending_kernel_is_ready, snippet, output): |
since the exact timestamp will vary I would just check that the timing metadata is present and that the end time is greater than start time.
jupyter_server_nbmodel/handlers.py
Outdated
|
||
if metadata["record_timing"]: | ||
time_info = ycell["metadata"].get("execution",{}) | ||
time_info["start_time"] = datetime.now(timezone.utc).isoformat()[:-6] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the metadata I think we will want to match the exact identifiers as used on the frontend, so instead of start_time
we would use shell.execute_reply.started
and for end time - shell.execute_reply
- although these are less readable, it would make jupyter-server-nbmodel
a drop-in replacement and compatible with existing extensions like jupyterlab-execute-time
.
There also should be execution_failed
for when the execution fails.
For testing whether the metadata is being added correctly, we would need to pass Can we somehow create dummy ydoc and metadata and pass it instead or do we have some other better way to do this? |
You can change config to something like: "ServerApp": {
"jpserver_extensions": {
"jupyter_server_ydoc": True,
"jupyter_server_nbmodel": True,
"jupyter_server_fileid": True, # from jupyter_server_ydoc
},
"token": "", # not sure if needed
"disable_check_xsrf": True, # not sure if needed
}, in jupyter-server-nbmodel/conftest.py Lines 3 to 12 in ef8181c
to enable jupyter-server-nbmodel/jupyter_server_nbmodel/extension.py Lines 11 to 25 in ef8181c
You may also need to create a real collaborative notebook, for that purpose add
Is this the same as we are sending from frontend? If so you should be able to populate it with |
This CI error seems similar to the one described in the jupyterlab/jupyter-collaboration#252. |
I think these are warnings, so I would not be too worried. I would focus on fixing
|
It looks like the real problem is the timeout (you can see it if you scroll up):
It seems that it is stalling in the |
It looks like The tests are also failing on the
|
It looks like the relation is with number of tests and the teardown sequence. It seems that the kernel workers are not being properly terminated, but even adding manual call to |
It seems that this is tracked in #16. Indeed running tests individually works. |
Cell Execution Event has been implemented. This allows extensions to listen for the event and perform actions, such as notifying users when a cell execution is completed. Could you please review it? Once everything is finalized, we can add tests and documentation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done @Darshan808
I have a request to remove a duplicate code and a question about the timing. Otherwise this looks good to me.
Thanks for the suggestion @fcollonval, I applied the changes. Let me know if there are any other improvements to make! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally against jupyterlab-execute-time
- worked nicely on the first run! I noticed two issues:
- schedule time is not recorded (I opened Support timing indicating when cell execution got scheduled #30 to track this) - let's tackle it separately
- the
execute
metadata is never cleared, meaning that old and new timings get mixed up - this should be fixed here before we merge and release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good from my side, thank you @Darshan808!
@fcollonval good to merge?
Now that the ability for extensions to listen to cell execution events has been implemented, should we enhance a pre-built extension to add this notification functionality, or should we create a new extension like "jupyter-notifier"? |
No, there is too many opinionated choices to make. There are already a few extensions for notifications, once this PR gets released we can implement server-side triggered notifications in one of them :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks you both for this
References #22
Screenshots