You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by bbende <gi...@git.apache.org> on 2018/04/03 18:32:19 UTC

[GitHub] nifi pull request #2604: NIFI-5027 Adding pg-get-services command

GitHub user bbende opened a pull request:

    https://github.com/apache/nifi/pull/2604

    NIFI-5027 Adding pg-get-services command

    NIFI-5027 Adding pg-enable-services command
    
    NIFI-5027 Adding pg-disable-services command
    
    Thank you for submitting a contribution to Apache NiFi.
    
    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 master)?
    
    - [ ] Is your initial contribution a single, squashed commit?
    
    ### 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?
    - [ ] 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 travis-ci for build issues and submit an update to your PR as soon as possible.


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/bbende/nifi NIFI-5027

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/nifi/pull/2604.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #2604
    
----
commit dc3f4fa08ce395551db7f93a4377fe83ad3e8ed7
Author: Bryan Bende <bb...@...>
Date:   2018-04-03T13:30:30Z

    NIFI-5027 Adding pg-get-services command
    
    NIFI-5027 Adding pg-enable-services command
    
    NIFI-5027 Adding pg-disable-services command

----


---

[GitHub] nifi issue #2604: NIFI-5027 Adding pg-get-services command

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on the issue:

    https://github.com/apache/nifi/pull/2604
  
    Just did some more testing and it looks good to me. Thanks for all the improvements. Just a note about the response code: it's equal to 255 on my Mac, but as long as it's not equal to 0, it's good for me. Thanks @bbende ! Merging to master.


---

[GitHub] nifi pull request #2604: NIFI-5027 Adding pg-get-services command

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/nifi/pull/2604


---

[GitHub] nifi issue #2604: NIFI-5027 Adding pg-get-services command

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on the issue:

    https://github.com/apache/nifi/pull/2604
  
    Did multiple tests with different scenarios (I attached to the JIRA a template to test each scenario - cannot attached an XML file here).
    
    **Test 1** - Normal case, processors relying on a single CS correctly configured.
    => Working as expected.
    ````
    #> nifi pg-enable-services -pgid &1 -u http://localhost:8080/
    Currently 0 enabled services and 1 disabled services, attempting to enable services...
    Currently 1 services are enabling, waiting to finish before proceeding...
    Currently 1 enabled services and 0 disabled services, attempting to enable services...
    
    Finished with 1 enabled services and 0 disabled services
    
    No more services could be enabled, exiting...
    ````
    
    **Test 2** - Misconfigured CS that cannot be enabled.
    => One remark: no information regarding why the CS cannot be enabled. Ideally, providing the reason why the CS cannot be enabled would be great (like in the tooltip), not sure we have the info though. But at least saying that the CS "x" cannot be enabled, no?
    ````
    #> nifi pg-enable-services -pgid &2 -u http://localhost:8080/
    
    Using a positional back-reference for 'Test 2 - Misconfigured CS'
    Currently 0 enabled services and 1 disabled services, attempting to enable services...
    
    Finished with 0 enabled services and 1 disabled services
    
    No more services could be enabled, exiting...
    ````
    
    **Test 3** - CS referencing another CS
    => Working as expected.
    ````
    #> nifi pg-enable-services -pgid &3 -u http://localhost:8080/
    
    Using a positional back-reference for 'Test 3 - CS referencing CS'
    Currently 0 enabled services and 3 disabled services, attempting to enable services...
    Currently 1 services are enabling, waiting to finish before proceeding...
    Currently 2 enabled services and 1 disabled services, attempting to enable services...
    Currently 1 services are enabling, waiting to finish before proceeding...
    Currently 3 enabled services and 0 disabled services, attempting to enable services...
    
    Finished with 3 enabled services and 0 disabled services
    
    No more services could be enabled, exiting...
    ````
    
    **Test 4** - No CS to start for the process group.
    => Working as expected.
    ````
    #> nifi pg-enable-services -pgid &4 -u http://localhost:8080/
    
    Using a positional back-reference for 'Test 4 - No CS'
    Currently 0 enabled services and 0 disabled services, attempting to enable services...
    
    Finished with 0 enabled services and 0 disabled services
    
    No more services could be enabled, exiting...
    ````
    
    **Test 5** - CS relying on an unreferenced CS (distributed map cache client service / server) with a CS that cannot be properly started (distributed server trying to start on a port already used)
    => Would it be possible to say what CS is causing the issue? Also, once the command is looping, no way to kill it with ctrl+C, esc, etc. Not really a big issue, but just mentioning it.
    ````
    #> nifi pg-enable-services -pgid &5 -u http://localhost:8080
    
    Using a positional back-reference for 'Test 5 - Not referenced CS'
    Currently 0 enabled services and 2 disabled services, attempting to enable services...
    Currently 1 services are enabling, waiting to finish before proceeding...
    Currently 1 services are enabling, waiting to finish before proceeding...
    Currently 1 services are enabling, waiting to finish before proceeding...
    Currently 1 services are enabling, waiting to finish before proceeding...
    ````
    
    **Test 6** - CS relying on an unreferenced CS (distributed map cache client service / server)
    => Working as expected.
    ````
    #> nifi pg-enable-services -pgid &6 -u http://localhost:8080
    
    Using a positional back-reference for 'Test 6 - Not referenced CS'
    Currently 0 enabled services and 2 disabled services, attempting to enable services...
    Currently 2 enabled services and 0 disabled services, attempting to enable services...
    
    Finished with 2 enabled services and 0 disabled services
    
    No more services could be enabled, exiting...
    ````
    
    Then tried to disabled the CS, everything is working as expected. Could be nice to say how many CS have been disabled?
    ````
    #> nifi pg-disable-services -pgid &1 -u http://localhost:8080
    
    Using a positional back-reference for 'Test 1 - Basic case'
    #> nifi pg-disable-services -pgid &2 -u http://localhost:8080
    
    Using a positional back-reference for 'Test 2 - Misconfigured CS'
    #> nifi pg-disable-services -pgid &3 -u http://localhost:8080
    
    Using a positional back-reference for 'Test 3 - CS referencing CS'
    #> nifi pg-disable-services -pgid &4 -u http://localhost:8080
    
    Using a positional back-reference for 'Test 4 - No CS'
    #> nifi pg-disable-services -pgid &5 -u http://localhost:8080
    
    Using a positional back-reference for 'Test 5 - Not referenced CS'
    #> nifi pg-disable-services -pgid &6 -u http://localhost:8080
    
    Using a positional back-reference for 'Test 6 - Not referenced CS'
    ````


---

[GitHub] nifi issue #2604: NIFI-5027 Adding pg-get-services command

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on the issue:

    https://github.com/apache/nifi/pull/2604
  
    Thanks @bbende. With your last changes:
    
    ````
    #> nifi pg-enable-services -pgid &2 -u http://localhost:8080
    
    Using a positional back-reference for 'Test 2 - Misconfigured CS'
    Currently 0 enabled services and 1 disabled services, attempting to enable services...
    
    Finished with 0 enabled services and 1 disabled services
    
    The following services could not be enabled:
    
    Service: 016210d5-759f-1d4a-d095-69323147e9dd - StandardRestrictedSSLContextService
    
    Validation Errors:
    - 'StandardRestrictedSSLContextService : 016210d5-759f-1d4a-d095-69323147e9dd' is invalid because Does not have the KeyStore or the TrustStore populated
    
    #>
    #> nifi pg-enable-services -pgid &5 -u http://localhost:8080
    
    Using a positional back-reference for 'Test 5 - Not referenced CS'
    Currently 0 enabled services and 2 disabled services, attempting to enable services...
    Currently 1 services are enabling, waiting to finish before proceeding (1 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (2 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (3 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (4 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (5 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (6 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (7 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (8 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (9 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (10 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (11 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (12 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (13 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (14 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (15 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (16 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (17 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (18 of 20)
    Currently 1 services are enabling, waiting to finish before proceeding (19 of 20)
    
    One or more services appear to be stuck enabling:
    
    Service: 016210ec-759f-1d4a-3cf3-c507e978ffc5 - DistributedMapCacheServer
    
    Reasons:
    - DistributedMapCacheServer[id=016210ec-759f-1d4a-3cf3-c507e978ffc5] Failed to invoke @OnEnabled method due to java.net.BindException: Address already in use: Address already in use
    - DistributedMapCacheServer[id=016210ec-759f-1d4a-3cf3-c507e978ffc5] Failed to invoke @OnEnabled method due to java.net.BindException: Address already in use: Address already in use
    ````
    
    That's great!
    
    Regarding the fact it's only displayed when using the interactive mode: I think it would make sense to also print it when using the "scripted" way (maybe just the error message you added with your last commit). I'd imagine users writing scripts redirecting the standard output to log files or using tools like Jenkins/Travis that already give you access to the standard output. If the script fails it would be useful to see what happened. Also, but I think it has already been mentioned in the previous PR for the CLI, having an exit code not equal to 0 could be useful to fail fast.
    
    Test 2:
    ````
    $ ./cli.sh nifi pg-enable-services -pgid 016210c2-759f-1d4a-c230-abfde87350cf -u http://localhost:8080
    $ echo $?
    0
    ````


---

[GitHub] nifi issue #2604: NIFI-5027 Adding pg-get-services command

Posted by pvillard31 <gi...@git.apache.org>.
Github user pvillard31 commented on the issue:

    https://github.com/apache/nifi/pull/2604
  
    Giving it a try...


---

[GitHub] nifi issue #2604: NIFI-5027 Adding pg-get-services command

Posted by bbende <gi...@git.apache.org>.
Github user bbende commented on the issue:

    https://github.com/apache/nifi/pull/2604
  
    @pvillard31 I just rebased and forced push, can you give this another try?
    
    The main changes since what you last tried this morning are the following...
    - In standalone you can use -verbose to get the same output as interactive
    - An exception is thrown when a service stays enabling, or when one or more are invalid, this makes a -1 response code for standalone
    - Improve the disable command to work similarly to the enable command


---

[GitHub] nifi issue #2604: NIFI-5027 Adding pg-get-services command

Posted by bbende <gi...@git.apache.org>.
Github user bbende commented on the issue:

    https://github.com/apache/nifi/pull/2604
  
    @pvillard31 thanks for the very thorough review, I'll take a look at some of these tomorrow and see what improvements can be made.
    
    Regarding the lack of feedback on some commands... 
    
    The way the enabling is implemented is by using a REST end-point that tells a process group to enable all of its controller services. So it checks how many are enabled, tells the PG to enable all, then checks how many are enabled, and basically when the # of enabled services stops changing then it means no more could be enabled, but the enable command isn't providing any response because it is an asynchronous command and doesn't know what was/wasn't enabled.
    
    So for #2 we don't really know which CS couldn't be enabled, we just know no more were enabled. Maybe when it finishes we can list the validation errors for all of the invalid services.
    
    For #5, the looping is something that can happen whenever any controller service gets stuck in the "enabling" state which can happen if it gets a stuck thread or an error. Right now it loops 120 times sleeping 1 second and then would break out and throw an error. This is obviously too long, but it is hard to say how long to wait, maybe 30 seconds?
    
    For disabling, it just fires off a call to a REST end point and tells a PG to disable all it's services. I can see if we can make additional calls to get the count before and after and give some info.
    
    Keeping in mind, all of the above info is only going to print in interactive mode. From standalone mode nothing is currently printed because I don't know if anything makes sense for someone writing a script.


---