You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "pvillard31 (via GitHub)" <gi...@apache.org> on 2024/11/11 15:22:51 UTC

[PR] NIFI-13995 - CLI - Add start, run once and clear state for processors [nifi]

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

   # Summary
   
   [NIFI-13995](https://issues.apache.org/jira/browse/NIFI-13995) - CLI - Add start, run once and clear state for processors
   
   ````
   ./bin/cli.sh nifi processor-start -procid 0138c512-0193-1000-dbd7-1891f898e909 -p nifi-cli.properties
   Name  : ...
   ID    : 0138c512-0193-1000-dbd7-1891f898e909
   Type  : ...
   Bundle: ...
   State : RUNNING
   ````
   
   ````
   ./bin/cli.sh nifi processor-clear-state -procid 0138c512-0193-1000-dbd7-1891f898e909 -p nifi-cli.properties
   Name  : ...
   ID    : 0138c512-0193-1000-dbd7-1891f898e909
   Type  : ...
   Bundle: ...
   State : STOPPED
   ````
   
   ````
   .bin/cli.sh nifi processor-start -procid 0138c512-0193-1000-dbd7-1891f898e909 --runonce -p nifi-cli.properties
   Name  : ...
   ID    : 0138c512-0193-1000-dbd7-1891f898e909
   Type  : ...
   Bundle: ...
   State : RUN_ONCE
   ````
   
   
   # 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-00000`
   - [ ] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### 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-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-13995 - CLI - Add start, run once and clear state for processors [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory merged PR #9509:
URL: https://github.com/apache/nifi/pull/9509


-- 
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


Re: [PR] NIFI-13995 - CLI - Add start, run once and clear state for processors [nifi]

Posted by "pvillard31 (via GitHub)" <gi...@apache.org>.
pvillard31 commented on PR #9509:
URL: https://github.com/apache/nifi/pull/9509#issuecomment-2485641196

   Thanks for the review @exceptionfactory - I rebased the PR after the merge of #9522 and pushed a commit to have Run Once as its own CLI command.


-- 
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


Re: [PR] NIFI-13995 - CLI - Add start, run once and clear state for processors [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on code in PR #9509:
URL: https://github.com/apache/nifi/pull/9509#discussion_r1841513145


##########
nifi-toolkit/nifi-toolkit-cli/src/main/java/org/apache/nifi/toolkit/cli/impl/command/nifi/processors/ProcessorStart.java:
##########
@@ -0,0 +1,68 @@
+/*
+ * 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.toolkit.cli.impl.command.nifi.processors;
+
+import org.apache.commons.cli.MissingOptionException;
+import org.apache.nifi.toolkit.cli.api.CommandException;
+import org.apache.nifi.toolkit.cli.api.Context;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClient;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.NiFiClientException;
+import org.apache.nifi.toolkit.cli.impl.client.nifi.ProcessorClient;
+import org.apache.nifi.toolkit.cli.impl.command.CommandOption;
+import org.apache.nifi.toolkit.cli.impl.command.nifi.AbstractNiFiCommand;
+import org.apache.nifi.toolkit.cli.impl.result.nifi.ProcessorResult;
+import org.apache.nifi.web.api.entity.ProcessorEntity;
+
+import java.io.IOException;
+import java.util.Properties;
+
+/**
+ * Command to start a processor (or execute a run once on a processor)
+ */
+public class ProcessorStart extends AbstractNiFiCommand<ProcessorResult> {
+
+    public ProcessorStart() {
+        super("processor-start", ProcessorResult.class);
+    }
+
+    @Override
+    public String getDescription() {
+        return "Starts a processor. Can also be used to execute a Run Once on a processor with the corresponding flag.";
+    }
+
+    @Override
+    protected void doInitialize(Context context) {
+        addOption(CommandOption.PROC_ID.createOption());
+        addOption(CommandOption.RUN_ONCE.createOption());

Review Comment:
   At the risk of having more commands, what do you think about having a separate `run-processor` command, instead of having `RUN_ONCE` as an optional argument to start? It seems like that would align more closely with the REST API behavior.



-- 
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