MCPcopy Create free account
hub / github.com/apache/nifi-minifi-cpp / onSchedule

Method onSchedule

extensions/script/python/ExecutePythonProcessor.cpp:101–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101void ExecutePythonProcessor::onSchedule(const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSessionFactory>& /*sessionFactory*/) {
102 if (!valid_init_) {
103 throw std::runtime_error("Could not correctly initialize " + getName());
104 }
105 try {
106 reloadScriptIfUsingScriptFileProperty();
107 if (script_to_exec_.empty()) {
108 throw std::runtime_error("Neither Script Body nor Script File is available to execute");
109 }
110 std::shared_ptr<python::PythonScriptEngine> engine = getScriptEngine();
111
112 engine->eval(script_to_exec_);
113 engine->onSchedule(context);
114
115 handleEngineNoLongerInUse(std::move(engine));
116 }
117 catch (const std::exception& exception) {
118 logger_->log_error("Caught Exception: %s", exception.what());
119 }
120 catch (...) {
121 logger_->log_error("Caught Exception");
122 }
123}
124
125void ExecutePythonProcessor::onTrigger(const std::shared_ptr<core::ProcessContext> &context, const std::shared_ptr<core::ProcessSession> &session) {
126 if (!valid_init_) {

Callers

nothing calls this directly

Calls 4

log_errorMethod · 0.80
emptyMethod · 0.45
evalMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected