brainvisa / axon

Brainvisa main GUI
Other
0 stars 1 forks source link

History book not working #67

Closed Hboni closed 1 year ago

Hboni commented 1 year ago

Describe the bug I wanted to see what process was run in a brainvisa database, with the history book activated, going through the database browser to look ad bv_proc in history_book folder. When I right-click on the bvproc to see it, brainvisa die with error:

Traceback (most recent call last):
  File "/casa/host/build/python/brainvisa/data/qt4gui/hierarchyBrowser.py", line 504, in menuBvProcEvent
    history_window = DataHistoryWindow(
  File "/casa/host/build/python/brainvisa/data/qt4gui/history.py", line 137, in __init__
    minf = readMinf(bvproc_file)
  File "/casa/host/build/python/soma/minf/api.py", line 299, in readMinf
    return tuple(iterateMinf(source, targets=targets,
  File "/casa/host/build/python/soma/minf/api.py", line 257, in iterateMinf
    raise MinfError(_('Invalid minf file: %s')
soma.minf.error.MinfError: Invalid minf file: /path/to/database/history_book/2023-05-11/54198b1a-0f90-7633-1d2a-5f0552e5128b.bvproc
Fatal Python error: Aborted

To Reproduce Steps to reproduce the behavior:

  1. Create a new database with history_book activated
  2. Import some data/launch a process
  3. Open Data Management > Database browser
  4. Go into your new database history_book
  5. Right-click on bvproc and select show bvprox
  6. Let brainvisa die

Expected behavior Already run process open.

Environment:

denisri commented 1 year ago

I think this is fixed. The problem was in opening gzipped .bvproc files (using the minf reader), which did not open files in text mode with the correct encoding. I have also catched exceptions in a few GUI callbacks so that the whole brainvisa application does not crash if an error (like missing or unreadable .bvproc file) occurs. History files were correct all the time, so they are not lost. @Hboni cann you tell if it's fixed for you too ?

Hboni commented 1 year ago

Thanks! I can see some history, but I have also some history that crash my brainvisa with this error :

Traceback (most recent call last):
  File "/casa/host/build/python/brainvisa/processing/qt4gui/neuroProcessesGUI.py", line 3443, in executionNodeChanged
    if item._node._selected != item.isOn() \
  File "/casa/host/build/python/brainvisa/processing/qt4gui/neuroProcessesGUI.py", line 1533, in isOn
    return int(Qt.ItemIsEnabled & self.flags()) > 0
TypeError: unsupported operand type(s) for &: 'ItemFlag' and 'ItemFlags'
Fatal Python error: Aborted

In this example I wanted to look at the history of file from the database_browser, or when trying to open .bvproc from history_book.

denisri commented 1 year ago

Can you test with the last modif please ?

Hboni commented 1 year ago

It works! It's awesome, I can dig into old history, thanks a lot! :+1:

Hboni commented 1 year ago

I was maybe too enthusiast, it worked for multiple bvproc history files, but it appears that some make my brainvisa crash with this error:

Traceback (most recent call last):
  File "/casa/host/build/python/brainvisa/processing/qt4gui/neuroProcessesGUI.py", line 3443, in executionNodeChanged
    if item._node._selected != item.isOn() \
AttributeError: 'QTreeWidgetItem' object has no attribute '_node'
Fatal Python error: Aborted

I sent you by mail a bvproc which generate this error, in case it helps.

denisri commented 1 year ago

Well, I can't reproduce this error, it seems to happen in some kinds of dynamic pipelines which I don't have at hand, but I have tried a little fix. Can you try again please ?

Hboni commented 1 year ago

Yeah, it was for example a morphologist pipeline. With your lasts modifications, the bvproc open correctly! Thanks again!