home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 500264231

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/pull/3006#issuecomment-500264231 https://api.github.com/repos/pydata/xarray/issues/3006 500264231 MDEyOklzc3VlQ29tbWVudDUwMDI2NDIzMQ== 1828519 2019-06-10T01:36:00Z 2019-06-10T01:36:00Z CONTRIBUTOR

In my own tests I've been using the following custom scheduler with dask.config.set(scheduler=CustomScheduler()) to point out what code is computing the array when I don't want it to:

``` class CustomScheduler(object): """Custom dask scheduler that raises an exception if dask is computed too many times."""

def __init__(self, max_computes=1):
    """Set starting and maximum compute counts."""
    self.max_computes = max_computes
    self.total_computes = 0

def __call__(self, dsk, keys, **kwargs):
    """Compute dask task and keep track of number of times we do so."""
    import dask
    self.total_computes += 1
    if self.total_computes > self.max_computes:
        raise RuntimeError("Too many dask computations were scheduled: {}".format(self.total_computes))
    return dask.get(dsk, keys, **kwargs)

```

Does something like this exist in the xarray tests? If not, I could add it then add a dask test to the DataArray tests.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  453964049
Powered by Datasette · Queries took 0.863ms · About: xarray-datasette