Skip to content
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

Failsafe etelemetry import #1399

Merged
merged 1 commit into from
Feb 2, 2024
Merged

Failsafe etelemetry import #1399

merged 1 commit into from
Feb 2, 2024

Conversation

TheChymera
Copy link
Contributor

Currently DANDI will fail to work due to this import specifically if etelemetry is not present.
All other code points where etelemetry is needed are either caught exceptions or controlled by NO_ET.

Let me know if I should do this differently.

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (98f5cf7) 88.51% compared to head (5e61268) 67.92%.

Files Patch % Lines
dandi/files/bases.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #1399       +/-   ##
===========================================
- Coverage   88.51%   67.92%   -20.59%     
===========================================
  Files          77       77               
  Lines       10492    10477       -15     
===========================================
- Hits         9287     7117     -2170     
- Misses       1205     3360     +2155     
Flag Coverage Δ
unittests 67.92% <0.00%> (-20.59%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yarikoptic yarikoptic added the internal Changes only affect the internal API label Feb 2, 2024
@jwodder
Copy link
Member

jwodder commented Feb 2, 2024

See #1400 regarding the test failures.

@yarikoptic
Copy link
Member

I don't think that failing test has anything to do with this -- likely change in pynwb or inspector, heh
_____________________ test_validate_simple3_no_subject_id ______________________
dandi/tests/test_files.py:364: in test_validate_simple3_no_subject_id
    assert errmsgs == ["subject_id is missing."]
E   assert ["Traceback (...tartswith'\n"] == ['subject_id is missing.']
E     
E     At index 0 diff: 'Traceback (most recent call last):\n  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/nwbinspector/nwbinspector.py", line 588, in inspect_nwbfile\n    for inspector_message in inspect_nwbfile_object(\n  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/nwbinspector/nwbinspector.py", line 686, in inspect_nwbfile_object\n    subject_dependent_checks = _intercept_in_vitro_protein(nwbfile_object=nwbfile_object, checks=checks)\n                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/nwbinspector/nwbinspector.py", line 632, in _intercept_in_vitro_protein\n    and getattr(subject, "subject_id", "").startswith("protein")\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: \'NoneType\' object has no attribute \'startswith\'\n' != 'subject_id is missing.'
E     
E     Full diff:
E       [
E     -     'subject_id is missing.',
E     +     'Traceback (most recent call last):\n'
E     +     '  File '
E     +     '"/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/nwbinspector/nwbinspector.py", '
E     +     'line 588, in inspect_nwbfile\n'
E     +     '    for inspector_message in inspect_nwbfile_object(\n'
E     +     '  File '
E     +     '"/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/nwbinspector/nwbinspector.py", '
E     +     'line 686, in inspect_nwbfile_object\n'
E     +     '    subject_dependent_checks = '
E     +     '_intercept_in_vitro_protein(nwbfile_object=nwbfile_object, '
E     +     'checks=checks)\n'
E     +     '                               '
E     +     '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n'
E     +     '  File '
E     +     '"/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/nwbinspector/nwbinspector.py", '
E     +     'line 632, in _intercept_in_vitro_protein\n'
E     +     '    and getattr(subject, "subject_id", "").startswith("protein")\n'
E     +     '        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n'
E     +     "AttributeError: 'NoneType' object has no attribute 'startswith'\n",
E       ]

---------- coverage: platform linux, python 3.12.1-final-0 -----------
Coverage XML written to file coverage.xml

============================= slowest 10 durations =============================
47.90s setup    dandi/cli/tests/test_service_scripts.py::test_reextract_metadata
10.14s call     dandi/tests/test_metadata.py::test_bids_nwb_metadata_integration
9.62s call     dandi/tests/test_dandiapi.py::test_get_dandiset_published_other_version[False]
9.24s call     dandi/tests/test_dandiapi.py::test_publish_and_manipulate
8.90s call     dandi/tests/test_dandiapi.py::test_get_dandiset_published_other_version[True]
7.23s call     dandi/tests/test_upload.py::test_upload_bids_zarr
6.30s call     dandi/tests/test_download.py::test_download_multiple_urls
6.23s call     dandi/tests/test_upload.py::test_upload_different_zarr_entry_conflicts
5.74s call     dandi/tests/test_download.py::test_download_newest_version
5.73s call     dandi/tests/test_upload.py::test_upload_different_zarr_file_to_parent_dir
=========================== short test summary info ============================
FAILED dandi/tests/test_files.py::test_validate_simple3_no_subject_id - assert ["Traceback (...tartswith'\n"] == ['subject_id is missing.']
  
  At index 0 diff: 'Traceback (most recent call last):\n  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/nwbinspector/nwbinspector.py", line 588, in inspect_nwbfile\n    for inspector_message in inspect_nwbfile_object(\n  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/nwbinspector/nwbinspector.py", line 686, in inspect_nwbfile_object\n    subject_dependent_checks = _intercept_in_vitro_protein(nwbfile_object=nwbfile_object, checks=checks)\n                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File "/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/nwbinspector/nwbinspector.py", line 632, in _intercept_in_vitro_protein\n    and getattr(subject, "subject_id", "").startswith("protein")\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\nAttributeError: \'NoneType\' object has no attribute \'startswith\'\n' != 'subject_id is missing.'
  
  Full diff:
    [
  -     'subject_id is missing.',
  +     'Traceback (most recent call last):\n'
  +     '  File '
  +     '"/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/nwbinspector/nwbinspector.py", '
  +     'line 588, in inspect_nwbfile\n'
  +     '    for inspector_message in inspect_nwbfile_object(\n'
  +     '  File '
  +     '"/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/nwbinspector/nwbinspector.py", '
  +     'line 686, in inspect_nwbfile_object\n'
  +     '    subject_dependent_checks = '
  +     '_intercept_in_vitro_protein(nwbfile_object=nwbfile_object, '
  +     'checks=checks)\n'
  +     '                               '
  +     '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n'
  +     '  File '
  +     '"/opt/hostedtoolcache/Python/3.12.1/x64/lib/python3.12/site-packages/nwbinspector/nwbinspector.py", '
  +     'line 632, in _intercept_in_vitro_protein\n'
  +     '    and getattr(subject, "subject_id", "").startswith("protein")\n'
  +     '        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n'
  +     "AttributeError: 'NoneType' object has no attribute 'startswith'\n",
    ]
======= 1 failed, 707 passed, 1 skipped, 2 xfailed in 733.71s (0:12:13) ========

thank you -- makes sense, let's proceed

@yarikoptic yarikoptic merged commit 9abebe1 into master Feb 2, 2024
9 of 28 checks passed
@yarikoptic yarikoptic deleted the et branch February 2, 2024 20:33
Copy link

github-actions bot commented Feb 2, 2024

🚀 PR was released in 0.59.1 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Changes only affect the internal API released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants