Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Agents Metric #27

Merged
merged 8 commits into from
Feb 11, 2015
Merged

Agents Metric #27

merged 8 commits into from
Feb 11, 2015

Conversation

scopatz
Copy link
Member

@scopatz scopatz commented Feb 9, 2015

This implements an "Agents" table and metric that matches the schema and semantics of a table by the same name that is generated by cyclist. It also addresses a deficiency in the cyclist table where the ExitTime could be greater than the duration. Some fixes, ui improvements, and interfaces have been updated along the way.

@rwcarlsen
Copy link
Member

If the exit time is not specified in the original db and the agent was never scheduled for decommissioning, what is put in the ExitTime column here? - I'm not familiar enough with pandas to know by just looking at the code. The value should be maintained as "NULL", -1, or some other such non-normal value because no exit time is semantically different to cyclus than a future or end of sim exit time - particularly w.r.t. restart/branching.

@opotowsky
Copy link
Member

I'm getting errors when I run nosetests that relate to the tests not being able to import cyclus

@scopatz
Copy link
Member Author

scopatz commented Feb 10, 2015

I'm getting errors when I run nosetests that relate to the tests not being able to import cyclus

What directory are you in?

@opotowsky
Copy link
Member

cymetric/tests when I run nosetests

@scopatz
Copy link
Member Author

scopatz commented Feb 10, 2015

hmmm can you post the error please?

@scopatz
Copy link
Member Author

scopatz commented Feb 10, 2015

Did you re-install?

@opotowsky
Copy link
Member

I did reinstall cymetric (oh so cleanly)

Here are the errors I get:

opotowsky_eats_CakeBalls ~/cyclus/cymetric/tests (master) $ nosetests
EEEE
======================================================================
ERROR: Failure: AttributeError (attribute '__doc__' of 'type' objects is not writable)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 414, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/opotowsky/cyclus/cymetric/tests/test_cyclus.py", line 9, in <module>
    from cymetric import cyclus
  File "/home/opotowsky/.local/lib/python2.7/site-packages/cymetric/__init__.py", line 10, in <module>
    from cymetric.metrics import Metric, metric
  File "/home/opotowsky/.local/lib/python2.7/site-packages/cymetric/metrics.py", line 77, in <module>
    @metric(name='Materials', depends=_matdeps, schema=_matschema)
  File "/home/opotowsky/.local/lib/python2.7/site-packages/cymetric/metrics.py", line 58, in dec
    return _genmetricclass(f=f, name=clsname, scheme=schema, depends=depends)
  File "/home/opotowsky/.local/lib/python2.7/site-packages/cymetric/metrics.py", line 50, in _genmetricclass
    Cls.__doc__ = inspect.getdoc(f)
AttributeError: attribute '__doc__' of 'type' objects is not writable

======================================================================
ERROR: Failure: ImportError (cannot import name cyclus)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 414, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/opotowsky/cyclus/cymetric/tests/test_evaluator.py", line 7, in <module>
    from cymetric import evaluator
  File "/home/opotowsky/.local/lib/python2.7/site-packages/cymetric/__init__.py", line 10, in <module>
    from cymetric.metrics import Metric, metric
  File "/home/opotowsky/.local/lib/python2.7/site-packages/cymetric/metrics.py", line 9, in <module>
    from cymetric import cyclus
ImportError: cannot import name cyclus

======================================================================
ERROR: Failure: ImportError (cannot import name cyclus)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 414, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/opotowsky/cyclus/cymetric/tests/test_metrics.py", line 15, in <module>
    from cymetric import cyclus
  File "/home/opotowsky/.local/lib/python2.7/site-packages/cymetric/__init__.py", line 10, in <module>
    from cymetric.metrics import Metric, metric
  File "/home/opotowsky/.local/lib/python2.7/site-packages/cymetric/metrics.py", line 9, in <module>
    from cymetric import cyclus
ImportError: cannot import name cyclus

======================================================================
ERROR: Failure: ImportError (cannot import name cyclus)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/loader.py", line 414, in loadTestsFromName
    addr.filename, addr.module)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 47, in importFromPath
    return self.importFromDir(dir_path, fqname)
  File "/usr/lib/python2.7/dist-packages/nose/importer.py", line 94, in importFromDir
    mod = load_module(part_fqname, fh, filename, desc)
  File "/home/opotowsky/cyclus/cymetric/tests/test_root_metrics.py", line 10, in <module>
    from cymetric import cyclus
  File "/home/opotowsky/.local/lib/python2.7/site-packages/cymetric/__init__.py", line 10, in <module>
    from cymetric.metrics import Metric, metric
  File "/home/opotowsky/.local/lib/python2.7/site-packages/cymetric/metrics.py", line 9, in <module>
    from cymetric import cyclus
ImportError: cannot import name cyclus

----------------------------------------------------------------------
Ran 4 tests in 0.321s

FAILED (errors=4)

@scopatz
Copy link
Member Author

scopatz commented Feb 10, 2015

@rwcarlsen

If the exit time is not specified in the original db and the agent was never scheduled for decommissioning, what is put in the ExitTime column here?

It puts in the simulation duration from the Info table. I think that this is better than what cyclist does, which is to add the simulation duration to the EnterTime. For example, if the simulation duration is 100, and the enter time for an agent is 10, then cymetric will use 100 as the exit time and cyclist will use 110.

The value should be maintained as "NULL", -1, or some other such non-normal value because no exit time is semantically different to cyclus than a future or end of sim exit time - particularly w.r.t. restart/branching.

It is maintained in the appropriate tables (AgentEnter, AgentExit, DecomSched, etc). The Agents table, like in cyclist is present for analysis and visualization, not for restart. It is there to be able to figure out in a consistent manner when agents are alive. Calling the last column AgentExit is probably a misnomer, but I was trying to match the cyclist table. It is hard to create a plot when the upper value of the time range is NaN :). I hope that this explains it.

@scopatz
Copy link
Member Author

scopatz commented Feb 10, 2015

@opotowsky this seems to be a Python 2 issue, or at least the first one is.

@opotowsky
Copy link
Member

I clean installed both cyclus and cymetric and am still getting the import errors. Should I worry about the first error?

@scopatz
Copy link
Member Author

scopatz commented Feb 10, 2015

I'll try to get a fix in for these later today.

@opotowsky
Copy link
Member

thanks so much!

@scopatz
Copy link
Member Author

scopatz commented Feb 10, 2015

@opotowsky can you try the docstring fix I have just pushed up?

@opotowsky
Copy link
Member

Thanks for the quick fix, but now I get this!

opotowsky_eats_CakeBalls ~/cyclus/cymetric/tests (master) $ nosetests
..........E..
======================================================================
ERROR: test_metrics.test_agents
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/opotowsky/cyclus/cymetric/tests/test_metrics.py", line 40, in test_agents
    ('EnterTime', '<i8'), ('ExitTime', '<f8')])
TypeError: data type not understood

----------------------------------------------------------------------
Ran 13 tests in 0.721s

FAILED (errors=1)

@scopatz
Copy link
Member Author

scopatz commented Feb 10, 2015

Ok! Try this.

@scopatz
Copy link
Member Author

scopatz commented Feb 11, 2015

Alright, I have now updated this to actually work on Python 2. Sorry it took me a while. I had to install Python 2, etc :)

@opotowsky
Copy link
Member

On my bat-loving, hdf5-hating computer now so those are the only test failures. Excitedly merging, thanks @scopatz!

opotowsky added a commit that referenced this pull request Feb 11, 2015
@opotowsky opotowsky merged commit c523463 into cyclus:master Feb 11, 2015
@scopatz scopatz deleted the agents branch February 11, 2015 05:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants