-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add depends_on path to error output #248
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@@ -280,7 +280,8 @@ def parse_depends_on_chain( | |||
chain.transformations[transform.name] = transform[()] | |||
except KeyError as e: | |||
warnings.warn( | |||
UserWarning(f'depends_on chain references missing node {e}'), stacklevel=2 | |||
UserWarning(f'depends_on chain {depends_on} references missing node {e}'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No sure what this adds? I think the depends_on was already in the warning message as e
?
Old error message: UserWarning: depends_on chain references missing node 'transform'
New error message: UserWarning: depends_on chain transform references missing node 'transform'
The KeyError
is just the name of the missing entry.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that's a lucky example, what I'm interested in is which node is causing the problem, and I get a message like so:
WARNING root:fileloading_test.py:31 UserWarning: depends_on chain /entry/instrument/detector_panel_2/transformations/stageZ references missing node 'depends_on'
Run against 443503_00032754.hdf
@@ -280,7 +280,8 @@ def parse_depends_on_chain( | |||
chain.transformations[transform.name] = transform[()] | |||
except KeyError as e: | |||
warnings.warn( | |||
UserWarning(f'depends_on chain references missing node {e}'), stacklevel=2 | |||
UserWarning(f'depends_on chain {depends_on} references missing node {e}'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CI is complaining as the tests at
scippnexus/tests/nxtransformations_test.py
Lines 727 to 735 in 7878e8a
def test_compute_positions_warns_if_depends_on_is_dead_link(h5root): | |
instrument = snx.create_class(h5root, 'instrument', snx.NXinstrument) | |
detector = create_detector(instrument) | |
snx.create_field(detector, 'depends_on', sc.scalar('transform')) | |
root = make_group(h5root) | |
with pytest.warns(UserWarning, match='depends_on chain references missing node'): | |
loaded = root[()] | |
with pytest.warns(UserWarning, match='depends_on chain references missing node'): | |
snx.compute_positions(loaded) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran it locally like so UserWarning(f'depends_on chain references missing node {e} {depends_on}')
, and that was good enough for me then although it doesn't read as nicely. If that makes it easier to do the matching though you could do that, in case you match multiple warnings using wildcards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replace the match with match='depends_on chain .* references missing node'
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, let's see if it works
Head branch was pushed to by a user without write access
Co-authored-by: Mridul Seth <[email protected]>
Co-authored-by: Mridul Seth <[email protected]>
It's hard to diagnose current web output as there is no simple way to see what is being warned about