You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by wselwood <gi...@git.apache.org> on 2018/12/06 10:22:01 UTC

[GitHub] nifi pull request #3205: NIFI-5875 Improve docs around the PriorityAttribute...

GitHub user wselwood opened a pull request:

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

    NIFI-5875 Improve docs around the PriorityAttributePrioritizer

    Clear up the documentation around the PriorityAttributePrioritizer to make it clearer that if the attributes are both number the largest wins but if they are not numbers they sort the other way around.
    
    I had to go and look at the code to work out what was going on after reading the existing documentation.
    
    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:
    - [x] Is there a JIRA ticket associated with this PR? Is it referenced 
         in the commit message?
    
    - [x] 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.
    
    - [x] Has your PR been rebased against the latest commit within the target branch (typically master)?
    
    - [x] Is your initial contribution a single, squashed commit?
    
    ### For documentation related changes:
    - [X] 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/wselwood/nifi patch-2

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

    https://github.com/apache/nifi/pull/3205.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 #3205
    
----
commit 529c066c7247b5467ce1274c28539dcabb8acfb7
Author: Wil Selwood <ws...@...>
Date:   2018-12-06T10:17:19Z

    Improve docs around the PriorityAttributePrioritizer
    
    Clear up the documentation around the PriorityAttributePrioritizer to make it clearer that if the attributes are both number the largest wins but if they are not numbers they sort the other way around.
    
    I had to go and look at the code to work out what was going on after reading the existing documentation.

----


---

[GitHub] nifi pull request #3205: NIFI-5875 Improve docs around the PriorityAttribute...

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

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


---

[GitHub] nifi pull request #3205: NIFI-5875 Improve docs around the PriorityAttribute...

Posted by wselwood <gi...@git.apache.org>.
Github user wselwood commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/3205#discussion_r239734799
  
    --- Diff: nifi-docs/src/main/asciidoc/user-guide.adoc ---
    @@ -1091,7 +1091,7 @@ The following prioritizers are available:
     - *FirstInFirstOutPrioritizer*: Given two FlowFiles, the one that reached the connection first will be processed first.
     - *NewestFlowFileFirstPrioritizer*: Given two FlowFiles, the one that is newest in the dataflow will be processed first.
     - *OldestFlowFileFirstPrioritizer*: Given two FlowFiles, the one that is oldest in the dataflow will be processed first. 'This is the default scheme that is used if no prioritizers are selected'.
    -- *PriorityAttributePrioritizer*: Given two FlowFiles that both have a "priority" attribute, the one that has the highest priority value will be processed first. Note that an UpdateAttribute processor should be used to add the "priority" attribute to the FlowFiles before they reach a connection that has this prioritizer set. Values for the "priority" attribute may be alphanumeric, where "a" is a higher priority than "z", and "1" is a higher priority than "9", for example.
    +- *PriorityAttributePrioritizer*: Given two FlowFiles, an attribute called “priority” will be extracted. If only one has that attribute it will go first. If the attributes can be parsed as a long, they will be ordered largest number first. For example 9 will come before 1 and 100 will be selected before 99. If only one of them parses as a long that one will be considered to have the higher priority. Otherwise, they will be ordered in alphanumeric order, where "a" is a higher priority than "z", and "1" is a higher priority than "9", for example.
    --- End diff --
    
    Ouch. Good spot. The old docs got me spun around there. I'll update.


---

[GitHub] nifi issue #3205: NIFI-5875 Improve docs around the PriorityAttributePriorit...

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

    https://github.com/apache/nifi/pull/3205
  
    Looks perfect, +1 merging. Thanks @wselwood !


---

[GitHub] nifi issue #3205: NIFI-5875 Improve docs around the PriorityAttributePriorit...

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

    https://github.com/apache/nifi/pull/3205
  
    @wselwood Thanks for the update, looks much better! For the even better readability, can we improve structure a little bit more organized? How about something like this?
    
    Example output:
    
    ![image](https://user-images.githubusercontent.com/1107620/49714327-caef3f80-fc8f-11e8-9a6d-349511685aad.png)
    
    ---
    (As plain text)
    PriorityAttributePrioritizer: Given two FlowFiles that both have a "priority" attribute, the one that has the highest priority value will be processed first.
    
    - Note that an UpdateAttribute processor should be used to add the "priority" attribute to the FlowFiles before they reach a connection that has this prioritizer set.
    - If only one has that attribute it will go first.
    - Values for the "priority" attribute may be alphanumeric, where "a" is a higher priority than "z", and "1" is a higher priority than "9", for example.
    - If "priority" attribute cannot be parsed as a long, unicode string ordering will be used. For example: "99" and "100" will be ordered so the flowfile with "99" comes first, but "A-99" and "A-100" will sort so the flowfile with "A-100" comes first.



---

[GitHub] nifi pull request #3205: NIFI-5875 Improve docs around the PriorityAttribute...

Posted by ijokarumawak <gi...@git.apache.org>.
Github user ijokarumawak commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/3205#discussion_r239684255
  
    --- Diff: nifi-docs/src/main/asciidoc/user-guide.adoc ---
    @@ -1091,7 +1091,7 @@ The following prioritizers are available:
     - *FirstInFirstOutPrioritizer*: Given two FlowFiles, the one that reached the connection first will be processed first.
     - *NewestFlowFileFirstPrioritizer*: Given two FlowFiles, the one that is newest in the dataflow will be processed first.
     - *OldestFlowFileFirstPrioritizer*: Given two FlowFiles, the one that is oldest in the dataflow will be processed first. 'This is the default scheme that is used if no prioritizers are selected'.
    -- *PriorityAttributePrioritizer*: Given two FlowFiles that both have a "priority" attribute, the one that has the highest priority value will be processed first. Note that an UpdateAttribute processor should be used to add the "priority" attribute to the FlowFiles before they reach a connection that has this prioritizer set. Values for the "priority" attribute may be alphanumeric, where "a" is a higher priority than "z", and "1" is a higher priority than "9", for example.
    +- *PriorityAttributePrioritizer*: Given two FlowFiles, an attribute called “priority” will be extracted. If only one has that attribute it will go first. If the attributes can be parsed as a long, they will be ordered largest number first. For example 9 will come before 1 and 100 will be selected before 99. If only one of them parses as a long that one will be considered to have the higher priority. Otherwise, they will be ordered in alphanumeric order, where "a" is a higher priority than "z", and "1" is a higher priority than "9", for example.
    --- End diff --
    
    >If the attributes can be parsed as a long, they will be ordered largest number first. For example 9 will come before 1 and 100 will be selected before 99
    
    Is this true? As following test case shows, if `1` and `2` are compared, `1` goes first.
    https://github.com/apache/nifi/blob/master/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-standard-prioritizers/src/test/java/org/apache/nifi/prioritizer/PriorityAttributePrioritizerTest.java#L91


---