Closed mburger343 closed 1 year ago
I'm not sure your exact goal here, but if you want to update the Variables in the variable registry attached to a Process Group, you probably want to use nipyapi.canvas.update_variable_registry. If you are looking for code examples on how to use the various functions, then it is usually good to look in the tests for that function.
Thanks for the response. I missed the update_variable_registry, so I assumed that updating variables in the top level nifi group was the same as updating other properties
Description
I am trying to update the variables for the NiFi Flow Process Group using nipyapi.canvas.update_process_group. I do not have a lot of experience with Python, and have not started using this api until last week, however I am able to update other properties for the NiFi Flow Process Group such as comments, so I think my code is correct.
What I Did
Here is some sample code demonstrating what I am seeing:
import nipyapi as nipyapi
pgeNifiFlow = nipyapi.canvas.get_process_group('NiFi Flow', 'name', True)
dictUpdateVar = { 'foo':'bar' }
dictUpdated = { 'variables': dictUpdateVar, 'comments': 'blah' }
pgeUpdated = nipyapi.canvas.update_process_group(pgeNifiFlow, dictUpdated, True)
assert pgeUpdated.component.comments == 'blah' # Does not throw an assert error assert bool(pgeUpdated.component.variables) is True # Throws an assert error
Urgency
It's not blocking me yet since I have other things to work on