You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "exceptionfactory (via GitHub)" <gi...@apache.org> on 2023/03/16 20:08:30 UTC

[GitHub] [nifi] exceptionfactory commented on a diff in pull request #7003: NIFI-11241: Initial implementation of Python-based Processor API with…

exceptionfactory commented on code in PR #7003:
URL: https://github.com/apache/nifi/pull/7003#discussion_r1132619724


##########
nifi-docs/src/main/asciidoc/administration-guide.adoc:
##########
@@ -231,6 +232,38 @@ The `name` attribute must start with `deprecation`, followed by the component cl
 <logger name="deprecation.org.apache.nifi.processors.ListenLegacyProtocol" level="OFF" />
 ----
 
+[[python_configuration]]
+== Python Configuration
+
+NiFi if a Java-based application. However, in the 2.0 release, support was introduces for a Python-based Processor API. This capability is still

Review Comment:
   Corrected some typos and recommend the following wording:
   ```suggestion
   NiFi is a Java-based application. NiFi 2.0 introduces support for a Python-based Processor API. This capability is still
   ```



##########
nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java:
##########
@@ -2061,6 +2074,25 @@ public Path getQuestDbStatusRepositoryPath() {
         return Paths.get(getProperty(STATUS_REPOSITORY_QUESTDB_PERSIST_LOCATION, DEFAULT_COMPONENT_STATUS_REPOSITORY_PERSIST_LOCATION));
     }
 
+    /**
+     * @return the directory in which the Python framework source code is located
+     */
+    public File getPythonFrameworkSourceDirectory() {

Review Comment:
   Recommend changing the signature to return `Optional<File>` instead of `null`.



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/ExtensionBuilder.java:
##########
@@ -222,10 +232,7 @@ public ProcessorNode buildProcessor() {
         try {
             loggableComponent = createLoggableProcessor();
         } catch (final ProcessorInstantiationException pie) {
-            logger.error("Could not create Processor of type " + type + " for ID " + identifier + " due to: " + pie.getMessage() + "; creating \"Ghost\" implementation");
-            if (logger.isDebugEnabled()) {
-                logger.debug(pie.getMessage(), pie);
-            }
+            logger.error("Could not create Processor of type " + type + " for ID " + identifier + " due to: " + pie.getMessage() + "; creating \"Ghost\" implementation", pie);

Review Comment:
   This log should be corrected to use placeholder variables instead of string concatenation.



##########
nifi-nar-bundles/nifi-py4j-bundle/nifi-py4j-bridge/src/main/java/org/apache/nifi/python/processor/RecordTransform.java:
##########
@@ -0,0 +1,28 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.nifi.python.processor;
+
+import org.apache.nifi.serialization.record.RecordSchema;
+
+import java.util.List;
+
+public interface RecordTransform extends PythonProcessor {
+
+    List<RecordTransformResult> transformRecord(String jsonContent, RecordSchema schema, AttributeMap attributeMap);

Review Comment:
   Is the intention to limit Record Transformation to JSON? That seems to be implied based on the `jsonContent` parameter name, but it would be helpful to clarify with a comment on the method.



##########
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/pom.xml:
##########
@@ -204,6 +209,11 @@
             <groupId>org.xerial.snappy</groupId>
             <artifactId>snappy-java</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.nifi</groupId>
+            <artifactId>c2-client-service</artifactId>

Review Comment:
   Is this additional dependency necessary?



-- 
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