Skip to content

ENH(UX): state original purpose in NoDatasetFound exception + detail it for get#5708

Merged
yarikoptic merged 1 commit intodatalad:maintfrom
yarikoptic:enh-state-purpose
Aug 5, 2021
Merged

ENH(UX): state original purpose in NoDatasetFound exception + detail it for get#5708
yarikoptic merged 1 commit intodatalad:maintfrom
yarikoptic:enh-state-purpose

Conversation

@yarikoptic
Copy link
Member

I have seen those reported by users, and I must confess that some of those stem from the confusing interface of install + RFing which lead install/get to unable to operate on arbitrary paths (#3759). But I think that such error might come up in other use-cases as well. So before this PR users might get:

$> datalad install git://github.com/dl-throwaway/test_gh3 dest                                   
[INFO   ] scanning for unlocked files (this may take some time)                                           
[INFO   ] Remote origin uses a protocol not supported by git-annex; setting annex-ignore                  
install(ok): /home/yoh/.tmp/test_gh3 (dataset)
[ERROR  ] No dataset found at '/home/yoh/.tmp'.  Specify a dataset to work with by providing its path via the `dataset` option, or change the current working directory to be in a dataset. [dataset.py:require_dataset:569] (NoDatasetFound) 
usage: datalad install [-h] [-s SOURCE] [-d DATASET] [-g] [-D DESCRIPTION] [-r] [-R LEVELS]
                       [--reckless [auto|ephemeral|shared-...]] [-J NJOBS]
                       [PATH ...]

which leaves them wondering on WTF (error message nohow points to dest) and needing to ask/RTFM etc to figure out that they needed -s. With this change it would look like

$> datalad install git://github.com/dl-throwaway/test_gh3 dest
[ERROR  ] No dataset found at '/home/yoh/.tmp' for the purpose "get content of ['dest']".  Specify a dataset to work with by providing its path via the `dataset` option, or change the current working directory to be in a dataset. [dataset.py:require_dataset:569] (NoDatasetFound) 
usage: datalad install [-h] [-s SOURCE] [-d DATASET] [-g] [-D DESCRIPTION] [-r] [-R LEVELS]
                       [--reckless [auto|ephemeral|shared-...]] [-J NJOBS]
                       [PATH ...]

it is still not perfect but it immediately points to the underlying culprit.

@yarikoptic yarikoptic added enhancement UX user experience semver-patch Increment the patch version when merged labels Jun 3, 2021
@codecov
Copy link

codecov bot commented Jun 3, 2021

Codecov Report

Merging #5708 (a876e6c) into maint (6529f05) will decrease coverage by 45.32%.
The diff coverage is n/a.

❗ Current head a876e6c differs from pull request most recent head 047c1cf. Consider uploading reports for the commit 047c1cf to get more accurate results
Impacted file tree graph

@@             Coverage Diff             @@
##            maint    #5708       +/-   ##
===========================================
- Coverage   90.32%   45.00%   -45.33%     
===========================================
  Files         300      297        -3     
  Lines       42390    42311       -79     
===========================================
- Hits        38289    19040    -19249     
- Misses       4101    23271    +19170     
Impacted Files Coverage Δ
datalad/distribution/dataset.py 91.69% <ø> (-2.77%) ⬇️
datalad/distribution/get.py 90.37% <ø> (-7.55%) ⬇️
datalad/tests/test_api.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/tests/test_base.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/tests/test_config.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/ui/tests/__init__.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/tests/test__main__.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/tests/test_strings.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/ui/tests/test_base.py 0.00% <0.00%> (-100.00%) ⬇️
datalad/support/tests/utils.py 0.00% <0.00%> (-100.00%) ⬇️
... and 217 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6529f05...047c1cf. Read the comment docs.

@yarikoptic
Copy link
Member Author

travis fail seems to be a fluke -- restarted
======================================================================
ERROR: datalad.interface.tests.test_download_url.test_download_url_need_datalad_remote
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/tmp/dl-miniconda-071p_u0_/lib/python3.8/site-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/tmp/dl-miniconda-071p_u0_/lib/python3.8/site-packages/datalad/tests/utils.py", line 189, in _wrap_skip_if_no_network
    return func(*args, **kwargs)
  File "/tmp/dl-miniconda-071p_u0_/lib/python3.8/site-packages/datalad/tests/utils.py", line 764, in _wrap_with_tempfile
    return t(*(arg + (filename,)), **kw)
  File "/tmp/dl-miniconda-071p_u0_/lib/python3.8/site-packages/datalad/interface/tests/test_download_url.py", line 243, in test_download_url_need_datalad_remote
    ds_b.get("foo")
  File "/tmp/dl-miniconda-071p_u0_/lib/python3.8/site-packages/datalad/distribution/dataset.py", line 503, in apply_func
    return f(**kwargs)
  File "/tmp/dl-miniconda-071p_u0_/lib/python3.8/site-packages/datalad/interface/utils.py", line 481, in eval_func
    return return_func(generator_func)(*args, **kwargs)
  File "/tmp/dl-miniconda-071p_u0_/lib/python3.8/site-packages/datalad/interface/utils.py", line 474, in return_func
    results = list(results)
  File "/tmp/dl-miniconda-071p_u0_/lib/python3.8/site-packages/datalad/interface/utils.py", line 459, in generator_func
    raise IncompleteResultsError(
datalad.support.exceptions.IncompleteResultsError: Command did not complete successfully. 1 failed:
[{'action': 'get',
  'annexkey': 'MD5E-s4008--ef4867d3c21a0034a98cd9453f14efe3',
  'message': 'not available',
  'path': '/tmp/datalad_temp_test_download_url_need_datalad_remoteyb5mvyuc/b/foo',
  'refds': '/tmp/datalad_temp_test_download_url_need_datalad_remoteyb5mvyuc/b',
  'status': 'error',
  'type': 'file'}]

@yarikoptic
Copy link
Member Author

@datalad/developers - any feedback on this one?

@yarikoptic yarikoptic added the merge-if-ok OP considers this work done, and requests review/merge label Jun 10, 2021
yarikoptic added a commit to yarikoptic/datalad that referenced this pull request Jun 10, 2021
We had a mix, and even though "ing form was probably more prevalent, I felt that shorter
imperative form would be better, even though it would be not "for {purpose}" but
"to {purpose}" if to be displayed. (as eg in datalad#5708)
@yarikoptic yarikoptic added this to the 0.14.5 milestone Jul 8, 2021
@yarikoptic yarikoptic modified the milestones: 0.14.5, 0.14.8 Aug 5, 2021
@yarikoptic
Copy link
Member Author

eh, forgot about this one. rebased for a good measure. If no objections -- will merge unless some new findings are discovered.

@yarikoptic
Copy link
Member Author

FWIW: still works

$> datalad install dest                                       
[ERROR  ] No dataset found at '/tmp' for the purpose "get content of ['dest']".  Specify a dataset to work with by providing its path via the `dataset` option, or change the current working directory to be in a dataset. [dataset.py:require_dataset:569] (NoDatasetFound) 
usage: datalad install [-h] [-s SOURCE] [-d DATASET] [-g] [-D DESCRIPTION] [-r] [-R LEVELS] [--reckless [auto|ephemeral|shared-...]] [-J NJOBS] [PATH ...]

@yarikoptic yarikoptic merged commit c80cf09 into datalad:maint Aug 5, 2021
@yarikoptic yarikoptic deleted the enh-state-purpose branch August 9, 2021 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement merge-if-ok OP considers this work done, and requests review/merge semver-patch Increment the patch version when merged UX user experience

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants