-
-
Notifications
You must be signed in to change notification settings - Fork 404
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
Non-blocking periodic_events method on DynamicMap #1429
Conversation
I don't have anything more to do on this PR right now. If you could figure out how to get this working when running as a bokeh app, that would be great! I won't be touching this again (until you tell me to) so don't worry about merge conflicts and just push your changes here. Meanwhile I'll prepare some unit tests for the default util but I won't commit that yet. |
Maybe a |
In the last commit, I implemented a slightly different approach - a periodic object with a stop method. This means you can do something lik this: dmap.periodic(0.001, 1000000)
dmap.periodic.stop() # To stop whenever you want In addition to making stopping periodic callbacks more convenient, this approach allows @philippjfr I think this approach should fit better with the bokeh app support. Over to you! |
I've just had another thought: maybe it would be conceptually simpler to only have one instance. If we did that, then when you run |
if isinstance(o, DynamicMap): | ||
layer_streams += get_nested_streams(o) | ||
return list(set(layer_streams)) | ||
return list({s for dmap in get_nested_dmaps(dmap) for s in dmap.streams}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense to refactor it this way.
else: | ||
plot.document = doc | ||
plot = plot.plot | ||
plot.document = doc |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment as a reminder of what attach_periodic
does here...
holoviews/plotting/bokeh/util.py
Outdated
@classmethod | ||
def is_set(cls): | ||
return self.count == 0 | ||
return completed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll update the API of the other periodic utility so it doesn't need to be this complex. I'll also simplify this.
@philippjfr All looks good! I'll update the stuff around Any way you can set up bokeh specific unit tests for that utility? I'll add some unit tests for the core utility... |
|
||
def __str__(self): | ||
return "<holoviews.core.spaces.periodic method>" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment explaining what this representation is meant to achieve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have another idea of what the repr should be, I would be happy to implement it! What sort of comment are you thinking of?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just something to indicate why the default representation was not suitable. I.e. why was this method necessary?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It isn't strictly necessary, but I think it is a bit nicer than the default which is something like:
<holoviews.core.spaces.periodic at 0x10886e850>
Instead of a random memory address, I say that it is a method which reflects how this utility is used (i.e it lives on DynamicMap
).
Happy to remove it if you think the default is better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to remove it, just put a docstring saying what you say here (that this repr provides additional information that should be more useful).
@philippjfr Ready for review once the tests go green. |
fe5c324
to
fa983f6
Compare
@philippjfr The pr tests have passed and I don't think the push build ones will unless I rebase. |
Looks good, merging. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR aims to address #1428 and replaces the Periodic stream prototype we were testing. It should be possible for the bokeh renderer to install a bokeh appropriate utility when running as a bokeh app.
Action items