You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by ma...@apache.org on 2024/04/23 19:52:23 UTC
(nifi-minifi-cpp) 02/04: MINIFICPP-2333 Don't register example python processors
This is an automated email from the ASF dual-hosted git repository.
martinzink pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git
commit ce21634035a7fbe491d073426d966b18d1769dfd
Author: Gabor Gyimesi <ga...@gmail.com>
AuthorDate: Tue Apr 23 13:09:13 2024 +0200
MINIFICPP-2333 Don't register example python processors
Closes #1765
Signed-off-by: Martin Zink <ma...@apache.org>
---
CMakeLists.txt | 4 ++++
docker/test/integration/cluster/ContainerStore.py | 3 +++
.../test/integration/cluster/DockerTestCluster.py | 3 +++
docker/test/integration/cluster/ImageStore.py | 10 ++++++++++
.../cluster/containers/MinifiContainer.py | 3 +++
.../features/MiNiFi_integration_test_driver.py | 3 +++
docker/test/integration/features/python.feature | 9 ++++++---
docker/test/integration/features/steps/steps.py | 5 +++++
.../AddPythonAttribute.py | 0
.../CountingProcessor.py | 0
.../GaussianDistributionWithNumpy.py | 0
.../MoveContentToJson.py | 0
.../RemoveFlowFile.py | 0
.../SentimentAnalysis.py | 0
msi/WixWin.wsi.in | 21 +++++++++++----------
15 files changed, 48 insertions(+), 13 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 42d47ba49..cb91f9821 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -556,6 +556,10 @@ if (NOT WIN32)
DESTINATION minifi-python
COMPONENT bin)
+ install(DIRECTORY extensions/python/pythonprocessor-examples/
+ DESTINATION minifi-python-examples
+ COMPONENT bin)
+
install(PROGRAMS bin/minifi.sh bin/minifi.service
DESTINATION bin
COMPONENT bin)
diff --git a/docker/test/integration/cluster/ContainerStore.py b/docker/test/integration/cluster/ContainerStore.py
index 8b17ee6ba..bd775ecea 100644
--- a/docker/test/integration/cluster/ContainerStore.py
+++ b/docker/test/integration/cluster/ContainerStore.py
@@ -370,6 +370,9 @@ class ContainerStore:
def enable_log_metrics_publisher_in_minifi(self):
self.minifi_options.enable_log_metrics_publisher = True
+ def enable_example_minifi_python_processors(self):
+ self.minifi_options.enable_example_minifi_python_processors = True
+
def get_startup_finished_log_entry(self, container_name):
container_name = self.get_container_name_with_postfix(container_name)
return self.containers[container_name].get_startup_finished_log_entry()
diff --git a/docker/test/integration/cluster/DockerTestCluster.py b/docker/test/integration/cluster/DockerTestCluster.py
index 5451f67b6..04205a64a 100644
--- a/docker/test/integration/cluster/DockerTestCluster.py
+++ b/docker/test/integration/cluster/DockerTestCluster.py
@@ -128,6 +128,9 @@ class DockerTestCluster:
def enable_log_metrics_publisher_in_minifi(self):
self.container_store.enable_log_metrics_publisher_in_minifi()
+ def enable_example_minifi_python_processors(self):
+ self.container_store.enable_example_minifi_python_processors()
+
def get_app_log(self, container_name):
container_name = self.container_store.get_container_name_with_postfix(container_name)
log_source = self.container_store.log_source(container_name)
diff --git a/docker/test/integration/cluster/ImageStore.py b/docker/test/integration/cluster/ImageStore.py
index 7a6e6cad6..e728da9a5 100644
--- a/docker/test/integration/cluster/ImageStore.py
+++ b/docker/test/integration/cluster/ImageStore.py
@@ -48,6 +48,8 @@ class ImageStore:
if container_engine == "minifi-cpp-sql":
image = self.__build_minifi_cpp_sql_image()
+ elif container_engine == "minifi-cpp-with-example-python-processors":
+ image = self.__build_minifi_cpp_image_with_example_minifi_python_processors()
elif container_engine == "minifi-cpp-nifi-python":
image = self.__build_minifi_cpp_image_with_nifi_python_processors(PythonOptions.REQUIREMENTS_FILE)
elif container_engine == "minifi-cpp-nifi-python-system-python-packages":
@@ -105,6 +107,14 @@ class ImageStore:
return self.__build_image(dockerfile)
+ def __build_minifi_cpp_image_with_example_minifi_python_processors(self):
+ dockerfile = dedent("""\
+ FROM {base_image}
+ RUN cp -r /opt/minifi/minifi-current/minifi-python-examples /opt/minifi/minifi-current/minifi-python/examples
+ """.format(base_image='apacheminificpp:' + MinifiContainer.MINIFI_TAG_PREFIX + MinifiContainer.MINIFI_VERSION))
+
+ return self.__build_image(dockerfile)
+
def __build_minifi_cpp_image_with_nifi_python_processors(self, python_option):
parse_document_url = "https://raw.githubusercontent.com/apache/nifi/rel/nifi-" + NifiContainer.NIFI_VERSION + "/nifi-python-extensions/nifi-text-embeddings-module/src/main/python/ParseDocument.py"
chunk_document_url = "https://raw.githubusercontent.com/apache/nifi/rel/nifi-" + NifiContainer.NIFI_VERSION + "/nifi-python-extensions/nifi-text-embeddings-module/src/main/python/ChunkDocument.py"
diff --git a/docker/test/integration/cluster/containers/MinifiContainer.py b/docker/test/integration/cluster/containers/MinifiContainer.py
index 6d6e8a6f5..db1dbd191 100644
--- a/docker/test/integration/cluster/containers/MinifiContainer.py
+++ b/docker/test/integration/cluster/containers/MinifiContainer.py
@@ -42,6 +42,7 @@ class MinifiOptions:
self.set_ssl_context_properties = False
self.enable_controller_socket = False
self.enable_log_metrics_publisher = False
+ self.enable_example_minifi_python_processors = False
class MinifiContainer(FlowContainer):
@@ -177,6 +178,8 @@ class MinifiContainer(FlowContainer):
if self.options.enable_sql:
image = self.image_store.get_image('minifi-cpp-sql')
+ elif self.options.enable_example_minifi_python_processors:
+ image = self.image_store.get_image('minifi-cpp-with-example-python-processors')
elif self.options.use_nifi_python_processors_with_system_python_packages_installed:
image = self.image_store.get_image('minifi-cpp-nifi-python-system-python-packages')
elif self.options.use_nifi_python_processors_with_virtualenv or self.options.use_nifi_python_processors_with_virtualenv_packages_installed:
diff --git a/docker/test/integration/features/MiNiFi_integration_test_driver.py b/docker/test/integration/features/MiNiFi_integration_test_driver.py
index 383d751a9..2dad89e20 100644
--- a/docker/test/integration/features/MiNiFi_integration_test_driver.py
+++ b/docker/test/integration/features/MiNiFi_integration_test_driver.py
@@ -474,6 +474,9 @@ class MiNiFi_integration_test:
def enable_log_metrics_publisher_in_minifi(self):
self.cluster.enable_log_metrics_publisher_in_minifi()
+ def enable_example_minifi_python_processors(self):
+ self.cluster.enable_example_minifi_python_processors()
+
def debug_bundle_can_be_retrieved_through_minifi_controller(self, container_name: str):
assert self.cluster.debug_bundle_can_be_retrieved_through_minifi_controller(container_name) or self.cluster.log_app_output()
diff --git a/docker/test/integration/features/python.feature b/docker/test/integration/features/python.feature
index 877e0d65a..e2ec03568 100644
--- a/docker/test/integration/features/python.feature
+++ b/docker/test/integration/features/python.feature
@@ -29,7 +29,8 @@ Feature: MiNiFi can use python processors in its flows
Then the Minifi logs contain the following message: "key:Python attribute value:attributevalue" in less than 60 seconds
Scenario: A MiNiFi instance can update attributes through native python processor
- Given a GenerateFlowFile processor with the "File Size" property set to "0B"
+ Given the example MiNiFi python processors are present
+ And a GenerateFlowFile processor with the "File Size" property set to "0B"
And a AddPythonAttribute processor
And a LogAttribute processor
And the "success" relationship of the GenerateFlowFile processor is connected to the AddPythonAttribute
@@ -39,7 +40,8 @@ Feature: MiNiFi can use python processors in its flows
Then the Minifi logs contain the following message: "key:Python attribute value:attributevalue" in less than 60 seconds
Scenario: Native python processor can read empty input stream
- Given a GenerateFlowFile processor with the "File Size" property set to "0B"
+ Given the example MiNiFi python processors are present
+ And a GenerateFlowFile processor with the "File Size" property set to "0B"
And a MoveContentToJson processor
And a PutFile processor with the "Directory" property set to "/tmp/output"
And the "success" relationship of the GenerateFlowFile processor is connected to the MoveContentToJson
@@ -56,7 +58,8 @@ Feature: MiNiFi can use python processors in its flows
Then the Minifi logs contain the following message: "Removing flow file with UUID" in less than 30 seconds
Scenario: Native python processors can be stateful
- Given a CountingProcessor processor
+ Given the example MiNiFi python processors are present
+ And a CountingProcessor processor
And the scheduling period of the CountingProcessor processor is set to "100 ms"
And a PutFile processor with the "Directory" property set to "/tmp/output"
And the "success" relationship of the CountingProcessor processor is connected to the PutFile
diff --git a/docker/test/integration/features/steps/steps.py b/docker/test/integration/features/steps/steps.py
index 578a7742e..e778c2c46 100644
--- a/docker/test/integration/features/steps/steps.py
+++ b/docker/test/integration/features/steps/steps.py
@@ -1288,3 +1288,8 @@ def step_impl(context, install_mode):
context.test.remove_python_requirements_txt_in_minifi()
else:
raise Exception("Unknown python install mode.")
+
+
+@given("the example MiNiFi python processors are present")
+def step_impl(context):
+ context.test.enable_example_minifi_python_processors()
diff --git a/extensions/python/pythonprocessors/examples/AddPythonAttribute.py b/extensions/python/pythonprocessor-examples/AddPythonAttribute.py
similarity index 100%
rename from extensions/python/pythonprocessors/examples/AddPythonAttribute.py
rename to extensions/python/pythonprocessor-examples/AddPythonAttribute.py
diff --git a/extensions/python/pythonprocessors/examples/CountingProcessor.py b/extensions/python/pythonprocessor-examples/CountingProcessor.py
similarity index 100%
rename from extensions/python/pythonprocessors/examples/CountingProcessor.py
rename to extensions/python/pythonprocessor-examples/CountingProcessor.py
diff --git a/extensions/python/pythonprocessors/examples/GaussianDistributionWithNumpy.py b/extensions/python/pythonprocessor-examples/GaussianDistributionWithNumpy.py
similarity index 100%
rename from extensions/python/pythonprocessors/examples/GaussianDistributionWithNumpy.py
rename to extensions/python/pythonprocessor-examples/GaussianDistributionWithNumpy.py
diff --git a/extensions/python/pythonprocessors/examples/MoveContentToJson.py b/extensions/python/pythonprocessor-examples/MoveContentToJson.py
similarity index 100%
rename from extensions/python/pythonprocessors/examples/MoveContentToJson.py
rename to extensions/python/pythonprocessor-examples/MoveContentToJson.py
diff --git a/extensions/python/pythonprocessors/examples/RemoveFlowFile.py b/extensions/python/pythonprocessor-examples/RemoveFlowFile.py
similarity index 100%
rename from extensions/python/pythonprocessors/examples/RemoveFlowFile.py
rename to extensions/python/pythonprocessor-examples/RemoveFlowFile.py
diff --git a/extensions/python/pythonprocessors/examples/SentimentAnalysis.py b/extensions/python/pythonprocessor-examples/SentimentAnalysis.py
similarity index 100%
rename from extensions/python/pythonprocessors/examples/SentimentAnalysis.py
rename to extensions/python/pythonprocessor-examples/SentimentAnalysis.py
diff --git a/msi/WixWin.wsi.in b/msi/WixWin.wsi.in
index 717bcdea7..3d08c3865 100644
--- a/msi/WixWin.wsi.in
+++ b/msi/WixWin.wsi.in
@@ -405,16 +405,6 @@ ${WIX_EXTRA_COMPONENTS}
</Directory>
<Directory Id="INSTALLPYTHONDIR" Name="minifi-python">
- <Directory Id="INSTALLEXAMPLESDIR" Name="examples">
- <Component Id="PythonProcessorExampleFiles" Guid="2508ace9-6f5d-4cb1-af66-58d5f44ae2b1">
- <File Id="Examples_AddPythonAttribute" Name="AddPythonAttribute.py" KeyPath="no" Source="..\extensions\python\pythonprocessors\examples\AddPythonAttribute.py"/>
- <File Id="Examples_CountingProcessor" Name="CountingProcessor.py" KeyPath="no" Source="..\extensions\python\pythonprocessors\examples\CountingProcessor.py"/>
- <File Id="Examples_GaussianDistributionWithNumpy" Name="GaussianDistributionWithNumpy.py" KeyPath="no" Source="..\extensions\python\pythonprocessors\examples\GaussianDistributionWithNumpy.py"/>
- <File Id="Examples_MoveContentToJson" Name="MoveContentToJson.py" KeyPath="no" Source="..\extensions\python\pythonprocessors\examples\MoveContentToJson.py"/>
- <File Id="Examples_RemoveFlowFile" Name="RemoveFlowFile.py" KeyPath="no" Source="..\extensions\python\pythonprocessors\examples\RemoveFlowFile.py"/>
- <File Id="Examples_SentimentAnalysis" Name="SentimentAnalysis.py" KeyPath="no" Source="..\extensions\python\pythonprocessors\examples\SentimentAnalysis.py"/>
- </Component>
- </Directory>
<Directory Id="INSTALLGOOGLEDIR" Name="google">
<Component Id="PythonProcessorGoogleFiles" Guid="90b898a9-76fb-4888-a4aa-adcd22097863">
<File Id="Google_SentimentAnalyzer" Name="SentimentAnalyzer.py" KeyPath="yes" Source="..\extensions\python\pythonprocessors\google\SentimentAnalyzer.py"/>
@@ -451,6 +441,17 @@ ${WIX_EXTRA_COMPONENTS}
</Directory>
</Directory>
</Directory>
+
+ <Directory Id="INSTALLPYTHONEXAMPLESDIR" Name="minifi-python-examples">
+ <Component Id="PythonProcessorExampleFiles" Guid="2508ace9-6f5d-4cb1-af66-58d5f44ae2b1">
+ <File Id="Examples_AddPythonAttribute" Name="AddPythonAttribute.py" KeyPath="no" Source="..\extensions\python\pythonprocessor-examples\AddPythonAttribute.py"/>
+ <File Id="Examples_CountingProcessor" Name="CountingProcessor.py" KeyPath="no" Source="..\extensions\python\pythonprocessor-examples\CountingProcessor.py"/>
+ <File Id="Examples_GaussianDistributionWithNumpy" Name="GaussianDistributionWithNumpy.py" KeyPath="no" Source="..\extensions\python\pythonprocessor-examples\GaussianDistributionWithNumpy.py"/>
+ <File Id="Examples_MoveContentToJson" Name="MoveContentToJson.py" KeyPath="no" Source="..\extensions\python\pythonprocessor-examples\MoveContentToJson.py"/>
+ <File Id="Examples_RemoveFlowFile" Name="RemoveFlowFile.py" KeyPath="no" Source="..\extensions\python\pythonprocessor-examples\RemoveFlowFile.py"/>
+ <File Id="Examples_SentimentAnalysis" Name="SentimentAnalysis.py" KeyPath="no" Source="..\extensions\python\pythonprocessor-examples\SentimentAnalysis.py"/>
+ </Component>
+ </Directory>
</Directory>
</DirectoryRef>
</Fragment>