beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <>
Subject [jira] [Commented] (BEAM-1630) Add Splittable DoFn to Python SDK
Date Sat, 02 Dec 2017 00:28:05 GMT


ASF GitHub Bot commented on BEAM-1630:

chamikaramj commented on a change in pull request #4064: [BEAM-1630] Adds support for processing
Splittable DoFns using DirectRunner.

 File path: sdks/python/apache_beam/runners/direct/
 @@ -0,0 +1,237 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# See the License for the specific language governing permissions and
+# limitations under the License.
+"""Unit tests for SDF implementation for DirectRunner."""
+import logging
+import os
+import unittest
+import apache_beam as beam
+from apache_beam import DoFn
+from import filebasedsource_test
+from import OffsetRestrictionTracker
+from apache_beam.testing.test_pipeline import TestPipeline
+from apache_beam.testing.util import assert_that
+from apache_beam.testing.util import equal_to
+from apache_beam.transforms.core import ProcessContinuation
+from apache_beam.transforms.core import RestrictionProvider
+from apache_beam.transforms.trigger import AccumulationMode
+from apache_beam.transforms.window import SlidingWindows
+from apache_beam.transforms.window import TimestampedValue
+class ReadFilesProvider(RestrictionProvider):
+  def restriction_coder(self):
+    return object()
+  def initial_restriction(self, element):
+    size = os.path.getsize(element)
+    return (0, size)
+  def create_tracker(self, restriction):
+    return OffsetRestrictionTracker(restriction[0], restriction[1])
 Review comment:

This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:

> Add Splittable DoFn to Python SDK
> ---------------------------------
>                 Key: BEAM-1630
>                 URL:
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-py-core
>            Reporter: Chamikara Jayalath
>            Assignee: Chamikara Jayalath
> Splittable DoFn [1] is currently being implemented for Java SDK [2]. We should add this
to Python SDK as well.
> Following document proposes an API for this.
> [1]
> [2]

This message was sent by Atlassian JIRA

View raw message