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

remote/client: do not print deleted resource's class on monitor #1264

Conversation

Bastian-Krause
Copy link
Member

@Bastian-Krause Bastian-Krause commented Sep 5, 2023

Description
On delete, resource is an empty dictionary:

ERROR   labgrid.remote.: ClientSession.onUserError(): "While firing <bound method ClientSession.on_resource_changed of <labgrid.remote.client.ClientSession object at 0x7fcf1cbdff90>> subscribed under 8031289985454517."
Traceback (most recent call last):
  File "/usr/ptx-venvs/labgrid/lib/python3.11/site-packages/txaio/aio.py", line 487, in done
    res = f.result()
          ^^^^^^^^^^
  File "/usr/ptx-venvs/labgrid/lib/python3.11/site-packages/labgrid/remote/client.py", line 126, in on_resource_changed
    print(f"Resource {exporter}/{group_name}/{resource['cls']}/{resource_name} deleted")
                                              ~~~~~~~~^^^^^^^
KeyError: 'cls'

This can be reproduced easily by restarting an exporter while running labgrid-client monitor.

We could publish the class, but that would only work for new exporters. For now, simply replace the class name with "???".

Checklist

  • PR has been tested

Fixes #1178

On delete, resource is an empty dictionary:

  ERROR   labgrid.remote.: ClientSession.onUserError(): "While firing <bound method ClientSession.on_resource_changed of <labgrid.remote.client.ClientSession object at 0x7fcf1cbdff90>> subscribed under 8031289985454517."
  Traceback (most recent call last):
    File "/usr/ptx-venvs/labgrid/lib/python3.11/site-packages/txaio/aio.py", line 487, in done
      res = f.result()
            ^^^^^^^^^^
    File "/usr/ptx-venvs/labgrid/lib/python3.11/site-packages/labgrid/remote/client.py", line 126, in on_resource_changed
      print(f"Resource {exporter}/{group_name}/{resource['cls']}/{resource_name} deleted")
                                                ~~~~~~~~^^^^^^^
  KeyError: 'cls'

This can be reproduced easily by restarting an exporter while running
`labgrid-client monitor`.

We could publish the class, but that would only work for new exporters.
For now, simply replace the class name with "???".

Fixes: f9d4ccd ("remote/client: print full resource identifier on monitor")
Signed-off-by: Bastian Krause <[email protected]>
@Bastian-Krause Bastian-Krause added this to the v23.1 milestone Sep 5, 2023
@codecov
Copy link

codecov bot commented Sep 5, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.1% ⚠️

Comparison is base (1052d34) 62.9% compared to head (9e4fdc6) 62.9%.

Additional details and impacted files
@@           Coverage Diff            @@
##           master   #1264     +/-   ##
========================================
- Coverage    62.9%   62.9%   -0.1%     
========================================
  Files         161     161             
  Lines       11861   11861             
========================================
- Hits         7470    7469      -1     
- Misses       4391    4392      +1     
Files Changed Coverage Δ
labgrid/remote/client.py 51.1% <0.0%> (ø)

... and 1 file with indirect coverage changes

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

@Emantor Emantor merged commit 4bfdc59 into labgrid-project:master Sep 6, 2023
7 of 9 checks passed
@Bastian-Krause Bastian-Krause deleted the bst/monitor-deleted-resource-class branch September 6, 2023 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants