lordgamez commented on code in PR #1504:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1504#discussion_r1113049246


##########
docker/python-verify/conda.Dockerfile:
##########
@@ -0,0 +1,42 @@
+# 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.
+#
+ARG BASE_IMAGE
+FROM ${BASE_IMAGE} as base_image

Review Comment:
   As it only works with apacheminificpp image, we could reduce the argument 
only to the version number



##########
thirdparty/google-styleguide/cpplint.py:
##########
@@ -75,24 +64,26 @@
 # if empty, use defaults
 _valid_extensions = set([])
 
-__VERSION__ = '1.4.4'
+__VERSION__ = '1.6.1'

Review Comment:
   Why is cpplint part of this change? Could it be upgraded separately?



##########
win_build_vs.bat:
##########
@@ -61,45 +61,45 @@ set arg_counter=0
 for %%x in (%*) do (
     set /A arg_counter+=1
     echo %%~x
-    if [%%~x] EQU [/T]           set skiptests=ON
-    if [%%~x] EQU [/R]           set skiptestrun=ON
-    if [%%~x] EQU [/P]           set cpack=ON
-    if [%%~x] EQU [/K]           set build_kafka=ON
-    if [%%~x] EQU [/J]           set build_JNI=ON
-    if [%%~x] EQU [/S]           set build_SQL=ON
-    if [%%~x] EQU [/C]           set build_coap=ON
-    if [%%~x] EQU [/A]           set build_AWS=ON
-    if [%%~x] EQU [/SFTP]        set build_SFTP=ON
-    if [%%~x] EQU [/PDH]         set build_PDH=ON
-    if [%%~x] EQU [/SPLUNK]      set build_SPLUNK=ON
-    if [%%~x] EQU [/GCP]         set build_GCP=ON
-    if [%%~x] EQU [/ELASTIC]     set build_ELASTIC=ON
-    if [%%~x] EQU [/M]           set installer_merge_modules=ON
-    if [%%~x] EQU [/Z]           set build_azure=ON
-    if [%%~x] EQU [/N]           set build_nanofi=ON
-    if [%%~x] EQU [/O]           set build_opencv=ON
-    if [%%~x] EQU [/PR]          set build_prometheus=ON
-    if [%%~x] EQU [/BUSTACHE]    set enable_bustache=ON
-    if [%%~x] EQU [/COAP]        set enable_coap=ON
+    if [%%~x] EQU [/T]                set skiptests=ON
+    if [%%~x] EQU [/R]                set skiptestrun=ON
+    if [%%~x] EQU [/P]                set cpack=ON
+    if [%%~x] EQU [/K]                set build_kafka=ON
+    if [%%~x] EQU [/J]                set build_JNI=ON
+    if [%%~x] EQU [/S]                set build_SQL=ON
+    if [%%~x] EQU [/C]                set build_coap=ON
+    if [%%~x] EQU [/A]                set build_AWS=ON
+    if [%%~x] EQU [/SFTP]             set build_SFTP=ON
+    if [%%~x] EQU [/PDH]              set build_PDH=ON
+    if [%%~x] EQU [/SPLUNK]           set build_SPLUNK=ON
+    if [%%~x] EQU [/GCP]              set build_GCP=ON
+    if [%%~x] EQU [/ELASTIC]          set build_ELASTIC=ON
+    if [%%~x] EQU [/M]                set installer_merge_modules=ON
+    if [%%~x] EQU [/Z]                set build_azure=ON
+    if [%%~x] EQU [/N]                set build_nanofi=ON
+    if [%%~x] EQU [/O]                set build_opencv=ON
+    if [%%~x] EQU [/PR]               set build_prometheus=ON
+    if [%%~x] EQU [/BUSTACHE]         set enable_bustache=ON
+    if [%%~x] EQU [/COAP]             set enable_coap=ON
     if [%%~x] EQU [/ENCRYPT_CONFIG]   set enable_encrypt_config=ON
-    if [%%~x] EQU [/GPS]         set enable_gps=ON
+    if [%%~x] EQU [/GPS]              set enable_gps=ON
     if [%%~x] EQU [/LUA_SCRIPTING]    set enable_lua_scripting=ON
-    if [%%~x] EQU [/MQTT]        set enable_mqtt=ON
-    if [%%~x] EQU [/OPC]         set enable_opc=ON
-    if [%%~x] EQU [/OPENWSMAN]   set enable_openwsman=ON
-    if [%%~x] EQU [/OPS]         set enable_ops=ON
-    if [%%~x] EQU [/PCAP]        set enable_pcap=ON
-    if [%%~x] EQU [/SCRIPTING]   set enable_scripting=ON
-    if [%%~x] EQU [/SENSORS]     set enable_sensors=ON
-    if [%%~x] EQU [/TENSORFLOW]  set enable_tensorflow=ON
-    if [%%~x] EQU [/USB_CAMERA]  set enable_usb_camera=ON
-    if [%%~x] EQU [/64]          set build_platform=x64
-    if [%%~x] EQU [/D]           set cmake_build_type=RelWithDebInfo
-    if [%%~x] EQU [/DD]          set cmake_build_type=Debug
-    if [%%~x] EQU [/CI]          set 
"strict_gsl_checks=-DSTRICT_GSL_CHECKS=AUDIT" & set test_custom_wel_provider=ON
-    if [%%~x] EQU [/NONFREEUCRT] set "redist=-DMSI_REDISTRIBUTE_UCRT_NONASL=ON"
-    if [%%~x] EQU [/RO]          set real_odbc=ON
-    if [%%~x] EQU [/NINJA]       set generator="Ninja"
+    if [%%~x] EQU [/MQTT]             set enable_mqtt=ON
+    if [%%~x] EQU [/OPC]              set enable_opc=ON
+    if [%%~x] EQU [/OPENWSMAN]        set enable_openwsman=ON
+    if [%%~x] EQU [/OPS]              set enable_ops=ON
+    if [%%~x] EQU [/PCAP]             set enable_pcap=ON
+    if [%%~x] EQU [/PYTHON_SCRIPTING] set enable_python_scripting=ON

Review Comment:
   This should be changed in the windows job of ci.yml as well.



##########
docker/python-verify/conda.Dockerfile:
##########
@@ -0,0 +1,42 @@
+# 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.
+#
+ARG BASE_IMAGE
+FROM ${BASE_IMAGE} as base_image
+LABEL maintainer="Apache NiFi <[email protected]>"
+
+ENV USER minificpp
+ENV CONDA_HOME /opt/conda
+ENV LD_LIBRARY_PATH /opt/conda/lib
+ENV MINIFI_BASE_DIR /opt/minifi
+ENV MINIFI_HOME ${MINIFI_BASE_DIR}/minifi-current
+
+USER root
+
+RUN wget https://repo.anaconda.com/archive/Anaconda3-2022.10-Linux-x86_64.sh 
-P /tmp
+RUN bash /tmp/Anaconda3-2022.10-Linux-x86_64.sh -b -p /opt/conda
+RUN chown -R ${USER}:${USER} /opt/conda
+RUN mkdir /home/${USER}
+RUN chown -R ${USER}:${USER} /home/${USER}

Review Comment:
   These could be merged to a single RUN command to reduce the layer count



##########
extensions/python/PythonBindings.cpp:
##########
@@ -0,0 +1,87 @@
+/**
+ * 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.
+ */
+
+#include "PythonBindings.h"
+#include <utility>
+#include "types/PyLogger.h"
+#include "types/PyProcessSession.h"
+#include "types/PyProcessContext.h"
+#include "types/PyProcessor.h"
+#include "types/PyScriptFlowFile.h"
+#include "types/PyRelationship.h"
+#include "types/PyInputStream.h"
+#include "types/PyOutputStream.h"
+
+namespace org::apache::nifi::minifi::extensions::python {
+extern "C" {
+
+struct PyModuleDef minifiModule = {
+  .m_base = PyModuleDef_HEAD_INIT,
+  .m_name = "minifi_native",    // name of module
+  .m_doc = nullptr,             // module documentation, may be NULL
+  .m_size = -1,                 // size of per-interpreter state of the 
module, or -1 if the module keeps state in global variables.
+  .m_methods = nullptr,
+  .m_slots = nullptr,
+  .m_traverse = nullptr,
+  .m_clear = nullptr,
+  .m_free = nullptr
+};
+
+PyMODINIT_FUNC
+PyInit_minifi_native(void) {
+  const std::array<std::pair<PyTypeObject*, std::string_view>, 8> types = {
+    std::make_pair(PyLogger::typeObject(), "Logger"),
+    std::make_pair(PyProcessSessionObject::typeObject(), "ProcessSession"),
+    std::make_pair(PyProcessContext::typeObject(), "ProcessContext"),
+    std::make_pair(PyProcessor::typeObject(), "Processor"),
+    std::make_pair(PyScriptFlowFile::typeObject(), "FlowFile"),
+    std::make_pair(PyRelationship::typeObject(), "Relationship"),
+    std::make_pair(PyInputStream::typeObject(), "InputStream"),
+    std::make_pair(PyOutputStream::typeObject(), "OutputStream")
+  };
+
+  for (auto type : types) {
+    if (PyType_Ready(type.first) < 0) {
+      return nullptr;
+    }
+  }
+
+  auto minifiModuleInstance = PyModule_Create(&minifiModule);
+  if (minifiModuleInstance == nullptr) {
+      return nullptr;
+  }
+
+  for (auto type : types) {

Review Comment:
   I think this should be const ref



##########
extensions/python/PythonBindings.cpp:
##########
@@ -0,0 +1,87 @@
+/**
+ * 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.
+ */
+
+#include "PythonBindings.h"
+#include <utility>
+#include "types/PyLogger.h"
+#include "types/PyProcessSession.h"
+#include "types/PyProcessContext.h"
+#include "types/PyProcessor.h"
+#include "types/PyScriptFlowFile.h"
+#include "types/PyRelationship.h"
+#include "types/PyInputStream.h"
+#include "types/PyOutputStream.h"
+
+namespace org::apache::nifi::minifi::extensions::python {
+extern "C" {
+
+struct PyModuleDef minifiModule = {

Review Comment:
   Please use snake_case for `minifiModule` and `minifiModuleInstance`



##########
extensions/lua/tests/CMakeLists.txt:
##########
@@ -0,0 +1,39 @@
+#
+# 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.
+#
+
+file(GLOB EXECUTESCRIPT_LUA_TESTS "LuaScriptEngineTests.cpp" 
"TestExecuteScriptProcessorWithLuaScript.cpp")

Review Comment:
   Could this be replaced with `*.cpp`? That way if later new tests are added 
we wouldn't need to add them individually here as well.



##########
docker/DockerVerify.sh:
##########
@@ -17,17 +17,114 @@
 
 set -e
 
-if [[ $# -lt 2 ]]; then
-  echo "Usage:"
-  echo "  ./DockerVerify.sh <MINIFI_VERSION> <FEATURE_PATH>"
-  exit 1
-fi
+die()

Review Comment:
   Please replace tabs with spaces



##########
extensions/python/PythonScriptFlowFile.h:
##########
@@ -0,0 +1,44 @@
+/**
+ *
+ * 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.
+ */
+
+#pragma once
+
+#include <string>
+#include <memory>
+
+#include "core/FlowFile.h"
+
+namespace org::apache::nifi::minifi::extensions::python {
+
+
+class PythonScriptFlowFile {

Review Comment:
   Why is this class needed? It seems to me that it only serves as a proxy to 
call the member `flow_file_`'s functions and we could use `core::FlowFile` 
instead.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to