NIFI-7788 Start and Stop actions on a Process Group should enable/disable transmission of RPG's#4516
NIFI-7788 Start and Stop actions on a Process Group should enable/disable transmission of RPG's#4516tpalfy wants to merge 6 commits intoapache:mainfrom
Conversation
simonbence
left a comment
There was a problem hiding this comment.
I tested the permutations of the following:
- Initiating start/stop from within the relevant group or from outside
- Selecting nothing or relevant items
- Clicking on Operate menu vs right click menu
Most of the combinations looks working fine, expect the following: from outside the containing process group, right click on the relevant process group and stop/start. It changes the state of every component expect the RPG.
In other cases I saw two PUT request which from one was explicitly for the RPG. In this case I did not see the additional PUT request.
Could you please take a look? Thanks!
| * @param processGroupId The process group in which to verify remote process groups | ||
| * @param shouldTransmit The transmission state to verify for | ||
| */ | ||
| void verifyUpdateRemoteProcessGroups(String processGroupId, boolean shouldTransmit); |
There was a problem hiding this comment.
Minor: just to make it more clear it looks to be a good improvement to change processGroupId into containingProcessGroupId (it's easy to to slip take it as RPG id as the scope is the RPG)
…ow updating run statuses/transmission state of all remote process groups within a process group. When selecting run/stop on a process group/canvas/selection, it will try to enable/disable transmission of all involved remote process groups.
simonbence
left a comment
There was a problem hiding this comment.
LFGM (other than one minor question)
| @PUT | ||
| @Consumes(MediaType.APPLICATION_JSON) | ||
| @Produces(MediaType.APPLICATION_JSON) | ||
| @Path("process-group/run-status/{id}") |
There was a problem hiding this comment.
Minor: the URI looks like the following: http://localhost:8888/nifi-api/remote-process-groups/process-group/run-status/82ed213b-0178-1000-f0de-db399db203fc. Is this intentional? As the method name differs from the original by using plural, I would suggest something like: http://localhost:8888/nifi-api/remote-process-groups/run-statuses/82ed213b-0178-1000-f0de-db399db203fc
There was a problem hiding this comment.
I saw no good pattern for this so I came up with this one: I added /process-group to indicate that the scope of the operation is all RPGs within a process group.
As for the other part, nowhere else do we use run-statuses in this plural form in the urls.
Method names should be more precise because they also serve as a form of documentation. If the method name was updateRemoteProcessGroupRunStatus it would imply that it updates the run status of a single RPG.
URLs on the other hand don't need to have this implication. They merely indicate the type of the resources they manage. For example plurality can be even dependent on the payload instead of the URL.
Overall I'd rather leave it as it is.
There was a problem hiding this comment.
I can go with your consideration. LGTM
There was a problem hiding this comment.
I checked the existing endpoints and found that
- starting/stopping all processors in a process group:
/flow/process-groups/{id} - enabling/disabling controller all services in a process group:
/flow/process-groups/{id}/controller-services
Following the same scheme, I think the new endpoint should be: /flow/process-groups/{id}/remote-process-groups
@tpalfy, @simonbence What is your opinion?
There was a problem hiding this comment.
The RemoteProcessGroup is significantly different from Connectables (handled by the /flow/process-groups/{id} endpoint) and the ControllerServices (handled by the /flow/process-groups/{id}/remote-process-groups) endpoint.
The most prominent manifestation of this is how the merging of the request fits perfectly into the RemoteProcessGroupsEndpointMerger and not at all into the FlowMerger.
There are other signs that this functionality is more suited to handled here, like private methods in this class that would be needed to be accessed from the FlowResource.
Leaving it here.
There was a problem hiding this comment.
I myself am okay with this but still not fund of the naming of the URI
There was a problem hiding this comment.
@tpalfy I can see the problematic points now (eg. private methods) and leaving the endpoint in RemoteProcessGroup is fine with me.
Regarding the path, I would suggest a minor change: /remote-process-groups/process-group/{id}/run-status
In case of other endpoints, the {id} follows the entity it identifies (in our case it is a process group id). So I believe it would be more straightforward in this way and also similar to the single RPG start/stop endpoint: /remote-process-groups/{id}/run-status
|
@tpalfy Thanks for changing the endpoint path! I found the following issue while I was testing the feature on the UI (not related to the path change, I just did not catch it earlier): |
|
@tpalfy The latest change works properly with a standalone NiFi but I get the following error in cluster mode:
Otherwise it starts/stops the RPGs. |
turcsanyip
left a comment
There was a problem hiding this comment.
Retested the fix and it works es expected now.
Merging to main.
…ow updating run statuses/transmission state of all remote process groups within a process group. When selecting run/stop on a process group/canvas/selection, it will try to enable/disable transmission of all involved remote process groups. NIFI-7788 Supplied same functionality missed when selecting a process group. NIFI-7788 Updated endpoint URL paths. NIFI-7788 No need to return list of remote process groups when updating en masse. NIFI-7788 Added some null checks in RemoteProcessGroupsEndpointMerger.merge. NIFI-7788 Fix checkstyle violation. This closes apache#4516. Signed-off-by: Peter Turcsanyi <turcsanyi@apache.org>
https://issues.apache.org/jira/browse/NIFI-7788
Created a new endpoint in RemoteProcessGroupResource to allow updating run statuses/transmission state of all remote process groups within a process group. When selecting run/stop on a process group/canvas/selection, it will try to enable/disable transmission of all involved remote process groups.
For all changes:
Is there a JIRA ticket associated with this PR? Is it referenced
in the commit message?
Does your PR title start with NIFI-XXXX where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
Has your PR been rebased against the latest commit within the target branch (typically
main)?Is your initial contribution a single, squashed commit? Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not
squashor use--forcewhen pushing to allow for clean monitoring of changes.For code changes:
mvn -Pcontrib-check clean installat the rootnififolder?LICENSEfile, including the mainLICENSEfile undernifi-assembly?NOTICEfile, including the mainNOTICEfile found undernifi-assembly?.displayNamein addition to .name (programmatic access) for each of the new properties?For documentation related changes:
Note:
Please ensure that once the PR is submitted, you check GitHub Actions CI for build issues and submit an update to your PR as soon as possible.