Opened 10 years ago

Closed 9 years ago

Last modified 8 years ago

#236 closed defect (fixed)

Saving a session with an unknown model type gives an error

Reported by: Tom Goddard Owned by: Greg Couch
Priority: major Milestone: 0.5
Component: Sessions Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Saving a session with an unknown model type fails with an error. It should simply warn that that model will not be saved. As it is now any tool that makes a model can completely disable session saving.

The example below is for a volume model and I will be adding session support for that. But the session saving should in all cases not die when it finds a model it can't save.

open 1080 from emdb
save ~/Desktop/test.cxs

Traceback (most recent call last):
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/cmd_line/gui.py", line 121, in on_enter
cmd.execute()
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/cli.py", line 1822, in execute
results.append(ci.function(session, kw_args))
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/save.py", line 48, in save
save_session(session, filename)
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/session.py", line 498, in save
session.save(output)
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/session.py", line 407, in save
mgr.discovery(self._state_containers)
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/session.py", line 196, in discovery
self.processed[key] = self.process(obj)
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/session.py", line 214, in process
return copy_state(data, convert=self._add_obj)
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/state.py", line 152, in copy_state
return _copy(data)
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/state.py", line 150, in _copy
items = [_copy(o) for o in data]
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/state.py", line 150, in <listcomp>
items = [_copy(o) for o in data]
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/state.py", line 143, in _copy
items = [(_copy(k), _copy(v)) for k, v in data.items()]
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/state.py", line 143, in <listcomp>
items = [(_copy(k), _copy(v)) for k, v in data.items()]
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/state.py", line 136, in _copy
return convert(data)
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/session.py", line 202, in _add_obj
uid = _UniqueName.from_obj(obj)
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/session.py", line 98, in from_obj
raise RuntimeError('unable to restore objects of %s class' % class_name)
RuntimeError: unable to restore objects of Volume class

Change History (5)

comment:1 by Scooter Morris, 9 years ago

Milestone: Alpha Release

comment:2 by Conrad Huang, 9 years ago

We should change session._SaveManager so that its discovery method records None for unserializable objects instead of raising an exception, as well as keeping track of which objects are unserializable. We can then add a pass after discovery if there were problems. The subsequent pass can:

  1. Identify which objects in state containers are unsavable
  2. Query state containers for descriptions of unsavable objects
  3. Perhaps query user in UI whether to "Save anyway"
  4. If save anyway, skip unsavable objects

NOTE: "unserializable" and "unsavable" are different. Unserializable objects can occur anywhere. Unsavable objects are those in state containers that ultimately contains at least one unserializable object.

comment:3 by Conrad Huang, 9 years ago

Milestone: Alpha ReleaseBeta Release

Too much to do for alpha.

comment:4 by Greg Couch, 9 years ago

Resolution: fixed
Status: newclosed

It no longer throws a RuntimeError, instead it logs a warning and treats the unrestorable object as None. The Models state manager skips models that are None.

comment:5 by Eric Pettersen, 8 years ago

Milestone: Beta Release0.5

Milestone renamed

Note: See TracTickets for help on using tickets.