[
https://issues.apache.org/jira/browse/MINIFICPP-1355?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gabor Gyimesi reassigned MINIFICPP-1355:
----------------------------------------
Assignee: Gabor Gyimesi
> Investigate and fix the initialization of ExecutePythonProcessor
> ----------------------------------------------------------------
>
> Key: MINIFICPP-1355
> URL: https://issues.apache.org/jira/browse/MINIFICPP-1355
> Project: Apache NiFi MiNiFi C++
> Issue Type: Task
> Affects Versions: 0.7.0
> Reporter: Adam Hunyadi
> Assignee: Gabor Gyimesi
> Priority: Minor
> Labels: MiNiFi-CPP-Hygiene
> Fix For: 1.0.0
>
> Attachments: Screenshot 2020-09-04 at 16.02.41.png
>
>
> *Acceptance criteria:*
> - GIVEN a flow set up as highlighted in blue below
> - WHEN the flow is with a python script set to add a new attribute to a flow
> file
> - THEN no error is produced and the newly added attribute is logged in
> LogAttribute
> {code:c++|title=Example script}
> def describe(processor):
> processor.setDescription("Adds an attribute to your flow files")
> def onInitialize(processor):
> processor.setSupportsDynamicProperties()
> def onTrigger(context, session):
> flow_file = session.get()
> if flow_file is not None:
> flow_file.addAttribute("Python attribute","attributevalue")
> session.transfer(flow_file, REL_SUCCESS)
> {code}
> *Background:*
> Currently, even though the tests for ExecutePythonProcessor are passing, if I
> were to try and load up a configuration that contains an
> ExecutePythonProcessor, it fails due to trying to load an incorrect script
> file.
> Sample flow:
> {color:#0747a6}GenerateFlowFile -(success)-> ExecutePythonProcessor
> -(success,failure)-> LogAttribute{color}
> When trying to check in debugger, it seems like the processors script file is
> always replaced with an incorrect one, and the processor fails to start.
> This is how it is set:
> {code:c++|title=Trace of where the property is overridden}
> ConfigurableComponent::setProperty()
> std::shared_ptr<core::CoreComponent> create()
> ClassLoader::instantiate()
> PythonCreator::configure() <- here the first element of classpaths_ is read
> to overwrite the config
> FlowController::initializeExternalComponents()
> {code}
> When trying to perform the same thing on the 0.7.0 release version, the
> startup already shows some kind of errors, although they seem different:
> {code:python|title=Error log}
> [2020-09-04 15:49:53.424]
> [org::apache::nifi::minifi::python::processors::ExecutePythonProcessor]
> [error] Caught Exception ModuleNotFoundError: No module named 'google'
> At:
>
> /Users/adamhunyadi/Documents/Projects/integration_tests/minifi_agent_02/build/nifi-minifi-cpp-0.7.0/minifi-python//google/SentimentAnalyzer.py(28):
> <module>
> [2020-09-04 15:49:53.424] [org::apache::nifi::minifi::python::PythonCreator]
> [warning] Cannot load SentimentAnalyzer because of ModuleNotFoundError: No
> module named 'google'
> At:
>
> /Users/adamhunyadi/Documents/Projects/integration_tests/minifi_agent_02/build/nifi-minifi-cpp-0.7.0/minifi-python//google/SentimentAnalyzer.py(28):
> <module>
> [2020-09-04 15:49:53.424]
> [org::apache::nifi::minifi::python::processors::ExecutePythonProcessor]
> [error] Caught Exception ModuleNotFoundError: No module named 'vaderSentiment'
> At:
>
> /Users/adamhunyadi/Documents/Projects/integration_tests/minifi_agent_02/build/nifi-minifi-cpp-0.7.0/minifi-python//examples/SentimentAnalysis.py(17):
> <module>
> [2020-09-04 15:49:53.424] [org::apache::nifi::minifi::python::PythonCreator]
> [warning] Cannot load SentimentAnalysis because of ModuleNotFoundError: No
> module named 'vaderSentiment'
> At:
>
> /Users/adamhunyadi/Documents/Projects/integration_tests/minifi_agent_02/build/nifi-minifi-cpp-0.7.0/minifi-python//examples/SentimentAnalysis.py(17):
> <module>
> {code}
> *Proposal:*
> One should investigate and fix the error.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)