AssertionError when creating connections for dynamic relationship names
casejohnsondeloitte opened this issue · 2 comments
- Nipyapi version: 0.18.0
- NiFi version: 1.15.3
- NiFi-Registry version: N/A
- Python version: 3.10.2
- Operating System: Windows 10
Description
nipyapi.canvas.create_connection()
fails to create a connection from the RouteOnAttribute processor for a dynamic relationship name.
What I Did
In the NiFi UI, I've created and connected a HandleHttpRequest processor, a RouteOnAttribute processor, and a LogAttribute processor. I am adding a custom property to RouteOnAttribute using nipyapi.canvas.update_processor()
:
This creates a new connectable relationship on the processor:
When calling nipyapi.canvas.create_connection()
with relationships=['/sample']
, I am unable to create the connection for this dynamic name with the following error:
line 880, in create_connection:
assert all(i in source_rels for i in relationships), \
AssertionError: One or more relationships [['/sample']] not in list of valid Source Relationships [['unmatched']]
Urgency
We are not in production today, but building a product for production in the range of 2-3 months.
Workaround
If the processor is retrieved from the canvas again after updating its properties, the newly retrieved object will have the correct relationships. In other words:
# get the RouteOnAttribute processor from the canvas
# update its properties to add the new connectable relationship
# get the RouteOnAttribute processor from the canvas again
# create the connection using the new relationship
Just kidding, this is my own misuse of the library :) Did not notice that nipyapi.canvas.update_processor()
returns a new instance of the processor.
actually ideally it would helpfully inform you that you are not working with the latest revision of the processor config, that would be a small but useful improvement.