Chaffelson / nipyapi

A convenient Python wrapper for Apache NiFi
Other
244 stars 76 forks source link

revision processor up-to-date problem #198

Closed hamzabekkouri closed 3 years ago

hamzabekkouri commented 4 years ago

Description

when I want to update the processor attribute or any things on it, it shows me this error below, I did not have this problem before with nifi 1.8 version, but when I upgrade to nifi 1.11, the problem of revision appears always when I want update processor.

Error :

is unable to fulfill this request due to: [5, null, 90568d36-a77b-1115-ffff-ffff99537941] is not the most up-to-date revision. This component appears to have been modified

What I Did

def update_processor_attribute(root_pg_id,Json_props,Processor):
    proApi = nifi.apis.processors_api.ProcessorsApi(api_client=None)
    propsDto = models.processor_config_dto.ProcessorConfigDTO(properties=Json_props)
    proDto = nifi.models.processor_dto.ProcessorDTO(id=Processor.id,parent_group_id=root_pg_id,config=propsDto)
    proEntity = nifi.models.processor_entity.ProcessorEntity(revision=models.RevisionDTO(version=Processor.revision.version+1),component=proDto)
    proApi.update_processor(Processor.id,proEntity)

what I noticed from my script that did the upgrade is that when I add 1 for version it work for the one that is already created in nifi, but when I add processor with API and same time I do update it was not working !!

Urgency

Please give a brief description of how critical this issue is to you.
For example, if it's blocking your Production environment, or perhaps you are just notifying us of something you found but isn't blocking your workflow.

Please Mr @Chaffelson we need you help,

Chaffelson commented 4 years ago

nipyapi.canvas.update_processor doesn't currently have a refresh flag, which would be a good addition to make this work better. Generally the process is to fetch the current revision using a get_processor command, then supply that with the next call. I do not think it needs to be incremented manually.

Is there a reason why you aren't using nipyapi.canvas.update_processor ?

Chaffelson commented 3 years ago

Fixed in v0.16.0 release