Skip to content

Allow configure orca to send requests to remote server #1570

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

Closed
cooperok opened this issue May 20, 2019 · 4 comments
Closed

Allow configure orca to send requests to remote server #1570

cooperok opened this issue May 20, 2019 · 4 comments

Comments

@cooperok
Copy link

According to code static image export will work only if orca is installed on same server as plotly.py

server_url = 'http://{hostname}:{port}'.format(hostname='localhost', port=orca_state['port'])

But, there is an option to run orca as standalone server. Would be greate if param hostname can be specified in options same as port.

My case is that I have Google App Engine application, and it's problematic to install orca. So I want to set up standalone image server and still use plotly to get images like plotly.io.to_image(...)

@jonmmease
Copy link
Contributor

Hi @cooperok, yes this is a great idea.
Happy to help someone through a PR on this if anyone is interested in tackling this.

I think we could probably add a plotly.io.orca.config.server_url parameter. Setting this would then unset (or override) the executable, port, and timeout, mathjax, topojson, and mapbox_access_token properties.

@maresb
Copy link
Contributor

maresb commented Jul 23, 2019

For a quick-and-dirty workaround to specify a custom hostname, I found the following two possibilities.

  1. If you are able to edit the source code, then edit _orca.py and manually set the desired hostname and port in the server_url = command. Since we won't be using the orca executable, at the end of _orca.py add the line ensure_server = lambda: None to disable the corresponding checks. (This sets ensure_server to the do-nothing function.)

  2. If for some reason you are unable or unwilling to edit the plotly.py source code, then on the machine running plotly.py, run the command

     socat tcp-listen:9091,reuseaddr,fork,bind=127.0.0.1 tcp:orca-host:9091
    

    where orca-host is the hostname of the orca server. This creates a tunnel to access orca-host from localhost of the machine running plotly.py, using the default port 9091. Finally, import plotly.io with the following extra commands:

     import plotly.io as pio
     pio._orca.ensure_server = lambda: None
     pio._orca.orca_state["port"] = 9091
    

With either of these techniques, I can set up docker-compose to run Jupyter + plotly.py, and orca.

@miriad
Copy link
Contributor

miriad commented Oct 31, 2019

@jonmmease , Any chance you could review the PR on this?

@jonmmease
Copy link
Contributor

done in #1850

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

4 participants