Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BEAM-3382] Enforce strictly positive natural numbers for AfterCount timers #4300

Merged
merged 1 commit into from Dec 23, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions sdks/python/apache_beam/transforms/trigger.py
Expand Up @@ -23,6 +23,7 @@
import collections
import copy
import itertools
import numbers
from abc import ABCMeta
from abc import abstractmethod

Expand Down Expand Up @@ -378,6 +379,8 @@ class AfterCount(TriggerFn):
COUNT_TAG = _CombiningValueStateTag('count', combiners.CountCombineFn())

def __init__(self, count):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps also have a JIRA issue, so that this can be fixed in other sdks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aaltay wrote:
Perhaps also have a JIRA issue, so that this can be fixed in other sdks.

I am not sure if it affects other SDKs, but I have now filed BEAM-3382 for sdk-py-core

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mariapython wrote:
I am not sure if it affects other SDKs, but I have now filed BEAM-3382 for sdk-py-core

Done.

if not isinstance(count, numbers.Integral) or count < 1:
raise ValueError("count (%d) must be a positive integer." % count)
self.count = count

def __repr__(self):
Expand Down