Opened 6 years ago
Closed 6 years ago
#2676 closed defect (fixed)
LabelModel not saved in sessions and/or LabelModel selectable
Reported by: | Eric Pettersen | Owned by: | Tom Goddard |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Sessions | Version: | |
Keywords: | Cc: | zhangyixiao8867@…, chimera-programmers | |
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description
The following bug report has been submitted: Platform: Darwin-18.7.0-x86_64-i386-64bit ChimeraX Version: 0.91 (2019-12-11) Description Log: UCSF ChimeraX version: 0.91 (2019-12-11) © 2016-2019 Regents of the University of California. All rights reserved. How to cite UCSF ChimeraX > open 1gcn 1gcn title: X-ray analysis of glucagon and its relationship to receptor binding [more info...] Chain information for 1gcn #1 --- Chain | Description A | glucagon > 2dlabels text test > select #2 2 models selected > toolshed show "Basic Actions" > name frozen picked sel > save /Users/pett/rm/test.cxs Traceback (most recent call last): File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 796, in save session.save(output, version=version, include_maps=include_maps) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 556, in save mgr.discovery(self._state_containers) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 255, in discovery self.processed[key] = self.process(obj, parents) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 288, in process return copy_state(data, convert=convert) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 210, in copy_state return _copy(data) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 195, in _copy items = [(_copy(k), _copy(v)) for k, v in data.items()] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 195, in <listcomp> items = [(_copy(k), _copy(v)) for k, v in data.items()] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 204, in _copy items = [_copy(o) for o in data] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 204, in <listcomp> items = [_copy(o) for o in data] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 204, in _copy items = [_copy(o) for o in data] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 204, in <listcomp> items = [_copy(o) for o in data] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 195, in _copy items = [(_copy(k), _copy(v)) for k, v in data.items()] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 195, in <listcomp> items = [(_copy(k), _copy(v)) for k, v in data.items()] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 204, in _copy items = [_copy(o) for o in data] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 204, in <listcomp> items = [_copy(o) for o in data] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 208, in _copy return convert(data) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 287, in convert return add_obj(obj, parents) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 261, in _add_obj uid = _UniqueName.from_obj(self.session, obj) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 142, in from_obj (obj_cls.__name__, bundle_info.name)) RuntimeError: Unable to restore objects of LabelModel class in ChimeraX-Label bundle because the class name is not listed in the name to class table for session restore RuntimeError: Unable to restore objects of LabelModel class in ChimeraX-Label bundle because the class name is not listed in the name to class table for session restore File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 142, in from_obj (obj_cls.__name__, bundle_info.name)) See log for complete Python traceback. Traceback (most recent call last): File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/cmd_line/tool.py", line 258, in execute cmd.run(cmd_text) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/commands/cli.py", line 2837, in run result = ci.function(session, **kw_args) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/commands/save.py", line 61, in save fmt.export(session, filename, fmt.nicknames[0], **kw) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/io.py", line 229, in export result = self.export_func(session, path, **kw) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 796, in save session.save(output, version=version, include_maps=include_maps) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 556, in save mgr.discovery(self._state_containers) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 255, in discovery self.processed[key] = self.process(obj, parents) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 288, in process return copy_state(data, convert=convert) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 210, in copy_state return _copy(data) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 195, in _copy items = [(_copy(k), _copy(v)) for k, v in data.items()] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 195, in <listcomp> items = [(_copy(k), _copy(v)) for k, v in data.items()] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 204, in _copy items = [_copy(o) for o in data] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 204, in <listcomp> items = [_copy(o) for o in data] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 204, in _copy items = [_copy(o) for o in data] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 204, in <listcomp> items = [_copy(o) for o in data] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 195, in _copy items = [(_copy(k), _copy(v)) for k, v in data.items()] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 195, in <listcomp> items = [(_copy(k), _copy(v)) for k, v in data.items()] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 204, in _copy items = [_copy(o) for o in data] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 204, in <listcomp> items = [_copy(o) for o in data] File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/state.py", line 208, in _copy return convert(data) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 287, in convert return add_obj(obj, parents) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 261, in _add_obj uid = _UniqueName.from_obj(self.session, obj) File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 142, in from_obj (obj_cls.__name__, bundle_info.name)) RuntimeError: Unable to restore objects of LabelModel class in ChimeraX-Label bundle because the class name is not listed in the name to class table for session restore RuntimeError: Unable to restore objects of LabelModel class in ChimeraX-Label bundle because the class name is not listed in the name to class table for session restore File "/Users/chimera/Applications/ChimeraX_Daily.app/Contents/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site- packages/chimerax/core/session.py", line 142, in from_obj (obj_cls.__name__, bundle_info.name)) See log for complete Python traceback. OpenGL version: 4.1 ATI-2.11.21 OpenGL renderer: AMD Radeon Pro 575X OpenGL Engine OpenGL vendor: ATI Technologies Inc.
Change History (7)
comment:1 by , 6 years ago
Cc: | added |
---|---|
Component: | Unassigned → Sessions |
Owner: | set to |
Platform: | → all |
Project: | → ChimeraX |
Status: | new → assigned |
Summary: | ChimeraX bug report submission → LabelModel not saved in sessions and/or LabelModel selectable |
comment:2 by , 6 years ago
The example can be simplified
2dlabels text test
name frozen stuff #1
save test.cxs
This generates an error because the named selection tries to save a reference to the label models and those are not saved in sessions. Each 2d label is a model and the parent model which holds all 2d labels saves and restores their state. Various other models are not saved in sessions such as IHM models, VR cones, user interface, camera screen models... and those all will cause this error.
I can fix this by making 2dlabel models save in sessions -- the current session saving method was developed when 2d labels were not models. But this doesn't address the broader problem that any unsavable model can cause this error that prevents saving sessions. We need a more robust way to handle this. Maybe tools that save references to models need to consider that not all models are saved in sessions. Ticket #2638 suggests session save should prune state managers that try to save unsavable state. But that would probably eliminate all named selections in this case where it would b better if the named selections were saved minus the unsavable models.
comment:3 by , 6 years ago
The way this works in Chimera is that tools that want to save a reference to a model save the model id number. Then when the session is restored the tool looks up the model by its id number. When it does that lookup it might find the model does not exist and the restore code handles that (perhaps issuing a warning). So the Chimera 1 solution is that the restore code must handle the fact that models may not get restored. We were using that solution in ChimeraX until a few months ago, where session restore would replace a reference to a Model with None if that model was not saved. This caused errors because the restore code did not check if the model was restored.
comment:4 by , 6 years ago
In Chimera 1 if some session restore code forgot to check if the model was None and raised an error, it did not disable the entire session restore -- the restore of each tool had a try except around it so only that tool's restore failed.
If we made ChimeraX behave like Chimera session save/restore it would mean ChimeraX replaces references to unsaved objects with None, and when restoring, if restoring some object raises an error then an reference to that object is replaced by None and the rest of the session still restores. A drawback of this which Chimera 1 has too although I don't recall seeing Chimera 1 errors because of this, is that the restore of say a model reference to None might not raise an error, but later after the restore completes and the user does something with the tool with the None reference it raises an error. The ChimeraX case may be more prone to these problems because the tool restore code does not have to look up a Model or other object by Id. That lookup step reminds the programmer that maybe the lookup could fail. And if they ignore checking then the lookup does fail with an exception during the restore and the tool restore fails, so there are no None references left to cause errors later on.
comment:5 by , 6 years ago
We probably need to have a discussion some time when we're all here about what we want to do about this.
The returning None thing was a little different because that was happening on restore, not on save like this error. It might be okay if only Models could return None on save, and things that knew they were holding references to generic Models that might not restore would have to deal explicitly with that. That would be similar to Chimera 1 where non-molecular models went into a modelMap, keyed on ID, and restore code had to deal with the fact that in some cases those models weren't restored. I wouldn't want any arbitrary session object to be able to return None, which would force checking code into many, many more places. Anyway, we should have an in-person discussion.
comment:6 by , 6 years ago
There are further wrinkles because of hierarchies where only some of the models don't restore.
comment:7 by , 6 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Fixed.
Made 2d label models save directly in sessions instead of having parent model restore them. This allows frozen selections or other tools that refer to 2d label models to save in sessions but does not address the broader problem of how session save should handle references to unsavable models.
Recipe to reproduce:
open 1gcn
2dlabels text test
select #2
name frozen picked sel
save ~/Desktop/test.cxs