mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #5699 from bska/log-pyaction
Add Logging for Python Actions
This commit is contained in:
commit
0a128e8a17
@ -70,6 +70,16 @@ namespace {
|
|||||||
time_point, reportStep, reportStep + 1);
|
time_point, reportStep, reportStep + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void logActivePyAction(const std::string& actionName,
|
||||||
|
const std::string& timeString)
|
||||||
|
{
|
||||||
|
const auto message =
|
||||||
|
fmt::format("Action {} (Python) triggered at {}",
|
||||||
|
actionName, timeString);
|
||||||
|
|
||||||
|
Opm::OpmLog::info("ACTION_TRIGGERED", message);
|
||||||
|
}
|
||||||
|
|
||||||
void logActiveAction(const std::string& actionName,
|
void logActiveAction(const std::string& actionName,
|
||||||
const std::vector<std::string>& matchingWells,
|
const std::vector<std::string>& matchingWells,
|
||||||
const std::string& timeString)
|
const std::string& timeString)
|
||||||
@ -87,6 +97,16 @@ namespace {
|
|||||||
Opm::OpmLog::info("ACTION_TRIGGERED", message);
|
Opm::OpmLog::info("ACTION_TRIGGERED", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void logInactivePyAction(const std::string& actionName,
|
||||||
|
const std::string& timeString)
|
||||||
|
{
|
||||||
|
const auto message =
|
||||||
|
fmt::format("Action {} (Python) NOT triggered at {}.",
|
||||||
|
actionName, timeString);
|
||||||
|
|
||||||
|
Opm::OpmLog::debug("NAMED_ACTION_NOT_TRIGGERED", message);
|
||||||
|
}
|
||||||
|
|
||||||
void logInactiveAction(const std::string& actionName,
|
void logInactiveAction(const std::string& actionName,
|
||||||
const std::string& timeString)
|
const std::string& timeString)
|
||||||
{
|
{
|
||||||
@ -149,6 +169,17 @@ applyActions(const int reportStep,
|
|||||||
for (const auto& pyaction : actions.pending_python(actionState_)) {
|
for (const auto& pyaction : actions.pending_python(actionState_)) {
|
||||||
auto sim_update = schedule_.runPyAction(reportStep, *pyaction, actionState_,
|
auto sim_update = schedule_.runPyAction(reportStep, *pyaction, actionState_,
|
||||||
ecl_state_, summaryState_);
|
ecl_state_, summaryState_);
|
||||||
|
|
||||||
|
if (const auto pyRes = this->actionState_.python_result(pyaction->name());
|
||||||
|
!pyRes.has_value() || !*pyRes)
|
||||||
|
{
|
||||||
|
logInactivePyAction(pyaction->name(), ts);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
logActivePyAction(pyaction->name(), ts);
|
||||||
|
}
|
||||||
|
|
||||||
this->applySimulatorUpdate(reportStep, sim_update, commit_wellstate, transUp);
|
this->applySimulatorUpdate(reportStep, sim_update, commit_wellstate, transUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user