dwavesystems / dwave-inspector

D-Wave Problem Inspector
https://docs.ocean.dwavesys.com/projects/inspector/
Apache License 2.0
7 stars 15 forks source link

Add support for Jupyter notebook #109

Closed randomir closed 1 year ago

randomir commented 3 years ago

Currently, we open the inspector app in a browser window.

To support dwave.inspector.show() from a Jupyter notebook, we need to display the inspector app inline.

ccalaza commented 2 years ago

Hi randomir,

at Forschungszentrum Juelich we want to give access to our Advantage device through JUNIQ-Cloud, a hosted JupyterHub interface. Because it's a Jupyter environment we cannot launch the inspector (as you already know), and because it's hosted we can't really work around it by connecting to the local server like shown here: https://support.dwavesys.com/hc/en-us/community/posts/1500001137721/comments/1500001069222

We find the inspector to be a very useful tool in some scenarios and as things stand right now we can't really make use of it...

Do you know any other workarounds we could use for the time being?

And do you think it would be possible to implement this feature at some point?

Many thanks in advance, Carlos

randomir commented 2 years ago

Hi @ccalaza,

This is becoming a popular feature request, it seems. We'll prioritize it. Thanks!

Currently I can't think of a workaround for your use case. Long term, something like #132 would help, but that's not available yet.

ccalaza commented 2 years ago

That's great to hear, thanks a lot!

rogdesousa commented 2 years ago

Hi all, I teach D-Wave Leap in my UVic course P223 Introductory Quantum Computing , and we use Jupyter notebooks. We need Jupyter because it's much easier to grade students' assignments and share work. It would be fantastic if D-Wave would allow the problem inspector to run on Jupyter! Right now the students can not use inspector. Thanks. Rogério

ccalaza commented 1 year ago

Hi @randomir,

is there any progress getting the inpector to display inline? We have been getting more requests from our JUNIQ users to make the inspector available through our portal.

Do you know how this is done in Leap for example? Maybe we could implement sth similar on our side.

X Carlos

randomir commented 1 year ago

Hey @ccalaza, thank you for pointing out the significance of this feature to you. We started working on it, and the support for the Inspector in local Jupyter notebooks, including environments like VSCode should be available within a week.

However, your use case is a bit more specific. It's similar to Leap IDE, but specific to your JUNIQ-Cloud.

In Leap IDE, the inspector interface is served from within the workspace, bound to workspace's container localhost. However, we expose that port via proxy on an externally available https endpoint -- which then in turn can be accessed from user's machine (UA). Do you have a similar mechanism in place in your JUNIQ-Cloud that could be leveraged?

ccalaza commented 1 year ago

Hi @randomir!

Yes, we do have such a mechanism. We have just figured out earlier today that we are missing this url translation for the inspector to work behind a http-configurable proxy like the one we have at JUNIQ.

In our case we translate the url like this: https://jupyter-server-proxy.readthedocs.io/en/latest/arbitrary-ports-hosts.html#with-jupyterhub

randomir commented 1 year ago

Hey @ccalaza, that sounds great because it's not specific to your environment -- I can build in the support for it, if you'd like. Or you prefer to do it yourselves?

ccalaza commented 1 year ago

It would be great if you could add this feature, otherwise I think we would need to maintain a modified version of the inspector from now on and this could end up being problematic...

randomir commented 1 year ago

@ccalaza, local Jupyter support is added in #140 (please feel free to test it!), and proxy support will be implemented with #141.