Chaffelson / nipyapi

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

error while create a PG under another PG #74

Closed shrikant-pa closed 5 years ago

shrikant-pa commented 6 years ago

Description

I am not able to create a process group inside another process group. I can create it under a root though.

Example: /root/level1 PG (created) /root/level1/level2 (error)

What I Did

nipyapi.canvas.create_process_group('level2', 'level1', '100,100')

File "C:\Python\Python36\lib\site-packages\nipyapi\nifi\rest.py", line 268, in POST body=body) File "C:\Python\Python36\lib\site-packages\nipyapi\nifi\rest.py", line 224, in request raise ApiException(http_resp=r) nipyapi.nifi.rest.ApiException: (400) Reason: Bad Request HTTP response headers: HTTPHeaderDict({'Date': 'Mon, 01 Oct 2018 11:14:56 GMT', 'X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'text/plain', 'Vary': 'Accept-Encoding', 'Content-Length': '68', 'Server': 'Jetty(9.4.3.v20170317)'}) HTTP response body: A revision of 0 must be specified when creating a new Process group.

Chaffelson commented 6 years ago

This looks like you are passing the parent process group as a string, which it should be a ProcessGroupEntity. Can you please try something like: parent_pg = nipyapi.canvas.get_process_group('level1) new_pg = nipyapi.canvas.create_process_group(level1, 'level2', ('100', '100'))

if you run the 'help' command on any call, it should tell you what the inputs should be.

shrikant-pa commented 6 years ago

I ran below code and it failed too.

parent_pg = nipyapi.canvas.get_process_group('level1') new_pg = nipyapi.canvas.create_process_group(parent_pg, 'level2', ('100', '100'))

request raise ApiException(http_resp=r) nipyapi.nifi.rest.ApiException: (400) Reason: Bad Request HTTP response headers: HTTPHeaderDict({'Date': 'Tue, 02 Oct 2018 15:56:08 GMT', 'X-Frame-Options': 'SAMEORIGIN', 'Content-Type': 'text/plain', 'Vary': 'Accept-Encoding', 'Content-Length': '68', 'Server': 'Jetty(9.4.3.v20170317)'}) HTTP response body: A revision of 0 must be specified when creating a new Process group.

Chaffelson commented 6 years ago

Ok thanks @shrikant-pa I will work up a regression test and take a run at this in the next patch

Chaffelson commented 5 years ago

Hi @shrikant-pa I have been unable to reproduce your error.

The test code is here, it looks the same effect as your situation:

    # Test process group creation on other than root process group.
    s = canvas.create_process_group(parent_pg=canvas.get_process_group(conftest.test_pg_name), location=(200.0, 200.0),
                                    new_pg_name=conftest.test_another_pg_name)
shrikant-pa commented 5 years ago

I think we can close this. We are directly consuming Rest API from Java and Python.