Skip to content
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

Not able to run Dtale on root url #805

Closed
go-kool opened this issue Sep 21, 2023 · 10 comments
Closed

Not able to run Dtale on root url #805

go-kool opened this issue Sep 21, 2023 · 10 comments

Comments

@go-kool
Copy link

go-kool commented Sep 21, 2023

Hi Team,

We have a requirement to run the multiple Dtale serives in one docker container. So we are planning to run each dtale service with a unique app-root and port. Below is my code looks like.

import dtale
import pandas as pd
d = dtale.show(pd.DataFrame([1,2,3,4,5]),host='localhost',app_root="/satya",port="40000")
d._main_url

d1 = dtale.show(pd.DataFrame([1,2,3,4,5]),host='localhost',app_root="/test",port="40001")
d1._main_url

Below is the error we are getting when accessing the dtale url.
image

we are not sure if this is an issue or not. Please suggest us if we need to make any changes.

@aschonfeld
Copy link
Collaborator

aschonfeld commented Sep 21, 2023

So app_root is something that is meant to be used when serving D-Tale up within jupyerhub. There is a server proxy that opens up all flask routes using a different URL path.

I can try seeing if I can make use of Flask's url_prefix parameter, but honestly your best bet is to do something like using different ports (i think you just need to open both ports in your docker configuration):

import dtale
import pandas as pd
d = dtale.show(pd.DataFrame([1,2,3,4,5]),host='localhost', port="40000")
d._main_url

d1 = dtale.show(pd.DataFrame([1,2,3,4,5]),host='localhost', port="40001")
d1._main_url

Or you can apply names to your data:

import dtale
import pandas as pd
d = dtale.show(pd.DataFrame([1,2,3,4,5]),host='localhost', name="satya")
d._main_url  # http://localhost:40000/dtale/main/satya

d1 = dtale.show(pd.DataFrame([1,2,3,4,5]),host='localhost', name="test", ignore_duplicate=True)
d1._main_url  # http://localhost:40000/dtale/main/test

@go-kool
Copy link
Author

go-kool commented Sep 22, 2023

Thanks for the suggestion @aschonfeld its really helpfull, I tried giving names to data and its working good. But i getting some Bad request
errors in my jupyter notebook continuously, however I am able to access the Dtale with the urls below.
http://localhost:40000/dtale/main/satya
http://localhost:40000/dtale/main/test

Is there any way we can do this without errors ?
image

@aschonfeld
Copy link
Collaborator

Are you hitting the D-Tale URLs from https? I've never seen that error and the only thing I can find about it is when someone tries to hit a flask endpoint from https that is only setup for http: https://stackoverflow.com/questions/58902838/python-flask-error-code-400-message-bad-request-version

@go-kool
Copy link
Author

go-kool commented Sep 22, 2023

@aschonfeld I getting the error as soon as I run the second cell attached in the above screenshot. I am accessing it on http.

@aschonfeld
Copy link
Collaborator

So I was able to run your code in a jupyter notebook with no issue. Is your notebook running under HTTPS?

@go-kool
Copy link
Author

go-kool commented Sep 24, 2023

@aschonfeld Yes, Its running inside Kubenertes clusters and exposed using ingress on Https

@aschonfeld
Copy link
Collaborator

ok then thats the problem. Do you have to use HTTPS?

@nandinibalusu978
Copy link

@aschonfeld Yes, We need to run our service on https only

@aschonfeld
Copy link
Collaborator

So what I plan on doing is exposing the ability to specify an ssl_context when starting up the flask process invoked by dtale.show. This way you can call something like dtale.show(..., ssl_context="adhoc") and it should allow you to use HTTPS.

I'll keep you posted about when this change gets released

@aschonfeld
Copy link
Collaborator

@go-kool @nandinibalusu978 just released v3.6.0 to pypi (should be on conda-forge soon) with this fix included.

Also, if you haven't already, please put your ⭐ on the repo when you get a sec. Thanks! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants