Fixed the example usage in pipeline.py It was not conforming to python-sdk.
Project: http://git-wip-us.apache.org/repos/asf/beam/repo Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/d84ac291 Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/d84ac291 Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/d84ac291 Branch: refs/heads/python-sdk Commit: d84ac2910f14dbd9aeb166e20bd0f181e7e1af5d Parents: d190641 Author: Younghee Kwon <[email protected]> Authored: Thu Dec 22 13:57:49 2016 -0800 Committer: Robert Bradshaw <[email protected]> Committed: Tue Jan 3 10:39:20 2017 -0800 ---------------------------------------------------------------------- sdks/python/apache_beam/pipeline.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/beam/blob/d84ac291/sdks/python/apache_beam/pipeline.py ---------------------------------------------------------------------- diff --git a/sdks/python/apache_beam/pipeline.py b/sdks/python/apache_beam/pipeline.py index 81343f3..6517960 100644 --- a/sdks/python/apache_beam/pipeline.py +++ b/sdks/python/apache_beam/pipeline.py @@ -28,15 +28,19 @@ to be executed for each node visited is specified through a runner object. Typical usage: # Create a pipeline object using a local runner for execution. - pipeline = Pipeline(runner=DirectRunner()) + p = beam.Pipeline('DirectRunner') # Add to the pipeline a "Create" transform. When executed this # transform will produce a PCollection object with the specified values. - pcoll = pipeline.create('label', [1, 2, 3]) + pcoll = p | 'create' >> beam.Create([1, 2, 3]) + + # Another transform could be applied to pcoll, e.g., writing to a text file. + # For other transforms, refer to transforms/ directory. + pcoll | 'write' >> beam.io.WriteToText('./output') # run() will execute the DAG stored in the pipeline. The execution of the # nodes visited is done using the specified local runner. - pipeline.run() + p.run() """
