Chaffelson / nipyapi

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

Enable/Disable Processors with nipyapi #251

Open rei-ber opened 3 years ago

rei-ber commented 3 years ago

Description

If I try to start a disabled processor with schedule_processor(pg, True) and I get ValueError: Processor is disabled. I found out, how to enable it, but it would be nice to have it as an api method. Is there any plan to integrate a method for? Or is there any other way to do it?

What I Did

This is my workaround:

import nipyapi
pg = nipyapi.canvas.get_processor('PGName')[0]
pg.component.state = 'STOPPED'
nipyapi.nifi.ProcessorsApi().update_processor(pg.id, pg)
nipyapi.canvas.schedule_processor(pg, True)

Urgency

Due to an existing workaround, it is not critical.

Chaffelson commented 3 years ago

This seems like a good idea, we could add a switch to the function something like autoEnable=False by default, and if you set it to True then any disabled Controllers would be helpfully started for you