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 2025/09/22 18:08:21 UTC
(nifi-minifi-cpp) 04/04: MINIFICPP-2636 update ExecutePythonProcessor description
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 6f545de4e3e1a9754ceebe85cd8d45400e8b77f0
Author: Marton Szasz <sz...@apache.org>
AuthorDate: Mon Sep 22 16:55:33 2025 +0200
MINIFICPP-2636 update ExecutePythonProcessor description
- onTrigger accepts session, not property
- justifying basic behavior with efficiency seems weird, removed
- remove the sentence about concurrency, since the processor is single threaded
On a somewhat unrelated note, should we drop this API in favor of the newer NiFi-compatible python scripting API, or is it still useful to maintain? I guess it's easier to write processors for the legacy API, but the new API seems better designed, plus it handles dependencies. If we drop it, it should be done before 1.0.
Closes #2035
Signed-off-by: Martin Zink <ma...@apache.org>
---
PROCESSORS.md | 2 +-
extensions/python/ExecutePythonProcessor.h | 7 +++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/PROCESSORS.md b/PROCESSORS.md
index 2aecfe389..7baa9891b 100644
--- a/PROCESSORS.md
+++ b/PROCESSORS.md
@@ -722,7 +722,7 @@ In the list below, the names of required properties appear in bold. Any other pr
### Description
-Executes a script given the flow file and a process session. The script is responsible for handling the incoming flow file (transfer to SUCCESS or remove, e.g.) as well as any flow files created by the script. If the handling is incomplete or incorrect, the session will be rolled back.Scripts must define an onTrigger function which accepts NiFi Context and Property objects. For efficiency, scripts are executed once when the processor is run, then the onTrigger method is called for each i [...]
+Executes a script given the flow file and a process session. The script is responsible for handling the incoming flow file (transfer to SUCCESS or remove, e.g.) as well as any flow files created by the script. If the handling is incomplete or incorrect, the session will be rolled back. Scripts must define an onTrigger function which accepts NiFi Context and ProcessSession objects. Scripts are executed once when the processor is run, then the onTrigger method is called for each incoming f [...]
### Properties
diff --git a/extensions/python/ExecutePythonProcessor.h b/extensions/python/ExecutePythonProcessor.h
index e78623f68..9fbe22f4d 100644
--- a/extensions/python/ExecutePythonProcessor.h
+++ b/extensions/python/ExecutePythonProcessor.h
@@ -50,10 +50,9 @@ class ExecutePythonProcessor : public core::ProcessorImpl {
EXTENSIONAPI static constexpr const char* Description = "Executes a script given the flow file and a process session. "
"The script is responsible for handling the incoming flow file (transfer to SUCCESS or remove, e.g.) as well as "
- "any flow files created by the script. If the handling is incomplete or incorrect, the session will be rolled back.Scripts must define an onTrigger function which accepts NiFi Context "
- "and Property objects. For efficiency, scripts are executed once when the processor is run, then the onTrigger method is called for each incoming flowfile. This enables scripts to keep state "
- "if they wish, although there will be a script context per concurrent task of the processor. In order to, e.g., compute an arithmetic sum based on incoming flow file information, set the "
- "concurrent tasks to 1. The python script files are expected to contain `describe(procesor)` and `onTrigger(context, session)`.";
+ "any flow files created by the script. If the handling is incomplete or incorrect, the session will be rolled back. Scripts must define an onTrigger function which accepts NiFi Context "
+ "and ProcessSession objects. Scripts are executed once when the processor is run, then the onTrigger method is called for each incoming flowfile. This enables scripts to keep state "
+ "if they wish. The python script files are expected to contain `describe(processor)` and `onTrigger(context, session)`.";
EXTENSIONAPI static constexpr auto ScriptFile = core::PropertyDefinitionBuilder<>::createProperty("Script File")
.withDescription("Path to script file to execute. Only one of Script File or Script Body may be used")