scidash / neuronunit

A package for data-driven validation of neuron and ion channel models using SciUnit
http://neuronunit.scidash.org
38 stars 24 forks source link

neuronunit/__init__.py #66

Closed russelljjarvis closed 7 years ago

russelljjarvis commented 7 years ago

The file neuronunit/__init__.py fails with the stack trace:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.5/site-packages/scoop-0.7.2.0-py3.5.egg/scoop/_control.py", line 150, in runFuture
    future.resultValue = future.callable(*future.args, **future.kargs)
  File "/opt/conda/lib/python3.5/runpy.py", line 254, in run_path
    pkg_name=pkg_name, script_name=fname)
  File "/opt/conda/lib/python3.5/runpy.py", line 96, in _run_module_code
    mod_name, mod_spec, pkg_name, script_name)
  File "/opt/conda/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "nsga.py", line 649, in <module>
    vmpop, pop, stats, invalid_ind = main()
  File "nsga.py", line 533, in main
    fitnesses = list(toolbox.map(toolbox.evaluate, pop, iter_))
  File "/opt/conda/lib/python3.5/site-packages/scoop-0.7.2.0-py3.5.egg/scoop/futures.py", line 99, in _mapGenerator
    for future in _waitAll(*futures):
  File "/opt/conda/lib/python3.5/site-packages/scoop-0.7.2.0-py3.5.egg/scoop/futures.py", line 360, in _waitAll
    for f in _waitAny(future):
  File "/opt/conda/lib/python3.5/site-packages/scoop-0.7.2.0-py3.5.egg/scoop/futures.py", line 337, in _waitAny
    raise childFuture.exceptionValue
AttributeError: 'RatioScore' object has no attribute 'unpicklable'

I am trying to conditionally make a list type of score.picklable but it seems to fail regardless:

I am using:

if not hasattr(score,'picklable'):
     score.picklable = []

which does not seem to work.

rgerkin commented 7 years ago

@russelljjarvis This is supposed to be taken care of automatically by the fact that (at least in scidash/dev) all core types now inherit from sciunit.SciUnit, which creates an unpicklable attribute in its constructor. If this is working, then why do we also need a picklable attribute as well? Shouldn't everything that is not unpicklable be picklable?

russelljjarvis commented 7 years ago

Sorry yes, it was supposed to read:

if not hasattr(score,'unpicklable'):
     score.unpicklable = []

I must have been tired when writing it.

I can confirm that the lines:

class SciUnit(object):
    """Abstract base class for models, tests, and scores."""
    def __init__(self):
        self.unpicklable = [] # Attributes that cannot or should n

are still in sciunit, note that this seems to satisfy all of the tests in the suite besides class RheobaseTest(VmTest), which is the only test to contain score type of scores.RatioScore. I am unsure why it fails for scores.RatioScore but not the other score types. Looking into this now.

rgerkin commented 7 years ago

I think if I add unpicklable = [] as an attribute to the SciUnit class, not just create it in the constructor, then any subclass instance should have that attribute even if somehow the constructor never got called. I think the constructor isn't getting called because you are somehow putting instances of tests into test suites with attributes that were not fully realized by the usual route.

rgerkin commented 7 years ago

Done in scidash/sciunit@e6f7009308da71086e2451c2c927d485d3b4c631. Check to see if this works for you know, @russelljjarvis.

rgerkin commented 7 years ago

I think this is fixed or obsolete with the new Backend implementation.