dandi / dandi-cli

DANDI command line client to facilitate common operations
https://dandi.readthedocs.io/
Apache License 2.0
22 stars 28 forks source link

Failsafe etelemetry import #1399

Closed TheChymera closed 9 months ago

TheChymera commented 9 months ago

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.

codecov[bot] commented 9 months ago

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 :warning:
Additional details and impacted files ```diff @@ 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](https://app.codecov.io/gh/dandi/dandi-cli/pull/1399/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dandi) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/dandi/dandi-cli/pull/1399/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dandi) | `67.92% <0.00%> (-20.59%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dandi#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

jwodder commented 9 months ago

See #1400 regarding the test failures.

yarikoptic commented 9 months ago
I don't think that failing test has anything to do with this -- likely change in pynwb or inspector, heh ```shell _____________________ 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

github-actions[bot] commented 9 months ago

:rocket: PR was released in 0.59.1 :rocket: