You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by ro...@apache.org on 2016/07/22 00:41:32 UTC
[1/2] incubator-beam git commit: Minor cdef value changes.
Repository: incubator-beam
Updated Branches:
refs/heads/python-sdk d78b38d1d -> e5006991d
Minor cdef value changes.
Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/19082adb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/19082adb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/19082adb
Branch: refs/heads/python-sdk
Commit: 19082adb1522365b1f526e8c28a0a04a20744128
Parents: d78b38d
Author: Robert Bradshaw <ro...@google.com>
Authored: Thu Jul 21 10:36:36 2016 -0700
Committer: Robert Bradshaw <ro...@google.com>
Committed: Thu Jul 21 17:38:55 2016 -0700
----------------------------------------------------------------------
sdks/python/apache_beam/runners/common.pxd | 4 ++--
sdks/python/apache_beam/runners/common.py | 15 ++++++++++++---
2 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/19082adb/sdks/python/apache_beam/runners/common.pxd
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/common.pxd b/sdks/python/apache_beam/runners/common.pxd
index 7191659..e1bf461 100644
--- a/sdks/python/apache_beam/runners/common.pxd
+++ b/sdks/python/apache_beam/runners/common.pxd
@@ -39,11 +39,11 @@ cdef class DoFnContext(object):
cdef object label
cdef object state
cdef WindowedValue windowed_value
- cdef set_element(self, WindowedValue windowed_value)
+ cpdef set_element(self, WindowedValue windowed_value)
cdef class Receiver(object):
- cdef receive(self, WindowedValue windowed_value)
+ cpdef receive(self, WindowedValue windowed_value)
cdef class LoggingContext(object):
http://git-wip-us.apache.org/repos/asf/incubator-beam/blob/19082adb/sdks/python/apache_beam/runners/common.py
----------------------------------------------------------------------
diff --git a/sdks/python/apache_beam/runners/common.py b/sdks/python/apache_beam/runners/common.py
index a565645..c6b27bc 100644
--- a/sdks/python/apache_beam/runners/common.py
+++ b/sdks/python/apache_beam/runners/common.py
@@ -214,15 +214,24 @@ class DoFnContext(object):
@property
def element(self):
- return self.windowed_value.value
+ if self.windowed_value is None:
+ raise AttributeError('element not accessible in this context')
+ else:
+ return self.windowed_value.value
@property
def timestamp(self):
- return self.windowed_value.timestamp
+ if self.windowed_value is None:
+ raise AttributeError('timestamp not accessible in this context')
+ else:
+ return self.windowed_value.timestamp
@property
def windows(self):
- return self.windowed_value.windows
+ if self.windowed_value is None:
+ raise AttributeError('windows not accessible in this context')
+ else:
+ return self.windowed_value.windows
def aggregate_to(self, aggregator, input_value):
self.state.counter_for(aggregator).update(input_value)
[2/2] incubator-beam git commit: Closes #705
Posted by ro...@apache.org.
Closes #705
Project: http://git-wip-us.apache.org/repos/asf/incubator-beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-beam/commit/e5006991
Tree: http://git-wip-us.apache.org/repos/asf/incubator-beam/tree/e5006991
Diff: http://git-wip-us.apache.org/repos/asf/incubator-beam/diff/e5006991
Branch: refs/heads/python-sdk
Commit: e5006991d730f8fb222639f7c23b33cb8f046ce4
Parents: d78b38d 19082ad
Author: Robert Bradshaw <ro...@google.com>
Authored: Thu Jul 21 17:41:06 2016 -0700
Committer: Robert Bradshaw <ro...@google.com>
Committed: Thu Jul 21 17:41:06 2016 -0700
----------------------------------------------------------------------
sdks/python/apache_beam/runners/common.pxd | 4 ++--
sdks/python/apache_beam/runners/common.py | 15 ++++++++++++---
2 files changed, 14 insertions(+), 5 deletions(-)
----------------------------------------------------------------------