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

fixed the get_cashflow_loc, and added the get_farm_loc #172

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/DispatchManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
sys.path.append(raven_path)
sys.path.pop()

cashflow_path = os.path.abspath(os.path.join(hutils.get_cashflow_loc(raven_path=raven_path), '..'))
cashflow_path = os.path.abspath(hutils.get_cashflow_loc(raven_path=raven_path))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change concerns me; we should have lots of failing tests currently if this change is needed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, as expected, these are the test results:

  File "/home/civet/civet/build_0/HERON/templates/template_driver.py", line 25, in <module>
    CF_LOC = hutils.get_cashflow_loc(raven_path=RAVEN_LOC)
  File "/home/civet/civet/build_0/HERON/src/_utils.py", line 52, in get_cashflow_loc
    plugin_handler = importlib.import_module('plugin_handler')
  File "/home/civet/miniconda3/envs/raven_libraries/lib/python3.7/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'plugin_handler'
 ... Errors were encountered while running HERON.

Running test failed with exit code 1
(19F16/23) Failed (  2.97sec)/home/civet/civet/build_0/HERON/tests/integration_tests/workflows/storage/Storage
(20F16/23) Success(  0.36sec)/home/civet/civet/build_0/HERON/tests/unit_tests/component
(21F16/23) Success(  0.35sec)/home/civet/civet/build_0/HERON/tests/unit_tests/ValuedParams/parametric
SKIPPED ({'heavy'} is not a subset of {'normal'})
(22F16/23) Skipped(  None!  )/home/civet/civet/build_0/HERON/tests/workshop/htse/example1_simple/Workshop_HTSE_Simple1
FAILED:
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/mechanics/ROM_source/ROMSource
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/mechanics/cashflows/Cashflows
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/mechanics/debug_mode/DebugMode
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/mechanics/hybrid_load/CashFlows_Run
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/mechanics/labels/Labels
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/mechanics/min_demand/MinDemand
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/mechanics/multimarket_fix_price/MultimarketFixPrice
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/mechanics/multirun_sweep_opt/MultiRun_Sweep
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/mechanics/optimization_settings/OptimizationSettings
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/mechanics/pyomo_options/PyomoOptions
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/mechanics/storage_func/StorageFunc
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/mechanics/validator/ValidatorExample
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/mechanics/var_demand_fix_price/VarDemandFixPrice
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/mechanics/var_demand_var_price/VarDemandVarPrice
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/workflows/production_flex/ProductionFlex
Failed /home/civet/civet/build_0/HERON/tests/integration_tests/workflows/storage/Storage

PASSED: 3
SKIPPED: 3
FAILED: 16
... there were failed tests for plugin HERON!

sys.path.append(cashflow_path)
import TEAL
from TEAL.src import CashFlows
Expand Down
17 changes: 16 additions & 1 deletion src/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,28 @@ def get_cashflow_loc(raven_path=None):
"""
if raven_path is None:
raven_path = get_raven_loc()
plugin_handler_dir = path.join(raven_path, '..', 'scripts')
plugin_handler_dir = path.join(raven_path, 'scripts')
sys.path.append(plugin_handler_dir)
plugin_handler = importlib.import_module('plugin_handler')
sys.path.pop()
cf_loc = plugin_handler.getPluginLocation('TEAL')
return cf_loc

def get_farm_loc(raven_path=None):
"""
Get FARM location in installed RAVEN
@ In, raven_path, string, optional, if given then start with this path
@ Out, cf_loc, string, location of CashFlow
"""
if raven_path is None:
raven_path = get_raven_loc()
plugin_handler_dir = path.join(raven_path, 'scripts')
sys.path.append(plugin_handler_dir)
plugin_handler = importlib.import_module('plugin_handler')
sys.path.pop()
farm_loc = plugin_handler.getPluginLocation('FARM')
return farm_loc

def get_all_resources(components):
"""
Provides a set of all resources used among all components
Expand Down