Re: [PR] NIFI-12735 Adding the option to execute flow analysis before committing snapshot to registry [nifi]

2024-04-03 Thread via GitHub


tpalfy commented on PR #8377:
URL: https://github.com/apache/nifi/pull/8377#issuecomment-2034921876

   LGTM
   Thank you for your work @simonbence !
   Merged into main.


-- 
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-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12735 Adding the option to execute flow analysis before committing snapshot to registry [nifi]

2024-04-03 Thread via GitHub


asfgit closed pull request #8377: NIFI-12735 Adding the option to execute flow 
analysis before committing snapshot to registry
URL: https://github.com/apache/nifi/pull/8377


-- 
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-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12735 Adding the option to execute flow analysis before committing snapshot to registry [nifi]

2024-03-28 Thread via GitHub


tpalfy commented on code in PR #8377:
URL: https://github.com/apache/nifi/pull/8377#discussion_r1543309357


##
nifi-commons/nifi-properties/src/main/java/org/apache/nifi/util/NiFiProperties.java:
##
@@ -303,6 +303,9 @@ public class NiFiProperties extends ApplicationProperties {
 // flow analysis properties
 public static final String BACKGROUND_FLOW_ANALYSIS_SCHEDULE = 
"nifi.flow.analysis.background.task.schedule";
 
+// registry client properties
+public static final String 
FLOW_REGISTRY_CHECK_FOR_RULE_VIOLATIONS_BEFORE_COMMIT = 
"nifi.registry.check.for.rule.violation.before.commit";

Review Comment:
   We should add this property in 
`nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/src/main/resources/conf/nifi.properties`
 and in 
`nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-resources/pom.xml` 
as well.
   
```suggestion
   public static final String 
FLOW_REGISTRY_CHECK_FOR_RULE_VIOLATIONS_BEFORE_COMMIT = 
"nifi.registry.check.for.rule.violations.before.commit";
   ```



-- 
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-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] NIFI-12735 Adding the option to execute flow analysis before committing snapshot to registry [nifi]

2024-03-20 Thread via GitHub


tpalfy commented on code in PR #8377:
URL: https://github.com/apache/nifi/pull/8377#discussion_r1532063069


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/flow/FlowAnalyzingRegistryClientNode.java:
##
@@ -0,0 +1,452 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.registry.flow;
+
+import org.apache.nifi.authorization.Resource;
+import org.apache.nifi.authorization.resource.Authorizable;
+import org.apache.nifi.bundle.BundleCoordinate;
+import org.apache.nifi.components.ConfigurableComponent;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.ValidationContext;
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.components.validation.ValidationState;
+import org.apache.nifi.components.validation.ValidationStatus;
+import org.apache.nifi.controller.LoggableComponent;
+import org.apache.nifi.controller.PropertyConfiguration;
+import org.apache.nifi.controller.TerminationAwareLogger;
+import org.apache.nifi.controller.flow.FlowManager;
+import org.apache.nifi.controller.flowanalysis.FlowAnalyzer;
+import org.apache.nifi.controller.service.ControllerServiceProvider;
+import org.apache.nifi.flow.ExternalControllerServiceReference;
+import org.apache.nifi.flow.ParameterProviderReference;
+import org.apache.nifi.flow.VersionedParameterContext;
+import org.apache.nifi.flow.VersionedProcessGroup;
+import org.apache.nifi.groups.ProcessGroup;
+import org.apache.nifi.parameter.ParameterContext;
+import org.apache.nifi.parameter.ParameterLookup;
+import org.apache.nifi.parameter.ParameterUpdate;
+import org.apache.nifi.registry.flow.mapping.InstantiatedVersionedProcessGroup;
+import org.apache.nifi.registry.flow.mapping.NiFiRegistryFlowMapper;
+import org.apache.nifi.validation.RuleViolation;
+import org.apache.nifi.validation.RuleViolationsManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+
+public final class FlowAnalyzingRegistryClientNode implements 
FlowRegistryClientNode {
+private static final Logger LOGGER = 
LoggerFactory.getLogger(FlowAnalyzingRegistryClientNode.class);
+
+private final FlowRegistryClientNode node;
+private final ControllerServiceProvider serviceProvider;
+private final FlowAnalyzer flowAnalyzer;
+private final RuleViolationsManager ruleViolationsManager;
+private final FlowManager flowManager;
+private final Supplier flowMapperSupplier;
+
+public FlowAnalyzingRegistryClientNode(
+final FlowRegistryClientNode node,
+final ControllerServiceProvider serviceProvider,
+final FlowAnalyzer flowAnalyzer,
+final RuleViolationsManager ruleViolationsManager,
+final FlowManager flowManager,
+final Supplier flowMapperSupplier
+) {
+this.node = Objects.requireNonNull(node);
+this.serviceProvider = Objects.requireNonNull(serviceProvider);
+this.flowAnalyzer = Objects.requireNonNull(flowAnalyzer);
+this.ruleViolationsManager = 
Objects.requireNonNull(ruleViolationsManager);
+this.flowManager = Objects.requireNonNull(flowManager);
+this.flowMapperSupplier = Objects.requireNonNull(flowMapperSupplier);
+}
+
+@Override
+public RegisteredFlowSnapshot registerFlowSnapshot(
+final FlowRegistryClientUserContext context,
+final RegisteredFlow flow,
+final VersionedProcessGroup snapshot,
+final Map 
externalControllerServices,
+final Map parameterContexts,
+final Map 
parameterProviderReferences,
+final String comments,
+final int expectedVersion
+) throws FlowRegistryException, IOException {
+if (LOGGER.isTraceEnabled()) {
+LOGGER.trace("Snapshot for flow {} is 

Re: [PR] NIFI-12735 Adding the option to execute flow analysis before committing snapshot to registry [nifi]

2024-03-19 Thread via GitHub


simonbence commented on code in PR #8377:
URL: https://github.com/apache/nifi/pull/8377#discussion_r1531531217


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/flow/FlowAnalyzingRegistryClientNode.java:
##
@@ -0,0 +1,452 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.registry.flow;
+
+import org.apache.nifi.authorization.Resource;
+import org.apache.nifi.authorization.resource.Authorizable;
+import org.apache.nifi.bundle.BundleCoordinate;
+import org.apache.nifi.components.ConfigurableComponent;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.ValidationContext;
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.components.validation.ValidationState;
+import org.apache.nifi.components.validation.ValidationStatus;
+import org.apache.nifi.controller.LoggableComponent;
+import org.apache.nifi.controller.PropertyConfiguration;
+import org.apache.nifi.controller.TerminationAwareLogger;
+import org.apache.nifi.controller.flow.FlowManager;
+import org.apache.nifi.controller.flowanalysis.FlowAnalyzer;
+import org.apache.nifi.controller.service.ControllerServiceProvider;
+import org.apache.nifi.flow.ExternalControllerServiceReference;
+import org.apache.nifi.flow.ParameterProviderReference;
+import org.apache.nifi.flow.VersionedParameterContext;
+import org.apache.nifi.flow.VersionedProcessGroup;
+import org.apache.nifi.groups.ProcessGroup;
+import org.apache.nifi.parameter.ParameterContext;
+import org.apache.nifi.parameter.ParameterLookup;
+import org.apache.nifi.parameter.ParameterUpdate;
+import org.apache.nifi.registry.flow.mapping.InstantiatedVersionedProcessGroup;
+import org.apache.nifi.registry.flow.mapping.NiFiRegistryFlowMapper;
+import org.apache.nifi.validation.RuleViolation;
+import org.apache.nifi.validation.RuleViolationsManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+
+public final class FlowAnalyzingRegistryClientNode implements 
FlowRegistryClientNode {
+private static final Logger LOGGER = 
LoggerFactory.getLogger(FlowAnalyzingRegistryClientNode.class);
+
+private final FlowRegistryClientNode node;
+private final ControllerServiceProvider serviceProvider;
+private final FlowAnalyzer flowAnalyzer;
+private final RuleViolationsManager ruleViolationsManager;
+private final FlowManager flowManager;
+private final Supplier flowMapperSupplier;
+
+public FlowAnalyzingRegistryClientNode(
+final FlowRegistryClientNode node,
+final ControllerServiceProvider serviceProvider,
+final FlowAnalyzer flowAnalyzer,
+final RuleViolationsManager ruleViolationsManager,
+final FlowManager flowManager,
+final Supplier flowMapperSupplier
+) {
+this.node = Objects.requireNonNull(node);
+this.serviceProvider = Objects.requireNonNull(serviceProvider);
+this.flowAnalyzer = Objects.requireNonNull(flowAnalyzer);
+this.ruleViolationsManager = 
Objects.requireNonNull(ruleViolationsManager);
+this.flowManager = Objects.requireNonNull(flowManager);
+this.flowMapperSupplier = Objects.requireNonNull(flowMapperSupplier);
+}
+
+@Override
+public RegisteredFlowSnapshot registerFlowSnapshot(
+final FlowRegistryClientUserContext context,
+final RegisteredFlow flow,
+final VersionedProcessGroup snapshot,
+final Map 
externalControllerServices,
+final Map parameterContexts,
+final Map 
parameterProviderReferences,
+final String comments,
+final int expectedVersion
+) throws FlowRegistryException, IOException {
+if (LOGGER.isTraceEnabled()) {
+LOGGER.trace("Snapshot for flow {} 

Re: [PR] NIFI-12735 Adding the option to execute flow analysis before committing snapshot to registry [nifi]

2024-03-14 Thread via GitHub


tpalfy commented on code in PR #8377:
URL: https://github.com/apache/nifi/pull/8377#discussion_r1525306917


##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/flow/FlowAnalyzingRegistryClientNode.java:
##
@@ -0,0 +1,452 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.registry.flow;
+
+import org.apache.nifi.authorization.Resource;
+import org.apache.nifi.authorization.resource.Authorizable;
+import org.apache.nifi.bundle.BundleCoordinate;
+import org.apache.nifi.components.ConfigurableComponent;
+import org.apache.nifi.components.PropertyDescriptor;
+import org.apache.nifi.components.ValidationContext;
+import org.apache.nifi.components.ValidationResult;
+import org.apache.nifi.components.validation.ValidationState;
+import org.apache.nifi.components.validation.ValidationStatus;
+import org.apache.nifi.controller.LoggableComponent;
+import org.apache.nifi.controller.PropertyConfiguration;
+import org.apache.nifi.controller.TerminationAwareLogger;
+import org.apache.nifi.controller.flow.FlowManager;
+import org.apache.nifi.controller.flowanalysis.FlowAnalyzer;
+import org.apache.nifi.controller.service.ControllerServiceProvider;
+import org.apache.nifi.flow.ExternalControllerServiceReference;
+import org.apache.nifi.flow.ParameterProviderReference;
+import org.apache.nifi.flow.VersionedParameterContext;
+import org.apache.nifi.flow.VersionedProcessGroup;
+import org.apache.nifi.groups.ProcessGroup;
+import org.apache.nifi.parameter.ParameterContext;
+import org.apache.nifi.parameter.ParameterLookup;
+import org.apache.nifi.parameter.ParameterUpdate;
+import org.apache.nifi.registry.flow.mapping.InstantiatedVersionedProcessGroup;
+import org.apache.nifi.registry.flow.mapping.NiFiRegistryFlowMapper;
+import org.apache.nifi.validation.RuleViolation;
+import org.apache.nifi.validation.RuleViolationsManager;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
+
+public final class FlowAnalyzingRegistryClientNode implements 
FlowRegistryClientNode {
+private static final Logger LOGGER = 
LoggerFactory.getLogger(FlowAnalyzingRegistryClientNode.class);
+
+private final FlowRegistryClientNode node;
+private final ControllerServiceProvider serviceProvider;
+private final FlowAnalyzer flowAnalyzer;
+private final RuleViolationsManager ruleViolationsManager;
+private final FlowManager flowManager;
+private final Supplier flowMapperSupplier;
+
+public FlowAnalyzingRegistryClientNode(
+final FlowRegistryClientNode node,
+final ControllerServiceProvider serviceProvider,
+final FlowAnalyzer flowAnalyzer,
+final RuleViolationsManager ruleViolationsManager,
+final FlowManager flowManager,
+final Supplier flowMapperSupplier

Review Comment:
   I don't see a reason for this to be a Supplier. The mapper the flow analysis 
requires an implementation that doesn't rely on any configuration that can 
change runtime.
   So we can just create it and pass on.



##
nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-framework-components/src/main/java/org/apache/nifi/registry/flow/FlowAnalyzingRegistryClientNode.java:
##
@@ -0,0 +1,452 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the 

[PR] NIFI-12735 Adding the option to execute flow analysis before committing snapshot to registry [nifi]

2024-02-08 Thread via GitHub


simonbence opened a new pull request, #8377:
URL: https://github.com/apache/nifi/pull/8377

   # Summary
   
   [NIFI-12735](https://issues.apache.org/jira/browse/NIFI-12735)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [ ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue 
created
   
   ### Pull Request Tracking
   
   - [ ] Pull Request title starts with Apache NiFi Jira issue number, such as 
`NIFI-0`
   - [ ] Pull Request commit message starts with Apache NiFi Jira issue number, 
as such `NIFI-0`
   
   ### Pull Request Formatting
   
   - [ ] Pull Request based on current revision of the `main` branch
   - [ ] Pull Request refers to a feature branch with one commit containing 
changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request 
creation.
   
   ### Build
   
   - [ ] Build completed using `mvn clean install -P contrib-check`
 - [ ] JDK 21
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 
2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License 
Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` 
files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
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-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org