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

Implement background callbacks #236

Draft
wants to merge 6 commits into
base: dev
Choose a base branch
from

Conversation

BeastyBlacksmith
Copy link
Contributor

I am inclined to try adding support for long callbacks. But some guidance would be greatly appreciated,
I think I can copy most of the logic and structure from the python version, but its not yet clear to me where I can find what the target structure needs to be and how exactly the julia <-> javascript communication works.

For the manging of a cache it would probably make sense to use some julia native caching or should we use the same python cache as in the docs?

@BeastyBlacksmith BeastyBlacksmith changed the title Implement long callbacks Implement background callbacks Apr 3, 2024
@etpinard
Copy link
Collaborator

Would close #213.

Cross-referencing #200


Thanks very much @BeastyBlacksmith for looking into this!

I wrote down some basic info on the background callback implementation in python dash over in #213 to help us get started.


To answer

but its not yet clear to me where I can find what the target structure needs to be and how exactly the julia <-> javascript communication works.

Yep, this is key. We'll need to study the callbacks.ts file and investigate how the response payload container gets filled in the callback function. I haven't dedicated much time on this yet.

One potential way to make progress would be to inspect the JSON payload from the examples in the python dash test suite. There are probably test helpers routines in the python dash repo to help you do that.

For the manging of a cache it would probably make sense to use some julia native caching or should we use the same python cache as in the docs?

Yep, I would start with trying to implement a cache manager around some Julia on-disk caching library. I'm not familiar with the Julia on-disk caching ecosystem, so first making survey of all the different options would be nice.

Once that's done, we could start looking into ways to replicate the dash+Celery+Redis experience in Dash.jl.


I hope this helps. I'm looking forward to your contributions 😄

@BeastyBlacksmith
Copy link
Contributor Author

BeastyBlacksmith commented Apr 26, 2024

For on-disk caching we could use https://github.com/JuliaCollections/LRUCache.jl or https://github.com/LarsWl/LFUDACache.jl

On the serverside I found that they use this type

On the clientside they send a dict with the following keys:

  • cacheKey
  • job
  • cancel
  • progressDefault
    if no cacheKey is already set otherwise just
  • multi
  • progress

@etpinard
Copy link
Collaborator

For on-disk caching we could use https://github.com/JuliaCollections/LRUCache.jl

Yep, that sounds like a solid choice.

@BeastyBlacksmith
Copy link
Contributor Author

BeastyBlacksmith commented May 3, 2024

As far as I can see, that is only in memory caching though. But that might do it for now. What I am currently am stuck at is, that in the python code they get some keys via a flask.request.
https://github.com/plotly/dash/blob/15e97b85d24461dfce907d038b7788db75d1f005/dash/_callback.py#L358-L360

what I got so far, is, that this reads the arguments from a URL, but how do I get this URL in the julia version?

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

Successfully merging this pull request may close these issues.

2 participants