[ 
https://issues.apache.org/jira/browse/NIFI-13745?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17881615#comment-17881615
 ] 

Peter Gyori commented on NIFI-13745:
------------------------------------

[~exceptionfactory] thank you for your comment. Please check my idea for the 
implementation by looking at the latest commit here:

[https://github.com/pgyori/nifi/commits/NIFI-13745/]

My goal is to make it as simple to use as possible from the Python processor 
side. This current implementation limits the usage to CLUSTER state, but I'll 
enable using LOCAL state as well since it is not complicated. The point is that 
I'm wrapping the Java StateManager in a Python StateManager class so that the 
Python Processor developers do not need to access the JvmHolder or the Gateway.

The only trick is that I added a create_empty_map() method to the Python 
StateManager that gives the user a Java HashMap instead of using a Python 
dictionary. This way the Python code looks related to StateManager can look 
exactly like the Java code would.

Do you think extra exception handling is necessary from the Python side?

I'll look into the StateMap version thing. With this implementation it is there 
on the Java side, just not yet available from Python.

> Extend the NiFi Python API with access to StateManager
> ------------------------------------------------------
>
>                 Key: NIFI-13745
>                 URL: https://issues.apache.org/jira/browse/NIFI-13745
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Core Framework, Extensions
>            Reporter: Peter Gyori
>            Assignee: Peter Gyori
>            Priority: Major
>
> There are use-cases where it is necessary to store state from Python-based 
> processors in NiFi. One such case is creating and using a List* type Python 
> processor that needs to store information regarding which items have already 
> been listed in previous executions. For that we need to expose the 
> StateManager functionality through the Python API.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to