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

Method getScriptEngine

extensions/script/python/ExecutePythonProcessor.cpp:152–165  ·  view source on GitHub ↗

TODO(hunyadi): This is potentially not what we want. See https://issues.apache.org/jira/browse/MINIFICPP-1222

Source from the content-addressed store, hash-verified

150
151// TODO(hunyadi): This is potentially not what we want. See https://issues.apache.org/jira/browse/MINIFICPP-1222
152std::shared_ptr<python::PythonScriptEngine> ExecutePythonProcessor::getScriptEngine() {
153 std::shared_ptr<python::PythonScriptEngine> engine;
154 // Use an existing engine, if one is available
155 if (script_engine_q_.try_dequeue(engine)) {
156 logger_->log_debug("Using available [%p] script engine instance", engine.get());
157 return engine;
158 }
159 engine = createEngine<python::PythonScriptEngine>();
160 logger_->log_info("Created new [%p] script engine instance. Number of instances: approx. %d / %d.", engine.get(), script_engine_q_.size_approx(), getMaxConcurrentTasks());
161 if (engine == nullptr) {
162 throw std::runtime_error("No script engine available");
163 }
164 return engine;
165}
166
167void ExecutePythonProcessor::handleEngineNoLongerInUse(std::shared_ptr<python::PythonScriptEngine>&& engine) {
168 // Make engine available for use again

Callers

nothing calls this directly

Calls 3

log_debugMethod · 0.80
log_infoMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected