home / github

Menu
  • GraphQL API
  • Search all tables

issue_comments

Table actions
  • GraphQL API for issue_comments

9 rows where issue = 1730664352 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: created_at (date), updated_at (date)

user 3

  • keewis 4
  • headtr1ck 3
  • shoyer 2

author_association 2

  • MEMBER 6
  • COLLABORATOR 3

issue 1

  • don't use `CacheFileManager.__del__` on interpreter shutdown · 9 ✖
id html_url issue_url node_id user created_at updated_at ▲ author_association body reactions performed_via_github_app issue
1572412059 https://github.com/pydata/xarray/pull/7880#issuecomment-1572412059 https://api.github.com/repos/pydata/xarray/issues/7880 IC_kwDOAMm_X85duRqb shoyer 1217238 2023-06-01T16:51:07Z 2023-06-01T17:10:49Z MEMBER

Given that this error only is caused when Python is shutting down, which is exactly a case in which we do not need to clean up open file objects, maybe we can remove the __del__ instead?

Something like: ```python import atexit

@atexit.register def _remove_del_method(): # We don't need to close unclosed files at program exit, # and may not be able to do, because Python is cleaning up # imports. del CachingFileManager.del ```

(I have not tested this!)

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  don't use `CacheFileManager.__del__` on interpreter shutdown 1730664352
1572437423 https://github.com/pydata/xarray/pull/7880#issuecomment-1572437423 https://api.github.com/repos/pydata/xarray/issues/7880 IC_kwDOAMm_X85duX2v keewis 14808389 2023-06-01T17:01:56Z 2023-06-01T17:06:06Z MEMBER

that appears to work on both my laptop and my local HPC, and is arguably a lot easier to implement / understand as we don't need to make sure all the globals we use are still available (which in this case would be acquire, OPTIONS, warnings, and RuntimeWarning).

Edit: let me change the PR to do that instead

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  don't use `CacheFileManager.__del__` on interpreter shutdown 1730664352
1572384036 https://github.com/pydata/xarray/pull/7880#issuecomment-1572384036 https://api.github.com/repos/pydata/xarray/issues/7880 IC_kwDOAMm_X85duK0k keewis 14808389 2023-06-01T16:38:23Z 2023-06-01T16:54:08Z MEMBER

Have you verfied that this fixes things at least on your machine?

I thought I did, but apparently something changed: right now it fails because OPTIONS is not available anymore, so we might have to add a reference to that, as well. Additionally, for the warning we use warnings.warn and RuntimeWarning that might also have disappeared already (but those are standard library / builtins, so hopefully not?)

In any case, you can verify this, too: - create a new environment using mamba create -n test python=3.11 numpy pandas packaging pooch netcdf4 and activate it - run pip install 'dask[array]' to install dask without distributed (this appears to make a difference for me, not sure if that's the same elsewhere) - editable-install xarray so we can easily switch between branches - run python -c 'import xarray as xr; ds = xr.tutorial.open_dataset("air_temperature", chunks={})'

This should print an error for main and shouldn't with this branch (confirmed on my local HPC).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  don't use `CacheFileManager.__del__` on interpreter shutdown 1730664352
1572363440 https://github.com/pydata/xarray/pull/7880#issuecomment-1572363440 https://api.github.com/repos/pydata/xarray/issues/7880 IC_kwDOAMm_X85duFyw keewis 14808389 2023-06-01T16:26:42Z 2023-06-01T16:26:42Z MEMBER

the issue is that this doesn't occur on normal garbage collection but only on interpreter shutdown. So really, I don't think we have any way to test this using pytest as that itself is written in python (unless of course we can make use of sub-interpreters, but that might be more trouble than it's worth).

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  don't use `CacheFileManager.__del__` on interpreter shutdown 1730664352
1572359754 https://github.com/pydata/xarray/pull/7880#issuecomment-1572359754 https://api.github.com/repos/pydata/xarray/issues/7880 IC_kwDOAMm_X85duE5K headtr1ck 43316012 2023-06-01T16:23:45Z 2023-06-01T16:23:45Z COLLABORATOR

Maybe you can add a test that creates a cachingFilemanager object, then deletes it, then run gc.collect() and check somehow if it works? But no idea how pytest interferes with this or how you can ensure that there are no references to the module anymore?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  don't use `CacheFileManager.__del__` on interpreter shutdown 1730664352
1572350143 https://github.com/pydata/xarray/pull/7880#issuecomment-1572350143 https://api.github.com/repos/pydata/xarray/issues/7880 IC_kwDOAMm_X85duCi_ shoyer 1217238 2023-06-01T16:16:40Z 2023-06-01T16:16:40Z MEMBER

I agree that this seems very hard to test!

Have you verfied that this fixes things at least on your machine?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  don't use `CacheFileManager.__del__` on interpreter shutdown 1730664352
1567450094 https://github.com/pydata/xarray/pull/7880#issuecomment-1567450094 https://api.github.com/repos/pydata/xarray/issues/7880 IC_kwDOAMm_X85dbWPu headtr1ck 43316012 2023-05-29T19:28:21Z 2023-05-29T19:28:21Z COLLABORATOR

I think this is intended (though certainly not very easy to get right): see the second part of the warning in the __del__ documentation.

You are right, that warning is exactly what is causing the issues.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  don't use `CacheFileManager.__del__` on interpreter shutdown 1730664352
1567446747 https://github.com/pydata/xarray/pull/7880#issuecomment-1567446747 https://api.github.com/repos/pydata/xarray/issues/7880 IC_kwDOAMm_X85dbVbb keewis 14808389 2023-05-29T19:22:12Z 2023-05-29T19:22:12Z MEMBER

I would have thought that the global (or module level here) variable/function aquire should have at least one reference until after the deletion of the object.

I think this is intended (though certainly not very easy to get right): see the second part of the warning in the __del__ documentation.

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  don't use `CacheFileManager.__del__` on interpreter shutdown 1730664352
1567439206 https://github.com/pydata/xarray/pull/7880#issuecomment-1567439206 https://api.github.com/repos/pydata/xarray/issues/7880 IC_kwDOAMm_X85dbTlm headtr1ck 43316012 2023-05-29T19:09:41Z 2023-05-29T19:09:41Z COLLABORATOR

That's quite a weird bug. I would have thought that the global (or module level here) variable/function aquire should have at least one reference until after the deletion of the object. Is that a bug in pythons garbage collection?

Or does the garbage collection already start when calling del and does not wait for the completion of the __del__ method?

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  don't use `CacheFileManager.__del__` on interpreter shutdown 1730664352

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issue_comments] (
   [html_url] TEXT,
   [issue_url] TEXT,
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [created_at] TEXT,
   [updated_at] TEXT,
   [author_association] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [issue] INTEGER REFERENCES [issues]([id])
);
CREATE INDEX [idx_issue_comments_issue]
    ON [issue_comments] ([issue]);
CREATE INDEX [idx_issue_comments_user]
    ON [issue_comments] ([user]);
Powered by Datasette · Queries took 15.78ms · About: xarray-datasette