You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/07/06 13:05:08 UTC

[GitHub] [nifi-minifi-cpp] lordgamez opened a new pull request #1126: MINIFICPP-1355 Fix the initialization of ExecutePythonProcessor

lordgamez opened a new pull request #1126:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1126


   Jira ticket: https://issues.apache.org/jira/browse/MINIFICPP-1355
   
   --------------------------------------------------------------------------------
   
   Thank you for submitting a contribution to Apache NiFi - MiNiFi C++.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced
        in the commit message?
   
   - [ ] Does your PR title start with MINIFICPP-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically main)?
   
   - [ ] Is your initial contribution a single, squashed commit?
   
   ### For code changes:
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the LICENSE file?
   - [ ] If applicable, have you updated the NOTICE file?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions CI results for build issues and submit an update to your PR as soon as possible.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] lordgamez commented on a change in pull request #1126: MINIFICPP-1355 Fix the initialization of ExecutePythonProcessor

Posted by GitBox <gi...@apache.org>.
lordgamez commented on a change in pull request #1126:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1126#discussion_r671124065



##########
File path: extensions/script/python/ExecutePythonProcessor.cpp
##########
@@ -53,79 +53,39 @@ core::Relationship ExecutePythonProcessor::Success("success", "Script successes"
 core::Relationship ExecutePythonProcessor::Failure("failure", "Script failures");
 
 void ExecutePythonProcessor::initialize() {
-  // initialization requires that we do a little leg work prior to onSchedule
-  // so that we can provide manifest our processor identity

Review comment:
       I checked the manifest before and after this change, but I could not see any additional data transferred. I think with this processor there is no need for any additional data, as the executed processor is stored in the attribute of the `Script File` or the `Script Body` attribute and only the same manifest data is required as for any other processor.
   
   However my guess is that additional manifest data is needed if we are using native python processors where the identity of those processors should be included in the manifest. I'm not sure if this refers to the python processors, how they are connected to the `ExecutePythonProcessor`, I still have to investigate and test the inner workings of those.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] szaszm closed pull request #1126: MINIFICPP-1355 Fix the initialization of ExecutePythonProcessor

Posted by GitBox <gi...@apache.org>.
szaszm closed pull request #1126:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1126


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] lordgamez commented on a change in pull request #1126: MINIFICPP-1355 Fix the initialization of ExecutePythonProcessor

Posted by GitBox <gi...@apache.org>.
lordgamez commented on a change in pull request #1126:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1126#discussion_r671062084



##########
File path: docker/test/integration/resources/python/add_attribute_to_flowfile.py
##########
@@ -0,0 +1,13 @@
+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)  # noqa: E128

Review comment:
       There is no problem here as we added it to the built in symbols. Only that my editor did not realize it. Removed it in 00880a413ff046969cd22b45be83873a30d0b5f9




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] fgerlits commented on a change in pull request #1126: MINIFICPP-1355 Fix the initialization of ExecutePythonProcessor

Posted by GitBox <gi...@apache.org>.
fgerlits commented on a change in pull request #1126:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1126#discussion_r671041645



##########
File path: extensions/script/python/ExecutePythonProcessor.cpp
##########
@@ -53,79 +53,39 @@ core::Relationship ExecutePythonProcessor::Success("success", "Script successes"
 core::Relationship ExecutePythonProcessor::Failure("failure", "Script failures");
 
 void ExecutePythonProcessor::initialize() {
-  // initialization requires that we do a little leg work prior to onSchedule
-  // so that we can provide manifest our processor identity

Review comment:
       According to this comment, this double-initialization fudge was an attempt to make the manifest we send to the C2 in the first heartbeat more complete.  What is the ExecutePythonProcessor section in the manifest going to look like after this change?

##########
File path: docker/test/integration/resources/python/add_attribute_to_flowfile.py
##########
@@ -0,0 +1,13 @@
+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)  # noqa: E128

Review comment:
       what is flake8's problem with this line?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #1126: MINIFICPP-1355 Fix the initialization of ExecutePythonProcessor

Posted by GitBox <gi...@apache.org>.
szaszm commented on a change in pull request #1126:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1126#discussion_r680931996



##########
File path: docker/test/integration/features/python.feature
##########
@@ -0,0 +1,13 @@
+Feature: MiNiFi can use python processors in its flows
+  Background:
+    Given the content of "/tmp/output" is monitored
+
+  Scenario: A MiNiFi instance can update attributes through custom python processor
+    Given a GenerateFlowFile processor with the "File Size" property set to "0B"
+    And a ExecutePythonProcessor processor in the "primary_cluster" flow
+    And a LogAttribute processor in the "primary_cluster" flow
+    And the "success" relationship of the GenerateFlowFile processor is connected to the ExecutePythonProcessor
+    And the "success" relationship of the ExecutePythonProcessor processor is connected to the LogAttribute

Review comment:
       Consider specifying the script file here or calling "ExecutePythonProcessor" something more specific, like "AddAttributePythonProcessor".




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [nifi-minifi-cpp] lordgamez commented on a change in pull request #1126: MINIFICPP-1355 Fix the initialization of ExecutePythonProcessor

Posted by GitBox <gi...@apache.org>.
lordgamez commented on a change in pull request #1126:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1126#discussion_r695846825



##########
File path: docker/test/integration/features/python.feature
##########
@@ -0,0 +1,13 @@
+Feature: MiNiFi can use python processors in its flows
+  Background:
+    Given the content of "/tmp/output" is monitored
+
+  Scenario: A MiNiFi instance can update attributes through custom python processor
+    Given a GenerateFlowFile processor with the "File Size" property set to "0B"
+    And a ExecutePythonProcessor processor in the "primary_cluster" flow
+    And a LogAttribute processor in the "primary_cluster" flow
+    And the "success" relationship of the GenerateFlowFile processor is connected to the ExecutePythonProcessor
+    And the "success" relationship of the ExecutePythonProcessor processor is connected to the LogAttribute

Review comment:
       Updated in 0f1f532233d09ab24aa2c0d5a2b470416051eb24




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org