Skip to content

Bokeh dashboard failures #8022

Closed
Closed

Description

@mrocklin

I think I've seen other reports of this recently, but here's an example of the bokeh dashboard being sad:

https://gist.github.com/mrocklin/417439bf259b8974b502e67d2ac98f22

from dask.distributed import Client
client = Client()

import zarr
import numpy as np
import dask.array as da


n = (100000, 100000)
chunksize = (5000, 5000)
input = zarr.ones(n, chunks=chunksize)

def f1d(chunk):
    return chunk.sum(keepdims=True)

def f2d(chunk, axis=None):
    return chunk.sum(axis=axis, keepdims=True)

x = da.from_array(input, chunks=chunksize)
a = x.map_blocks(f1d)
b = x.map_blocks(f2d, axis=0)
c = x.map_blocks(f2d, axis=1)

import dask
aa, bb, cc = dask.persist(a, b, c)
BokehUserWarning: ColumnDataSource's columns must be of the same length. Current lengths: ('alpha', 519), ('color', 481), ('duration', 519), ('duration_text', 481), ('key', 481), ('name', 481), ('start', 519), ('worker', 481), ('worker_thread', 481), ('y', 519)
BokehUserWarning: ColumnDataSource's columns must be of the same length. Current lengths: ('alpha', 555), ('color', 483), ('duration', 555), ('duration_text', 483), ('key', 483), ('name', 483), ('start', 555), ('worker', 483), ('worker_thread', 483), ('y', 555)
BokehUserWarning: ColumnDataSource's columns must be of the same length. Current lengths: ('alpha', 582), ('color', 490), ('duration', 582), ('duration_text', 490), ('key', 490), ('name', 490), ('start', 582), ('worker', 490), ('worker_thread', 490), ('y', 582)
BokehUserWarning: ColumnDataSource's columns must be of the same length. Current lengths: ('alpha', 614), ('color', 478), ('duration', 614), ('duration_text', 478), ('key', 478), ('name', 478), ('start', 614), ('worker', 478), ('worker_thread', 478), ('y', 614)
BokehUserWarning: ColumnDataSource's columns must be of the same length. Current lengths: ('alpha', 644), ('color', 492), ('duration', 644), ('duration_text', 492), ('key', 492), ('name', 492), ('start', 644), ('worker', 492), ('worker_thread', 492), ('y', 644)
BokehUserWarning: ColumnDataSource's columns must be of the same length. Current lengths: ('alpha', 672), ('color', 480), ('duration', 672), ('duration_text', 480), ('key', 480), ('name', 480), ('start', 672), ('worker', 480), ('worker_thread', 480), ('y', 672)
BokehUserWarning: ColumnDataSource's columns must be of the same length. Current lengths: ('alpha', 700), ('color', 492), ('duration', 700), ('duration_text', 492), ('key', 492), ('name', 492), ('start', 700), ('worker', 492), ('worker_thread', 492), ('y', 700)

Sorry for the not entirely minimal example. Hopefully it's easy to reproduce though.

Activity

  1. added
    bug
    and removed on Aug 8, 2023
  2. quasiben commented on Aug 8, 2023

    @quasiben
    Member

    I think there was a change between bokeh 3.2.0 and 3.2.1 . FWIW I like @jacobtomlinson 's poke code for testing the dashboard. @bryevdv, if you have any time, do you know what may have changed relating to ColumnDataSource or anything related to the above warnings ?

  3. bryevdv commented on Aug 8, 2023

    @bryevdv
    Contributor

    That message indicates a usage error. Creating a CDS with different column lengths has never been supported, but I think a hard error was only added recently (previously you'd just get silent failures / undefined behavior). I don't think that check went in with 3.2.1 though (very little went into 3.2.1 -- https://github.com/bokeh/bokeh/milestone/82?closed=1).

    If you need to update a CDS with new data that has a different length, then you need to update the entire .data at once:

    new_data_dict = ... # new dict with all new columns the same length
    
    source.data = new_data_dict # "atomic" update
  4. v2thegreat commented on Aug 8, 2023

    @v2thegreat

    I think there was a change between bokeh 3.2.0 and 3.2.1 . FWIW I like @jacobtomlinson 's poke code for testing the dashboard. @bryevdv, if you have any time, do you know what may have changed relating to ColumnDataSource or anything related to the above warnings ?

    Hi, I'm running into the issue right now. Would it make sense to downgrade to 3.2.0 and wait it out? It's making using Dask difficult.

    Edit: I tried that and it seems to have hidden away the issue for now

  5. quasiben commented on Aug 8, 2023

    @quasiben
    Member

    Yes, I would recommend downgrading to 3.2.0 until we get this sorted out

  6. bryevdv commented on Aug 8, 2023

    @bryevdv
    Contributor

    The only remotely possibly relevant change I can see in 3.2.0...3.2.1 was this small bugfix for streaming for the rollover=0 case:

    Is the dashboard using stream? Can someone point me at that code if so? Is it possible you are not streaming all the columns? (Though doing that should always have resulted in an error 🤷 ) Looking at the PR again, it still looks correct and notably no existing tests were modified, only new tests for rollover=0 were added.

  7. bryevdv commented on Aug 8, 2023

    @bryevdv
    Contributor

    In any case the quickest test someone who can reproduce could perform, to see if the above change has any bearing, would be to install 3.2.1 but manually copy over the src/bokeh/core/property/wrappers.py file from 3.2.0.

  8. quasiben commented on Aug 9, 2023

    @quasiben
    Member

    Apologies for the delay. It is a stream use case:

    if PROFILING:
    curdoc().add_next_tick_callback(
    lambda: self.source.stream(rectangles, self.n_rectangles)
    )
    else:
    self.source.stream(rectangles, self.n_rectangles)

    As you suggested I pulled the 3.2.0 wrappers.py file and that indeed did resolve the warnings from popping up

  9. quasiben commented on Aug 9, 2023

    @quasiben
    Member

    After exploring a bit more I think this is happening when rollover is larger than the array. In the dask case, L in wrappers.py will be 504 and rollover is 1000. So there is a substantive difference between del L[:-rollover] and del L[:len(L) - rollover]. I'm not exactly clear on what is happening on the bokeh side but would it be correct to say that if rollover > len(L) do nothing ?

  10. bryevdv commented on Aug 9, 2023

    @bryevdv
    Contributor

    Yes that seems like a new bug. The latest PR fixed one missing corner (0) case but broke another (>N). Let me see if the PR author can submit a patch to get in a 3.2.2 release soon.

  11. jrbourbeau commented on Aug 9, 2023

    @jrbourbeau
    Member
  12. bryevdv commented on Aug 9, 2023

    @bryevdv
    Contributor

    Fix PR is verified and merged. I will try to backport and cut a 3.2.2 release in the next few days

  13. graelo commented on Aug 11, 2023

    @graelo

    @bryevdv this works great on 3.3, thanks a ton! Looking forward to a release ;)

  14. bryevdv commented on Aug 11, 2023

    @bryevdv
    Contributor

    👍 Should be Monday

  15. bryevdv commented on Aug 14, 2023

    @bryevdv
    Contributor

    3.2.2 is available on PyPI and the Bokeh anaconda.org channel. I am not plugged into the process for availability on conda-forge and defaults these days.

  16. quasiben commented on Aug 14, 2023

    @quasiben
    Member

    Thanks @bryevdv for all the help! Confirmed 3.2.2 works. Since this is a warning I don't think it's worth the trouble excluding bokeh 3.2.1 from installing with Distributed though if others feel differently please say so. Closing

  17. jrbourbeau commented on Aug 14, 2023

    @jrbourbeau
    Member

    That sounds good to me @quasiben. Thanks again for fixing / releasing @bryevdv

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdashboard

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions