You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/07/29 19:13:02 UTC
[GitHub] [nifi] gresockj opened a new pull request #5261: NIFI-7588: Handling dynamic properties on termination
gresockj opened a new pull request #5261:
URL: https://github.com/apache/nifi/pull/5261
Thank you for submitting a contribution to Apache NiFi.
Please provide a short description of the PR here:
#### Description of PR
Sets the new properties of a processor from the existing processor upon termination, allowing onPropertyModified() to fire.
In order to streamline the review of the contribution we ask you
to ensure the following steps have been taken:
### 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 `squash` or use `--force` when pushing to allow for clean monitoring of changes._
### For code changes:
- [ ] Have you ensured that the full suite of tests is executed via `mvn -Pcontrib-check clean install` at the root `nifi` folder?
- [ ] Have you written or updated unit tests to verify your changes?
- [ ] Have you verified that the full build is successful on JDK 8?
- [ ] Have you verified that the full build is successful on JDK 11?
- [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [ ] If applicable, have you updated the `LICENSE` file, including the main `LICENSE` file under `nifi-assembly`?
- [ ] If applicable, have you updated the `NOTICE` file, including the main `NOTICE` file found under `nifi-assembly`?
- [ ] If adding new Properties, have you added `.displayName` in addition to .name (programmatic access) for each of the new properties?
### For documentation related changes:
- [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
### 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.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi] exceptionfactory commented on pull request #5261: NIFI-7588: Handling dynamic properties on termination
Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on pull request #5261:
URL: https://github.com/apache/nifi/pull/5261#issuecomment-930697331
@markap14 This looks good, can you take look to confirm the approach?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi] markap14 merged pull request #5261: NIFI-7588: Handling dynamic properties on termination
Posted by GitBox <gi...@apache.org>.
markap14 merged pull request #5261:
URL: https://github.com/apache/nifi/pull/5261
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi] gresockj commented on a change in pull request #5261: NIFI-7588: Handling dynamic properties on termination
Posted by GitBox <gi...@apache.org>.
gresockj commented on a change in pull request #5261:
URL: https://github.com/apache/nifi/pull/5261#discussion_r679432526
##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardReloadComponent.java
##########
@@ -97,10 +100,19 @@ public void reload(final ProcessorNode existingNode, final String newType, final
// need to refresh the properties in case we are changing from ghost component to real component
existingNode.refreshProperties();
+ newNode.setProperties(getPropertiesForSetting(existingNode.getProperties()));
+
logger.debug("Triggering async validation of {} due to processor reload", existingNode);
flowController.getValidationTrigger().trigger(existingNode);
}
+ private static Map<String, String> getPropertiesForSetting(final Map<PropertyDescriptor, PropertyConfiguration> propertyMap) {
Review comment:
I figured static since there is nothing about the StandardReloadComponent instance that needs to be accessed. Do you have a thought for why an instance method would be preferable? Either way, I'll move this to the end.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi] gresockj commented on a change in pull request #5261: NIFI-7588: Handling dynamic properties on termination
Posted by GitBox <gi...@apache.org>.
gresockj commented on a change in pull request #5261:
URL: https://github.com/apache/nifi/pull/5261#discussion_r717062535
##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/StandardProcessorNodeIT.java
##########
@@ -59,12 +61,14 @@
import org.apache.nifi.registry.flow.FlowRegistryClient;
import org.apache.nifi.registry.variable.FileBasedVariableRegistry;
import org.apache.nifi.registry.variable.StandardComponentVariableRegistry;
+import org.apache.nifi.test.processors.DynamicPropertiesTestProcessor;
import org.apache.nifi.test.processors.ModifiesClasspathNoAnnotationProcessor;
import org.apache.nifi.test.processors.ModifiesClasspathProcessor;
import org.apache.nifi.util.MockPropertyValue;
import org.apache.nifi.util.MockVariableRegistry;
import org.apache.nifi.util.NiFiProperties;
import org.apache.nifi.util.SynchronousValidationTrigger;
+import org.jetbrains.annotations.NotNull;
Review comment:
Ooh, nice catch @greyp9. Certainly not the intended package!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi] exceptionfactory commented on a change in pull request #5261: NIFI-7588: Handling dynamic properties on termination
Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5261:
URL: https://github.com/apache/nifi/pull/5261#discussion_r679427486
##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardReloadComponent.java
##########
@@ -97,10 +100,19 @@ public void reload(final ProcessorNode existingNode, final String newType, final
// need to refresh the properties in case we are changing from ghost component to real component
existingNode.refreshProperties();
+ newNode.setProperties(getPropertiesForSetting(existingNode.getProperties()));
+
logger.debug("Triggering async validation of {} due to processor reload", existingNode);
flowController.getValidationTrigger().trigger(existingNode);
}
+ private static Map<String, String> getPropertiesForSetting(final Map<PropertyDescriptor, PropertyConfiguration> propertyMap) {
Review comment:
Is there a reason for making this method `static`? Just for keeping the methods organized, it would be helpful to move this method after the other public methods.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi] markap14 merged pull request #5261: NIFI-7588: Handling dynamic properties on termination
Posted by GitBox <gi...@apache.org>.
markap14 merged pull request #5261:
URL: https://github.com/apache/nifi/pull/5261
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi] greyp9 commented on a change in pull request #5261: NIFI-7588: Handling dynamic properties on termination
Posted by GitBox <gi...@apache.org>.
greyp9 commented on a change in pull request #5261:
URL: https://github.com/apache/nifi/pull/5261#discussion_r717047306
##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/StandardProcessorNodeIT.java
##########
@@ -59,12 +61,14 @@
import org.apache.nifi.registry.flow.FlowRegistryClient;
import org.apache.nifi.registry.variable.FileBasedVariableRegistry;
import org.apache.nifi.registry.variable.StandardComponentVariableRegistry;
+import org.apache.nifi.test.processors.DynamicPropertiesTestProcessor;
import org.apache.nifi.test.processors.ModifiesClasspathNoAnnotationProcessor;
import org.apache.nifi.test.processors.ModifiesClasspathProcessor;
import org.apache.nifi.util.MockPropertyValue;
import org.apache.nifi.util.MockVariableRegistry;
import org.apache.nifi.util.NiFiProperties;
import org.apache.nifi.util.SynchronousValidationTrigger;
+import org.jetbrains.annotations.NotNull;
Review comment:
Wanted to make sure this was the intended package, rather than `javax.validation.constraints`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi] exceptionfactory commented on a change in pull request #5261: NIFI-7588: Handling dynamic properties on termination
Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5261:
URL: https://github.com/apache/nifi/pull/5261#discussion_r679440032
##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardReloadComponent.java
##########
@@ -97,10 +100,19 @@ public void reload(final ProcessorNode existingNode, final String newType, final
// need to refresh the properties in case we are changing from ghost component to real component
existingNode.refreshProperties();
+ newNode.setProperties(getPropertiesForSetting(existingNode.getProperties()));
+
logger.debug("Triggering async validation of {} due to processor reload", existingNode);
flowController.getValidationTrigger().trigger(existingNode);
}
+ private static Map<String, String> getPropertiesForSetting(final Map<PropertyDescriptor, PropertyConfiguration> propertyMap) {
Review comment:
As a private method that doesn't access other class members, it seems fine to leave it static as you described. Thanks for moving it to the end.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi] gresockj commented on a change in pull request #5261: NIFI-7588: Handling dynamic properties on termination
Posted by GitBox <gi...@apache.org>.
gresockj commented on a change in pull request #5261:
URL: https://github.com/apache/nifi/pull/5261#discussion_r717062535
##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/StandardProcessorNodeIT.java
##########
@@ -59,12 +61,14 @@
import org.apache.nifi.registry.flow.FlowRegistryClient;
import org.apache.nifi.registry.variable.FileBasedVariableRegistry;
import org.apache.nifi.registry.variable.StandardComponentVariableRegistry;
+import org.apache.nifi.test.processors.DynamicPropertiesTestProcessor;
import org.apache.nifi.test.processors.ModifiesClasspathNoAnnotationProcessor;
import org.apache.nifi.test.processors.ModifiesClasspathProcessor;
import org.apache.nifi.util.MockPropertyValue;
import org.apache.nifi.util.MockVariableRegistry;
import org.apache.nifi.util.NiFiProperties;
import org.apache.nifi.util.SynchronousValidationTrigger;
+import org.jetbrains.annotations.NotNull;
Review comment:
Ooh, nice catch @greyp9. Certainly not the intended package!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi] markap14 commented on pull request #5261: NIFI-7588: Handling dynamic properties on termination
Posted by GitBox <gi...@apache.org>.
markap14 commented on pull request #5261:
URL: https://github.com/apache/nifi/pull/5261#issuecomment-942463922
Thanks @gresockj changes look good to me. +1 will merge.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi] exceptionfactory commented on a change in pull request #5261: NIFI-7588: Handling dynamic properties on termination
Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5261:
URL: https://github.com/apache/nifi/pull/5261#discussion_r679440032
##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/main/java/org/apache/nifi/controller/StandardReloadComponent.java
##########
@@ -97,10 +100,19 @@ public void reload(final ProcessorNode existingNode, final String newType, final
// need to refresh the properties in case we are changing from ghost component to real component
existingNode.refreshProperties();
+ newNode.setProperties(getPropertiesForSetting(existingNode.getProperties()));
+
logger.debug("Triggering async validation of {} due to processor reload", existingNode);
flowController.getValidationTrigger().trigger(existingNode);
}
+ private static Map<String, String> getPropertiesForSetting(final Map<PropertyDescriptor, PropertyConfiguration> propertyMap) {
Review comment:
As a private method that doesn't access or class members, it seems fine to leave it static as you described. Thanks for moving it to the end.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [nifi] greyp9 commented on a change in pull request #5261: NIFI-7588: Handling dynamic properties on termination
Posted by GitBox <gi...@apache.org>.
greyp9 commented on a change in pull request #5261:
URL: https://github.com/apache/nifi/pull/5261#discussion_r717047306
##########
File path: nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-core/src/test/java/org/apache/nifi/controller/StandardProcessorNodeIT.java
##########
@@ -59,12 +61,14 @@
import org.apache.nifi.registry.flow.FlowRegistryClient;
import org.apache.nifi.registry.variable.FileBasedVariableRegistry;
import org.apache.nifi.registry.variable.StandardComponentVariableRegistry;
+import org.apache.nifi.test.processors.DynamicPropertiesTestProcessor;
import org.apache.nifi.test.processors.ModifiesClasspathNoAnnotationProcessor;
import org.apache.nifi.test.processors.ModifiesClasspathProcessor;
import org.apache.nifi.util.MockPropertyValue;
import org.apache.nifi.util.MockVariableRegistry;
import org.apache.nifi.util.NiFiProperties;
import org.apache.nifi.util.SynchronousValidationTrigger;
+import org.jetbrains.annotations.NotNull;
Review comment:
Wanted to make sure this was the intended package, rather than `javax.validation.constraints`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@nifi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org