idaholab / HERON

Holistic Energy Resource Optimization Network (HERON) is a modeling toolset and plugin for RAVEN to accelerate stochastic technoeconomic assessment of the economic viability of various grid-energy system configurations, especially with application to electrical grids and integrated energy systems (IES).
Apache License 2.0
24 stars 38 forks source link

[DEFECT] Remove Extraneous Tracebacks from HERON output #262

Closed dylanjm closed 1 year ago

dylanjm commented 1 year ago

Defect Description

Describe the defect

Currently, there is a bunch of extra output that is shown to the user when they run HERON:

Starting HERON ...
 ... RAVEN located at "/Users/mcdodj/Documents/projects/raven"
 ... Activating CONDA environment ...
CONDA
raven_libraries          /usr/local/Caskroom/miniconda/base/envs/raven_libraries
Running HERON ...
Loading plugin "HERON" at /Users/mcdodj/Documents/projects/HERON
 ... successfully imported "HERON" ...
Loading plugin "TEAL" at /Users/mcdodj/Documents/projects/raven/plugins/TEAL
 ... successfully imported "TEAL" ...
Loading plugin "ExamplePlugin" at /Users/mcdodj/Documents/projects/raven/plugins/ExamplePlugin
 ... successfully imported "ExamplePlugin" ...
WARNING: get_raven_loc deprecated
  File "/Users/mcdodj/Documents/projects/HERON/src/main.py", line 19, in <module>
    from HERON.src import input_loader
  File "/usr/local/Caskroom/miniconda/base/envs/raven_libraries/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/feature.py", line 139, in _import
    return original_import(name, *args, **kwargs)
  File "<frozen importlib._bootstrap>", line 1078, in _handle_fromlist
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/mcdodj/Documents/projects/HERON/src/../../HERON/src/input_loader.py", line 10, in <module>
    from . import Cases
  File "/usr/local/Caskroom/miniconda/base/envs/raven_libraries/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/feature.py", line 139, in _import
    return original_import(name, *args, **kwargs)
  File "<frozen importlib._bootstrap>", line 1078, in _handle_fromlist
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/mcdodj/Documents/projects/HERON/src/../../HERON/src/Cases.py", line 22, in <module>
    from HERON.src.validators.Factory import known as known_validators
  File "/usr/local/Caskroom/miniconda/base/envs/raven_libraries/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/feature.py", line 139, in _import
    return original_import(name, *args, **kwargs)
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/mcdodj/Documents/projects/HERON/src/../../HERON/src/validators/Factory.py", line 16, in <module>
    raven_path = hutils.get_raven_loc()
  File "/Users/mcdodj/Documents/projects/HERON/src/_utils.py", line 47, in get_raven_loc
    traceback.print_stack()
DISPATCHES has not been found in current conda environment. This is only needed when running the DISPATCHES workflow through HERD.
WARNING: get_raven_loc deprecated
  File "/Users/mcdodj/Documents/projects/HERON/src/main.py", line 22, in <module>
    from HERON.src.Herd import HERD
  File "/usr/local/Caskroom/miniconda/base/envs/raven_libraries/lib/python3.10/site-packages/shiboken2/files.dir/shibokensupport/feature.py", line 139, in _import
    return original_import(name, *args, **kwargs)
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/mcdodj/Documents/projects/HERON/src/../../HERON/src/Herd.py", line 42, in <module>
    path_to_raven = hutils.get_raven_loc()
  File "/Users/mcdodj/Documents/projects/HERON/src/_utils.py", line 47, in get_raven_loc
    traceback.print_stack()
(    2.03 sec) <HERON activity>         : Message         -> Tracking variable not specified; using "production" ...
(    2.03 sec) <HERON activity>         : Message         -> Tracking variable not specified; using "production" ...
(    2.03 sec) <HERON activity>         : Message         -> Tracking variable not specified; using "production" ...
(    2.03 sec) <HERON CSV>       : Message -> Checking CSV at "/Users/mcdodj/Desktop/fpoli/average_lmp_2021.csv"
(    2.04 sec) <HERON CSV>       : Message -> For DataGenerator <CSV> "flex", detected:  interpolated,  clustered.
WARNING: get_raven_loc deprecated
  File "/Users/mcdodj/Documents/projects/HERON/src/main.py", line 182, in <module>
    main()
  File "/Users/mcdodj/Documents/projects/HERON/src/main.py", line 174, in main
    sim.create_raven_workflow()
  File "/Users/mcdodj/Documents/projects/HERON/src/main.py", line 113, in create_raven_workflow
    case.write_workflows(self._components, self._sources, self._input_dir)
  File "/Users/mcdodj/Documents/projects/HERON/src/../../HERON/src/Cases.py", line 878, in write_workflows
    template_class = self._load_template()
  File "/Users/mcdodj/Documents/projects/HERON/src/../../HERON/src/Cases.py", line 896, in _load_template
    module = importlib.import_module(f'templates.{template_name}', package="HERON")
  File "/usr/local/Caskroom/miniconda/base/envs/raven_libraries/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/Users/mcdodj/Documents/projects/HERON/templates/template_driver.py", line 25, in <module>
    RAVEN_LOC = os.path.abspath(os.path.join(hutils.get_raven_loc(), "ravenframework"))
  File "/Users/mcdodj/Documents/projects/HERON/src/../../HERON/src/_utils.py", line 47, in get_raven_loc
    traceback.print_stack()
(    2.41 sec) <Template Driver> : Message -> Using Static History - replacing EnsembleModel with CustomSampler strategy
(    2.41 sec) <Template Driver> : Message -> Using Static History - removing unneeded post-processor statistics "sigma" & "variance"
(    2.41 sec) <Template Driver> : Message -> ========================
(    2.41 sec) <Template Driver> : Message -> HERON: writing files ...
(    2.41 sec) <Template Driver> : Message -> ========================
(    2.41 sec) <Template Driver> : Message -> Wrote "outer.xml" to "/Users/mcdodj/Desktop/fpoli/"
(    2.41 sec) <Template Driver> : Message -> Wrote "inner.xml" to "/Users/mcdodj/Desktop/fpoli/"
(    2.41 sec) <Template Driver> : Message -> Wrote "cash.xml" to "/Users/mcdodj/Desktop/fpoli/"
(    2.42 sec) <Template Driver> : Message -> Wrote "heron.lib" to "/Users/mcdodj/Desktop/fpoli/"
(    2.42 sec) <Template Driver> : Message -> Wrote "write_inner.py" to "/Users/mcdodj/Desktop/fpoli/"
 ... HERON completed successfully.
What did you expect to see happen?

Something like:

Starting HERON ...
 ... RAVEN located at "/Users/mcdodj/Documents/projects/raven"
 ... Activating CONDA environment ...
CONDA
raven_libraries          /usr/local/Caskroom/miniconda/base/envs/raven_libraries
Running HERON ...
Loading plugin "HERON" at /Users/mcdodj/Documents/projects/HERON
 ... successfully imported "HERON" ...
Loading plugin "TEAL" at /Users/mcdodj/Documents/projects/raven/plugins/TEAL
 ... successfully imported "TEAL" ...
Loading plugin "ExamplePlugin" at /Users/mcdodj/Documents/projects/raven/plugins/ExamplePlugin
 ... successfully imported "ExamplePlugin" ...
(    2.03 sec) <HERON activity>         : Message         -> Tracking variable not specified; using "production" ...
(    2.03 sec) <HERON activity>         : Message         -> Tracking variable not specified; using "production" ...
(    2.03 sec) <HERON activity>         : Message         -> Tracking variable not specified; using "production" ...
(    2.03 sec) <HERON CSV>       : Message -> Checking CSV at "/Users/mcdodj/Desktop/fpoli/average_lmp_2021.csv"
(    2.04 sec) <HERON CSV>       : Message -> For DataGenerator <CSV> "flex", detected:  interpolated,  clustered.
(    2.41 sec) <Template Driver> : Message -> Using Static History - replacing EnsembleModel with CustomSampler strategy
(    2.41 sec) <Template Driver> : Message -> Using Static History - removing unneeded post-processor statistics "sigma" & "variance"
(    2.41 sec) <Template Driver> : Message -> ========================
(    2.41 sec) <Template Driver> : Message -> HERON: writing files ...
(    2.41 sec) <Template Driver> : Message -> ========================
(    2.41 sec) <Template Driver> : Message -> Wrote "outer.xml" to "/Users/mcdodj/Desktop/fpoli/"
(    2.41 sec) <Template Driver> : Message -> Wrote "inner.xml" to "/Users/mcdodj/Desktop/fpoli/"
(    2.41 sec) <Template Driver> : Message -> Wrote "cash.xml" to "/Users/mcdodj/Desktop/fpoli/"
(    2.42 sec) <Template Driver> : Message -> Wrote "heron.lib" to "/Users/mcdodj/Desktop/fpoli/"
(    2.42 sec) <Template Driver> : Message -> Wrote "write_inner.py" to "/Users/mcdodj/Desktop/fpoli/"
 ... HERON completed successfully.
What did you see instead?
Do you have a suggested fix for the development team?

Describe how to Reproduce Steps to reproduce the behavior:

Screenshots and Input Files Please attach the input file(s) that generate this error. The simpler the input, the faster we can find the issue.

Platform (please complete the following information):


For Change Control Board: Issue Review

This review should occur before any development is performed as a response to this issue.


For Change Control Board: Issue Closure

This review should occur when the issue is imminently going to be closed.

dylanjm commented 1 year ago

This issue can be closed as it was fixed in #269