Thanks Min, this is very helpful. So I think our plan now is to monkeypatch 
the client side CodeCell.execute() and change the contents to send across 
metadata as well, then have our kernel wrapper deserialize this an extra 
data before passing things to the stock ipython kernel. Hacky, but would 
get us a proof of concept. If this seems to work for our use case, we'll 
consider submission criteria for lab once it's out!

Appreciate the deep link to the code, made this quick on our end!

Chris

On Monday, September 25, 2017 at 4:57:02 AM UTC-4, Min RK wrote:
>
> This is certainly *technically* possible because there is a metadata 
> field in the messages. However, it may be tricky to pluck the metadata from 
> the cell and add it to the request, given the current APIs.
>
> The cell submits the execution here 
> <https://github.com/jupyter/notebook/blob/5.1.0/notebook/static/notebook/js/codecell.js#L343>
>  
> and there’s no clear way to override that to add additional arguments. 
> Similarly, kernel.execute 
> <https://github.com/jupyter/notebook/blob/5.1.0/notebook/static/services/kernels/kernel.js#L726>
>  
> doesn’t expose the metadata field as an argument.
>
> So I’d say that the ‘real’ fix is to:
>
>    1. expose metadata args in the kernel API (especially execute, but all 
>    message-sending methods should support it) 
>    2. allow passing metadata to execute somehow in the CodeCell API 
>
> You might be able to work around the current state with some finagling, 
> but it will probably be difficult to do it in a reliable way without some 
> support from the API. Perhaps jupyterlab has better support for the 
> metadata field that would make this easier.
>
> -Min
> ​
>
> On Sun, Sep 24, 2017 at 6:50 PM, Christopher Brooks <[email protected] 
> <javascript:>> wrote:
>
>> Hi,
>>
>> We've created our own kernel wrapper which just calls the regular python 
>> kernel but does some logging. I'd like to log some cell metadata as well, 
>> but it doesn't look like this is being passed on the wire (at least, not 
>> from my digging with the chrome dev tools). Is there a way to configure the 
>> jupyter frontend to pass this metadata across to the kernel? If not 
>> configure, suggestions on what methods we might need to overwrite in the 
>> front end to achieve this? Could a client side extension handle this, or do 
>> we have to do more significant surgery?
>>
>> Regards,
>>
>> Chris
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Project Jupyter" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jupyter/a8bb9619-7c9d-4c08-aa68-f5cd16a5f382%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/jupyter/a8bb9619-7c9d-4c08-aa68-f5cd16a5f382%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jupyter/78324d91-6e5a-4282-8955-1e5287386c6a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to