Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Fix post_mortem Spock's magic command #1684

Merged
merged 2 commits into from
Nov 2, 2021

Conversation

reszelaz
Copy link
Collaborator

@reszelaz reszelaz commented Sep 1, 2021

post_mortem magic command has two problems:

  • is unable to read Door stream attributes and always fallback to the buffered logs. Fix it by making the Attr class capable to read, from cache or from the device, attribute values.
  • door stream buffer is cleared when macro finishes and in case of server crash these needs to be kept. Fix it by clearing buffer at the next macro startup

@cmft could you please test it? Many thanks!

post_mortem magic command is unable to read Door stream attributes and always fallback to the buffered (after receiving
event) logs. Fix it by making the Attr class capable to read, from
cache or from the device, attribute values.
post_mortem magic commend needs to access door's stream buffer
but this buffer is cleared when macro finishes.
Clear it only at the macro startup.
@cmft
Copy link

cmft commented Sep 23, 2021

Hi @reszelaz ,
This fix does not solve at all the issue. In case taurus can not resolve the name another exception is raising.

 showscan foo
MainThread     INFO     2021-09-23 15:13:23,983 TaurusRootLogger: Using PyQt5 (v5.12.3 with Qt 5.12.9 and Python 3.9.6)
MainThread     WARNING  2021-09-23 15:13:25,100 TaurusRootLogger: Problem with taurus.qt.editor (hint: is spyder >=3 installed?)
Traceback (most recent call last):
  File "/home/cfalcon/miniconda/envs/testing/bin/showscan", line 33, in <module>
    sys.exit(load_entry_point('sardana', 'console_scripts', 'showscan')())
  File "/home/cfalcon/miniconda/envs/testing/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/home/cfalcon/miniconda/envs/testing/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/home/cfalcon/miniconda/envs/testing/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/cfalcon/miniconda/envs/testing/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/home/cfalcon/tools/sardana/src/sardana/taurus/qt/qtgui/extra_sardana/showscanonline.py", line 323, in main
    widget.setModel(door)
  File "/home/cfalcon/tools/sardana/src/sardana/taurus/qt/qtgui/extra_sardana/showscanonline.py", line 239, in setModel
    door = taurus.Device(model)
  File "/home/cfalcon/tools/taurus/lib/taurus/_taurushelper.py", line 260, in Device
    return Factory(scheme=getSchemeFromName(device_name)).getDevice(
  File "/home/cfalcon/tools/taurus/lib/taurus/core/tango/tangofactory.py", line 373, in getDevice
    raise TaurusException("Cannot find full name of '%s'" % dev_name)
taurus.core.taurusexception.TaurusException: Cannot find full name of 'foo'

@reszelaz
Copy link
Collaborator Author

Thanks for the test. However I think you have mixed the PRs. The test you have performed is related to the #1676.

@cmft
Copy link

cmft commented Nov 2, 2021

Sorry, You right. I reported the issue in a wrong ticket

@cmft
Copy link

cmft commented Nov 2, 2021

Test report

Door_cfalcon_1 [1]: %post_mortem # server alive
<- init_device

Door_cfalcon_1 [2]: %post_mortem #server down
------------------------------
Server is offline.
This is a post mortem analysis
------------------------------
<- init_device

Door_cfalcon_1 [3]: %post_mortem # server stopped 
TaurusPollingTimer[3000] WARNING  2021-11-02 08:48:32,103 TaurusPollingTimer[3000]: loop function took more than loop interval (3.0s)
------------------------------
Server is offline.
This is a post mortem analysis
------------------------------
<- init_device

Run macro and kill MS

Door_cf_1 [3]: ct 10
Tue Nov 02 10:30:39 2021



Door_cf_1 (OFFLINE) [4]: 

Door_cf_1 (OFFLINE) [4]: %post_mortem
------------------------------
Server is offline.
This is a post mortem analysis
------------------------------
[START] runMacro Macro 'ct(10.0, None) -> 8afe0101-3bbf-11ec-89d0-d89ef310e736'
Counting for 10.0 sec

So, it seems ok for me

@reszelaz
Copy link
Collaborator Author

reszelaz commented Nov 2, 2021

@cmft thanks for your efforts to test it. I'm merging.

@reszelaz reszelaz added bug spock spock related issues labels Nov 2, 2021
@reszelaz reszelaz added this to the Jul21 milestone Nov 2, 2021
@reszelaz reszelaz merged commit 1829fce into sardana-org:develop Nov 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug spock spock related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants