Commit Graph

31 Commits

Author SHA1 Message Date
bob 2303a15f8e
NIFI-12913 Corrected NPE for Python Log Listener ID
This closes #8526

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2024-03-18 08:30:02 -05:00
bob 495a7dd7f5
NIFI-12514 Added Windows support for Python venv
This closes #8510

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2024-03-15 21:21:18 -05:00
Mark Bathori 7e594d58dc
NIFI-12884 Corrected documentation for python debugging
This closes #8490

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2024-03-11 19:34:40 -05:00
David Handermann 26f5fa2be0
NIFI-11443 Route Python Framework Logging to SLF4J (#8407)
* NIFI-11443 Routed Python Framework Logging to SLF4J

- Changed Python logging to use standard output stream
- Adjusted Python logging format for simplified processing
- Updated PythonProcess to pipe standard error and standard output streams to reader
- Added Log Reader command with Virtual Thread for each Python Process
- Removed Python log properties from NiFi Properties configuration
2024-03-05 16:55:04 -05:00
Mark Payne 55738f8522
NIFI-12740 Fixed Python to Java Object Binding
Fixed issue in NiFiPythonGateway that stems from the fact that the thread adding an object to the JavaObjectBindings was not necessarily the thread removing them. The algorithm that was in place assumed that the same thread would be used, in order to ensure that an object could be unbound before being accessed. The new algorithm binds each new object to all active method invocations and only unbinds the objects after all method invocations complete, regardless of thread. Additionally, found that many method calls could create new proxies on the Python side, just for getter methods whose values don't change. This is very expensive, so introduced a new @Idempotent annotation that can be added to interface methods such that we can cache the value and avoid the expensive overhead.

This closes #8456

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2024-03-04 15:28:12 -06:00
Mark Payne ae423fc6ba
NIFI-12832 Removed unnecessary dependencies from nifi-mock
- Moved StandardValidators to nifi-api
- Moved URL creation method from UriUtils to URLValidator
- Separated FormatUtils into FormatUtils and DurationFormat classes
- Added DurationFormat to nifi-api

This closes #8442

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2024-02-23 15:13:21 -06:00
Mark Payne bd11031725
NIFI-12659 Respawn Python Processes on Unexpected Termination
Refactored so that when a Python Process dies, NiFi will detect this, respawn the process, recreate the Processors that exist in the process, re-initialize them, and restart them. In testing, found the PythonControllerInteractionIT had bugs that were causing Python Processors to be re-initialized many times; this resulted in threading issues that caused processors to be invalid, indicating that property descriptors didn't exist, etc. Addressed these concerns in the same commit, since they were necessary to properly run tests

Ensure that ClassLoader is consistently established for python processor proxies; ensure that if we re-initialize python processor the old initialization thread is stopped

This closes #8363

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2024-02-15 21:30:55 -06:00
Mark Payne b8d7b9c677
NIFI-12757: Issue GC commands to Python for FlowFileTransformResults and RecordTransformResults when no longer needed on Java side
This closes #8375

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2024-02-15 15:07:03 -06:00
Alex Ethier e03329e01f
NIFI-12739 - Import ProcessPoolExecutor to fix bug in python 3.9+ (#8357)
* NIFI-12739 Import ProcessPoolExecutor to fix bug in python 3.9+ that causes
Exceptions to be raised incorrectly in multi-threaded applications
(https://bugs.python.org/issue42647)

* Removed extraneous whitespace.
2024-02-14 12:50:01 -05:00
Mark Payne 4094c7f599
NIFI-12740 Fixed Threading Bug with Java to Python Bound Objects
Fixed a threading bug where Java makes a call to Python, Python create a Java object to return (ArrayList), Python returns the object and then cleans it up, notifying Java to remove it from 'bound objects', and then Java process the response and returns a null object because it's no longer bound

This closes #8356

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2024-02-09 08:34:49 -06:00
Mark Payne a587bad711
NIFI-12675 Fixed custom Relationships with Python Processors
Fixed bug that caused custom Relationships not to work on Python Processors. Added unit test to verify. Also addressed issue in PythonControllerInteractionIT where it did not wait for Processors to become valid (originally this wasn't necessary but when we refactored Processors to initialize in the background this was overlooked).

This closes #8316

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2024-02-01 11:55:24 -06:00
Mark Payne 7edf0d4e2a
NIFI-12693: Moved notification of python process that a Processor was removed to a background (virtual) thread. Also noted in testing that in one instance a Python Processor never became
valid because it had cached property descriptors before the processor was fully initialized, so updated code to ensure that we do not cache values before initialization is completed.

This closes #8315

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2024-02-01 08:15:28 -06:00
Mark Payne 2acc1038c9
NIFI-12616 Added Processor Documentation Support for Python
- Added some Use Case docs for Python processors and updated Runtime Manifests to include Python based processors as well as Use Case/MultiProcessorUseCase documentation elements. Refactored/cleaned up some of the Python code and added unit tests.

- Added python-unit-tests profile and enabled on Ubuntu and macOS GitHub workflows

This closes #8253

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2024-01-18 19:12:05 -06:00
exceptionfactory 00fd7d7cca NIFI-12361-RC6 prepare for next development iteration 2023-11-22 18:35:27 -06:00
exceptionfactory 49fa0d8674 NIFI-12361-RC6 prepare release nifi-2.0.0-M1-RC6 2023-11-22 18:35:26 -06:00
Mark Payne aff4e5fd1b
NIFI-12340: Only call PythonBridge.onProcessorRemoved for python based processors, not all processors. Do so in a background virtual thread. Also specified explicit versions for openai dependencies to ensure correctness, since the newly released 1.x is not yet compatible with the latest langchain
This closes #8001

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2023-11-10 08:41:53 -06:00
Mark Payne a978406c83
NIFI-12326: When a Python Processor is created, it attempts to download dependencies in the background and then load the processor code. If that fails, it previously gave up; now it will log the exception and keep trying
This closes #7990

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2023-11-07 09:07:59 -06:00
exceptionfactory b50557b854
NIFI-12321 Avoid Exceptions when removing Python Processors (#7984)
- Updated StandardPythonBridge.onProcessorRemoved to avoid throwing exceptions when called with a Processor Type and Version that is not registered
- Updated system-tests workflow to run on changes in the nifi-py4j-bundle
2023-11-06 16:17:41 -05:00
exceptionfactory 309061ca2d
NIFI-12310 Validate Python Component Type for Processes (#7972)
* NIFI-12310 Validated Python Component Type for Processes
- Updated StandardPythonBridge to validate requested Component Type and Version against available Python Processors
2023-11-03 14:42:08 -04:00
Mark Payne 754baf0a37
NIFI-12308: Create Python Environment in background thread instead of during Processor creation
This closes #7971

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2023-11-02 15:45:43 -05:00
Mark Payne 5bcad9eef3
NIFI-12240 Added Python Processors for Docs, ChatGPT, Chroma, and Pinecone
Created new python processors for text embeddings, inserting into Chroma, querying Chroma, querying ChatGPT, inserting into and querying Pinecone. Fixed some bugs in the Python framework. Added Python extensions to assembly. Also added ability to load dependencies from a requirements.txt as that was important for making the different vectorstore implementations play more nicely together.

Excluded nifi-python-extensions-bundle from GitHub build because it requires Maven to use unpack-resources goal, which will not work in GitHub because it uses mvn compile instead of mvn install

- ParseDocument
- ChunkDocument
- PromptChatGPT
- PutChroma
- PutPinecone
- QueryChroma
- QueryPinecone

NIFI-12195 Added support for requirements.txt to define Python dependencies

This closes #7894

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2023-11-01 16:17:36 -05:00
Mark Bean 5ecc12f405
NIFI-12285 Added py4j.url build property
The py4j.url property allows the URL for downloading py4j to be specified by a Maven command-line option

This closes #7946

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2023-10-27 16:25:53 -05:00
exceptionfactory bd4ba34339
NIFI-12266 Added Standard Shared NAR and BOM (#7925)
- Added nifi-standard-shared-nar with common dependencies
- Added nifi-standard-shared-bom with provided scope for parent module references
2023-10-25 13:22:26 -04:00
Mark Payne cbdf32ab79
NIFI-12205: Moved loading of Python dependencies into background thread when processor created instead of during startup. Some code cleanup.
This closes #7863

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2023-10-14 15:05:17 -05:00
Mark Payne 711f2f1188
NIFI-12137: This closes #7808. Fixed name of Expression Language Scope from LIMITED to ENVIRONMENT, ; fixed issue in which flowfiles routed to failure by FlowFileTransform were also being routed to original; defined 'identifier' and 'logger' as member variables for FlowFileTransform and RecordTransform so that IDEs know about them
Signed-off-by: Joseph Witt <joewitt@apache.org>
2023-10-04 09:16:04 -07:00
Mark Payne db727aa419
NIFI-12142: This closes #7806. Deleted many methods, classes, and references that were deprecated.
Signed-off-by: Joseph Witt <joewitt@apache.org>
2023-09-28 14:07:48 -07:00
Joseph Witt a1fca9b44e
NIFI-12064 Upgraded Maven Plugin versions
This closes #7731

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2023-09-14 19:35:51 -05:00
mr1716 70c756ff78
NIFI-11953 Upgraded download-maven-plugin from 1.6.8 to 1.7.1
This closes #7613

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2023-08-16 21:03:41 -05:00
Mark Payne c68f5ec9a2
NIFI-11793 Added Python debugging properties and documentation
Added documentation to indicate how to debug Python side of nifi framework, as well as debugging Python processors themselves using VSCode's Remote debugger.
This also provides the ability to launch the Controller process in such a way that it will listen to incoming remote debug connections.

This closes #7469

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2023-07-24 13:23:19 -05:00
Mark Payne ce623632cf
NIFI-11243: Implemented Dependent Properties on the Python side
This closes #7323

Signed-off-by: David Handermann <exceptionfactory@apache.org>
2023-06-22 13:03:43 -05:00
Mark Payne 7f7cccfdc2
NIFI-11241 Initial implementation of Python-based Processor API with Py4J
- Updated GitHub workflow so that system tests include Python 3.9
- Updated GitHub actions to build necessary modules for system tests

This closes #7003

Co-authored-by: David Handermann <exceptionfactory@apache.org>
Signed-off-by: David Handermann <exceptionfactory@apache.org>
2023-04-14 15:03:34 -05:00