Skip to content

Commit

Permalink
adding to test_plugin.py; renaming finalization
Browse files Browse the repository at this point in the history
  • Loading branch information
bknueven committed Aug 18, 2021
1 parent 159f02a commit aeb4017
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion prescient/plugins/internal.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def __init__(self):
'before_operations_solve',
'before_ruc_solve',
'after_operations',
'after_simulation']
'finalization']
for cb in callbacks:
self._setup_callback(cb)

Expand Down
4 changes: 2 additions & 2 deletions prescient/plugins/plugin_registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,10 @@ def register_update_operations_stats_callback(callback: Callable[[Options, Simul
'''
get_active_plugin_manager().register_update_operations_stats_callback(callback)

def register_after_simulation_callback(callback: Callable[[Options, Simulator], None]) -> None:
def register_finalization_callback(callback: Callable[[Options, Simulator], None]) -> None:
''' Request a method be called after prescient simulation is over.
'''
get_active_plugin_manager().register_after_simulation_callback(callback)
get_active_plugin_manager().register_finalization_callback(callback)



Expand Down
2 changes: 1 addition & 1 deletion prescient/simulator/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def simulate(self, options):

stats_manager.end_simulation()

self.plugin_manager.invoke_after_simulation_callbacks(options, self)
self.plugin_manager.invoke_finalization_callbacks(options, self)

print("Simulation Complete")
import time
Expand Down
4 changes: 4 additions & 0 deletions tests/simulator_tests/test_cases/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,7 @@ def after_operations_callback(options, simulator, sced_model):
def update_operations_stats_callback(options, simulator, operations_stats):
msg('update_operations_stats_callback', options)
pplugins.register_update_operations_stats_callback(update_operations_stats_callback)

def finalization_callback(options, simulator):
msg('finalization_callback', options)
pplugins.register_finalization_callback(finalization_callback)

0 comments on commit aeb4017

Please sign in to comment.