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

Add ability to define custom tornado handler plugins #2752

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

philippjfr
Copy link
Member

@philippjfr philippjfr commented Sep 17, 2021

Allows defining custom Tornado handler plugins via the panel serve CLI.

@philippjfr
Copy link
Member Author

pre-commit.ci autofix

@philippjfr philippjfr changed the title WIP: Add ability to define custom tornado handler plugins Add ability to define custom tornado handler plugins Jan 11, 2023
@codecov
Copy link

codecov bot commented Jan 11, 2023

Codecov Report

Merging #2752 (4167bd1) into main (f8bf150) will increase coverage by 9.08%.
The diff coverage is 38.46%.

@@            Coverage Diff             @@
##             main    #2752      +/-   ##
==========================================
+ Coverage   73.56%   82.65%   +9.08%     
==========================================
  Files         237      237              
  Lines       34292    34366      +74     
==========================================
+ Hits        25228    28405    +3177     
+ Misses       9064     5961    -3103     
Flag Coverage Δ
ui-tests 37.94% <26.92%> (?)
unitexamples-tests 73.86% <38.46%> (+0.29%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
panel/command/serve.py 34.84% <38.46%> (-0.90%) ⬇️
panel/io/reload.py 69.56% <0.00%> (-2.18%) ⬇️
panel/io/cache.py 82.22% <0.00%> (-0.45%) ⬇️
panel/io/server.py 74.95% <0.00%> (-0.19%) ⬇️
panel/config.py 60.10% <0.00%> (-0.11%) ⬇️
panel/tests/test_param.py 99.69% <0.00%> (+0.01%) ⬆️
panel/pane/vtk/synchronizable_serializer.py 77.67% <0.00%> (+0.31%) ⬆️
panel/param.py 86.68% <0.00%> (+0.39%) ⬆️
panel/pane/base.py 87.50% <0.00%> (+0.41%) ⬆️
... and 39 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@MarcSkovMadsen
Copy link
Collaborator

Is it possible to add and remove the handlers dynamically?

How does this compare to the REST API already supported?

Can a user use Async? How? I would probably prefer that.

How to get this to scale? Now you have Panel on web socket where you probable use num-procs and/ or num-threads?

What about oauth? Jwt tokens? Swagger api docs?

Would it be possible and better to build on FastApi?

@philippjfr
Copy link
Member Author

Is it possible to add and remove the handlers dynamically?

Not with this PR no.

How does this compare to the REST API already supported?

This will let you build generic endpoints to do whatever you want unlike the REST functionality which is much more limited.

Can a user use Async? How? I would probably prefer that.

Tornado handler HTTP methods like .get can be synchronous or asynchronous, it's entirely up to you.

How to get this to scale? Now you have Panel on web socket where you probable use num-procs and/ or num-threads?

When using num-procs this endpoint will be duplicated across processes and the requests will be routed just like any other request.

What about oauth? Jwt tokens? Swagger api docs?

If you've enabled authentication adding the @authenticated decorator will put the endpoint behind OAuth.

Would it be possible and better to build on FastApi?

If someone decides to reimplement the entire Bokeh server functionality on top of FastAPI I'd be very happy but I'd estimate that would take me 1-2 months.

plugin_module = importlib.import_module(plugin)
except ModuleNotFoundError:
import pdb
pdb.set_trace()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove

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

Successfully merging this pull request may close these issues.

2 participants