You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There's a process that can't use xarray because it's a multithreaded context, and xarray objects aren't thread-safe, because pandas indexes aren't thread-safe pandas-dev/pandas#2728
I did some quite exploration on where the issue was. I don't have a clear answer but thought it would be worthwhile to post some results.
Most .sel operations seemed to pass, most .reindex operations seem to fail
Running x.reindex(dim_0=idx.copy()) fails, but running x.sel(dim_0=idx)beforehand makes the initial .reindex pass (?!)
Reindexing with x.reindex(dim_0=x.dim_0) works, but not with an index that's passed in, x.reindex(dim_0=idx). (Could we claim that when xarray objects are accessed by different threads, they're safe? I'd be surprised if that were the case, but couldn't immediately see a case where that was falsified...)
I don't think there are any easy answers to this; if we wanted xarray / parts of xarray to be threadsafe. I think it's a bunch of bad options:
Remove pandas dependency (could there be a slower dumber indexing option as a plugin?)
Protect every indexing with a lock
?
The text was updated successfully, but these errors were encountered:
What is your issue?
There's a process that can't use xarray because it's a multithreaded context, and xarray objects aren't thread-safe, because pandas indexes aren't thread-safe pandas-dev/pandas#2728
I did some quite exploration on where the issue was. I don't have a clear answer but thought it would be worthwhile to post some results.
Here's a function that tests a few operations:
The results:
A couple of things to note:
.sel
operations seemed to pass, most.reindex
operations seem to failx.reindex(dim_0=idx.copy())
fails, but runningx.sel(dim_0=idx)
beforehand makes the initial.reindex
pass (?!)x.reindex(dim_0=x.dim_0)
works, but not with an index that's passed in,x.reindex(dim_0=idx)
. (Could we claim that when xarray objects are accessed by different threads, they're safe? I'd be surprised if that were the case, but couldn't immediately see a case where that was falsified...)I don't think there are any easy answers to this; if we wanted xarray / parts of xarray to be threadsafe. I think it's a bunch of bad options:
The text was updated successfully, but these errors were encountered: