- Subscribe to RSS Feed
- Mark Question as New
- Mark Question as Read
- Float this Question for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
start/stop processor via nifi api
- Labels:
-
Apache NiFi
Created ‎11-22-2016 05:37 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm trying to start and stop processors via the nifi api version 1.0.0. I'm getting status code 409 returned and the message is "afb7dcf1-0157-1000-9450-ea0931a67e0f is not stopped."
I have read previous articles about the optimistic locking and I am supplying the version and client id but I'm still getting this error. Any ideas? Here is a snippet of my python code:
process_group = nifiapi.find_process_group(process_group_name) if process_group is None: return None processors = nifiapi.get_processors_by_pg(process_group["id"]) if processors is None: return None for processor in processors['processors']: processor["revision"]["clientId"] = str(uuid.uuid4()) processor["status"]["runStatus"] = "STOPPED" logging.debug("Updating processor: {}".format(json.dumps(processor))) nifiapi.update_processor(processor) # this makes the put request
Created ‎11-22-2016 06:57 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ok I figured it out. Since I was taking the processor object returned from my 'get' call and just modifying a few fields, it thought I was trying to do an update on the object. You cannot do this while it is running so that was the error message. I modified my request to only contain the minimum number of fields (i think) to stop the processor. I'm still unclear whether I need to set status.runStatus and/or component.state to STOPPED to get what I want as they both seem to indicate the same thing. Anyway, the below request works:
modified_processor = { 'revision': { 'version': processor["revision"]["version"], 'clientId': str(uuid.uuid4()) }, 'status': { 'runStatus': status }, 'component': { 'id': processor['id'], 'state': status }, 'id' : processor['id'] }
Created ‎12-21-2016 11:33 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Frank Maritato Thanks for the response
Here is my api call, I have updated my call like the above format. Even i am facing the same issue
curl -i -X PUT -H 'Content-Type:application/json' -H 'Accept: application/json' -d '{"status": {"runStatus": "RUNNING"},"component":{"state":"RUNNING","id":"<processorgroup_id>"},"id": "<processorgroup_id>", "revision": {"version": 2,"clientId":"<client_id>"}}' http://host:port/nifi-api/process-groups/>
HTTP/1.1 400 Bad Request Date: Wed, 21 Dec 2016 11:08:27 GMT Content-Type: text/plain Transfer-Encoding: chunked Server: Jetty(9.3.9.v20160517) Message body is malformed. Unable to map into expected format
Created ‎12-27-2016 05:03 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
is there a way to start stop processors group?
Created ‎12-27-2016 05:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
No, not from what I was able to find. If you want to start all processors in a processor group, you need to get the list of all processors in that group by calling
GET /process-groups/{id}/processors
and then one by one set them to RUNNING or STOPPED by doing
PUT /processors/{id}
Hope this helps!
Created ‎12-28-2016 02:26 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Created ‎02-08-2017 03:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
any new ? somebody has the correct syntax of json for running a processor ?
i've used this json with HTTP CODE 405
# more startListHDFS_1.json { "status": { "runStatus": "RUNNING" }, "component": { "state": "RUNNING", "id": "b0c63454-89a8-15ef-be22-959bd4a72e5a" }, "id": "b0c63454-89a8-15ef-be22-959bd4a72e5a", "revision": { "version": 1, "clientId": "test" } } # curl -H "Content-type: application/json" --cacert nifi-cert.pem --cert ./client.p12 -XPOST https://localhost:9443/nifi-api/processors/b0c63454-89a8-15ef-be22-959bd4a72e5a -d @startListHDFS_1.json -vv
help appreciate. thanks
Created ‎05-02-2017 07:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
for me it is working fine :
HTTP method : PUT
{ "status": { "runStatus": "STOPPED" }, "component": { "state": "STOPPED", "id": "b2e9b4eb-015b-1000-765d-c01c0a2fa6ce" //processor id }, "id": "b2e9b4eb-015b-1000-765d-c01c0a2fa6ce", //processor id "revision": { "clientId": "b2e5a8bb-015b-1000-31c1-0ee3b952dcbe", "version": 8 } }
Created ‎06-07-2017 08:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
in which processor we need to use? how to specify property of that processor?
Created ‎09-16-2017 05:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Frank Maritato Can i run your python code in ExecuteScript processor - which means i am stopping an processor from another one within nifi. If yes? will your code work if security for nifi is enabled like LDAP authentication. Can you show light on "nifiapi" is it an api provided by nifi.

- « Previous
-
- 1
- 2
- Next »