biosimulators / Biosimulators_COPASI

COPASI biochemical network simulation program via BioSimulators-compliant command-line interface and Docker container
https://docs.biosimulators.org/Biosimulators_COPASI
MIT License
2 stars 3 forks source link

CCopasiException on invalid archive #26

Closed gmarupilla closed 3 years ago

gmarupilla commented 4 years ago

CCopasiException is a strange exception in the sense that it cannot be catched (excepted). I tried wrapping the calling code into try block, still everytime we feed an invalid/corrupt omex archive it completely crashes the application. Reasons are still unknown.

It crashes with an error something like this: libc++abi.dylib: terminating with uncaught exception of type CCopasiException [1] 48832 abort copasi -i ../notebooks/omexes/multi_sedml/BIOMD0000000793.omex -o

So, how should we handle it? Should we execute the omex extraction in separate thread/process so that it doesn't crash the main application? @jonrkarr

gmarupilla commented 4 years ago

For reference:

BIOMD0000000793.omex.zip

jonrkarr commented 4 years ago

If this is always an issue for the COPASI Python interface, the command line program will need to be implemented differently or COPASI will need to fix the problem.

This won't crash the main BioSimulations application because the simulation jobs will be run on the cluster. We realized that some jobs would not complete successfully, and plan to store the stdout and stderr logs. This is already part of the BioSimulations data model.

fbergmann commented 4 years ago

I'll have a look at this, in general though, it would be great if you could file issues like that on our issue tracker, so we know about them and can resolve them. I've done this now, and will track it there.

http://tracker.copasi.org/show_bug.cgi?id=2908

fbergmann commented 4 years ago

This is just to let you know that this has been resolved in the current python-copasi package on pypi (and any version > 4.29.227 will do). Now you will still get the exception, but you could handle it if you so choose:

import COPASI
dm = COPASI.CRootContainer.addDatamodel()
try:
  dm.openCombineArchive('BIOMD0000000793.omex')
except COPASI.CCopasiException as e:
  print(e.getMessage().getText())

which for your model would give you something like:

>EXCEPTION 2020-08-11T08:40:52<
  SEDML (4): Could not open file "/tmp/copasi/fbergmann/q8fkec53/Chen2011/1.xml". Note: The reference SBML model in SEDML document must be saved in the same directory as the SEDML document using the source attribute value as the file name .
jonrkarr commented 3 years ago

In my testing, this is fixed. Thanks @fbergmann!