You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by jskora <gi...@git.apache.org> on 2016/10/13 05:37:39 UTC

[GitHub] nifi pull request #1127: NIFI-2861 ControlRate should accept more than one f...

GitHub user jskora opened a pull request:

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

    NIFI-2861 ControlRate should accept more than one flow file per execution (1.x)

    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 code changes:
    - [X] 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.
    
    * Support multiple files per onTrigger call.

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

    $ git pull https://github.com/jskora/nifi NIFI-2861-1.x

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

    https://github.com/apache/nifi/pull/1127.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 #1127
    
----
commit d66dd6d0f59784da14a26fce50542224e1cf4b07
Author: Joe Skora <js...@gmail.com>
Date:   2016-10-13T05:14:23Z

    NIFI-2861 ControlRate should accept more than one flow file per execution
    
    * Support multiple files per onTrigger call.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1127: NIFI-2861 ControlRate should accept more than one f...

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

    https://github.com/apache/nifi/pull/1127#discussion_r83220874
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ControlRate.java ---
    @@ -381,6 +392,14 @@ public boolean tryAdd(final long value) {
     
         private class ThrottleFilter implements FlowFileFilter {
     
    +        private final long flowFilesPerTrigger;
    +        private final AtomicLong flowFilesFiltered = new AtomicLong(0L);
    +
    +        ThrottleFilter(final String ffPerTrigger) {
    +            super();
    --- End diff --
    
    The parent class here is Object. I don't think there's a need to call super()


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1127: NIFI-2861 ControlRate should accept more than one f...

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

    https://github.com/apache/nifi/pull/1127#discussion_r83217567
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ControlRate.java ---
    @@ -115,6 +115,13 @@
                 .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
                 .expressionLanguageSupported(false)
                 .build();
    +    public static final PropertyDescriptor MAX_FF_PER_TRIGGER = new PropertyDescriptor.Builder()
    --- End diff --
    
    @jskora I'm not sure that this needs to be configurable. This is an implementation detail that feels a bit leaky to me. Users do not know what an 'onTrigger() call' is. We should probably just cap it at say 1000 and not more than the max number of FlowFiles to transfer per 'Time Duration'.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1127: NIFI-2861 ControlRate should accept more than one f...

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

    https://github.com/apache/nifi/pull/1127#discussion_r83316904
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ControlRate.java ---
    @@ -381,6 +392,14 @@ public boolean tryAdd(final long value) {
     
         private class ThrottleFilter implements FlowFileFilter {
     
    +        private final long flowFilesPerTrigger;
    +        private final AtomicLong flowFilesFiltered = new AtomicLong(0L);
    --- End diff --
    
    Yep, I picked up the pattern from Throttle, but this doesn't serve the same purpose.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1127: NIFI-2861 ControlRate should accept more than one f...

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

    https://github.com/apache/nifi/pull/1127#discussion_r83325697
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ControlRate.java ---
    @@ -381,6 +392,14 @@ public boolean tryAdd(final long value) {
     
         private class ThrottleFilter implements FlowFileFilter {
     
    +        private final long flowFilesPerTrigger;
    +        private final AtomicLong flowFilesFiltered = new AtomicLong(0L);
    +
    +        ThrottleFilter(final String ffPerTrigger) {
    +            super();
    +            flowFilesPerTrigger = ffPerTrigger == null ? 1L : Long.parseLong(ffPerTrigger);
    --- End diff --
    
    Agreed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1127: NIFI-2861 ControlRate should accept more than one f...

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

    https://github.com/apache/nifi/pull/1127#discussion_r83218107
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ControlRate.java ---
    @@ -381,6 +392,14 @@ public boolean tryAdd(final long value) {
     
         private class ThrottleFilter implements FlowFileFilter {
     
    +        private final long flowFilesPerTrigger;
    +        private final AtomicLong flowFilesFiltered = new AtomicLong(0L);
    --- End diff --
    
    This filter is not thread-safe... don't think we need an AtomicLong here. Can just use an int.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1127: NIFI-2861 ControlRate should accept more than one f...

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

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


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1127: NIFI-2861 ControlRate should accept more than one f...

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

    https://github.com/apache/nifi/pull/1127#discussion_r83220736
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ControlRate.java ---
    @@ -228,12 +238,13 @@ public void onScheduled(final ProcessContext context) {
             rateControlAttribute = context.getProperty(RATE_CONTROL_ATTRIBUTE_NAME).getValue();
             maximumRateStr = context.getProperty(MAX_RATE).getValue().toUpperCase();
             groupingAttributeName = context.getProperty(GROUPING_ATTRIBUTE_NAME).getValue();
    +        maxFlowFilePerTrigger = context.getProperty(MAX_FF_PER_TRIGGER).getValue();
    --- End diff --
    
    This should probably be defined as an int, rather than a String, and can then just use context.getProperty().asInteger(). But I really prefer to remove this property all together.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1127: NIFI-2861 ControlRate should accept more than one f...

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

    https://github.com/apache/nifi/pull/1127#discussion_r83325779
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ControlRate.java ---
    @@ -381,6 +392,14 @@ public boolean tryAdd(final long value) {
     
         private class ThrottleFilter implements FlowFileFilter {
     
    +        private final long flowFilesPerTrigger;
    +        private final AtomicLong flowFilesFiltered = new AtomicLong(0L);
    --- End diff --
    
    I mean that I agree it should be an int.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1127: NIFI-2861 ControlRate should accept more than one flow fil...

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

    https://github.com/apache/nifi/pull/1127
  
    @markap14 except for removing the limit, review comments have been addressed.  The FlowFile limit property has been renamed "Max FlowFiles per Batch" to reflect a batching metaphor instead of onTrigger references, that should be less confusing to users.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1127: NIFI-2861 ControlRate should accept more than one f...

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

    https://github.com/apache/nifi/pull/1127#discussion_r83316789
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ControlRate.java ---
    @@ -228,12 +238,13 @@ public void onScheduled(final ProcessContext context) {
             rateControlAttribute = context.getProperty(RATE_CONTROL_ATTRIBUTE_NAME).getValue();
             maximumRateStr = context.getProperty(MAX_RATE).getValue().toUpperCase();
             groupingAttributeName = context.getProperty(GROUPING_ATTRIBUTE_NAME).getValue();
    +        maxFlowFilePerTrigger = context.getProperty(MAX_FF_PER_TRIGGER).getValue();
    --- End diff --
    
    You are right, it should be an int if it stays in.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1127: NIFI-2861 ControlRate should accept more than one flow fil...

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

    https://github.com/apache/nifi/pull/1127
  
    @markap14, any other thoughts?  Is this dead?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi issue #1127: NIFI-2861 ControlRate should accept more than one flow fil...

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

    https://github.com/apache/nifi/pull/1127
  
    @mwoser, I will close and resubmit a clean request with squashed commits.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] nifi pull request #1127: NIFI-2861 ControlRate should accept more than one f...

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

    https://github.com/apache/nifi/pull/1127#discussion_r83218149
  
    --- Diff: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/ControlRate.java ---
    @@ -381,6 +392,14 @@ public boolean tryAdd(final long value) {
     
         private class ThrottleFilter implements FlowFileFilter {
     
    +        private final long flowFilesPerTrigger;
    +        private final AtomicLong flowFilesFiltered = new AtomicLong(0L);
    +
    +        ThrottleFilter(final String ffPerTrigger) {
    +            super();
    +            flowFilesPerTrigger = ffPerTrigger == null ? 1L : Long.parseLong(ffPerTrigger);
    --- End diff --
    
    Should probably be passed in an int or a long, rather than a String


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---