title: Python Sdk Code Example for Splittable Dofns in Apache Beam
body: <p>I am creating a dataflow pipeline in python in which i need to use FileIO because i want to access and keep track of the filenames processed.</p>
  <p>Everything is working fine ,till my files are of small sizes. When running on a large files(GBS of data) , the dataflow job is not performant or scalable.</p>
  <p>I have a solution of using splittable Pardos(dofns) which I have  earlier implemented using java, but now the preferred language is python.</p>
  <p>The problem is that I am unable to find any decent code snippets (example) which will explain how to implement a splittable pardo (dofns) in python sdk.</p>
  <p>I have found a code example in the beam documentation <a href="https://beam.apache.org/blog/splittable-do-fn/" rel="nofollow noreferrer">https://beam.apache.org/blog/splittable-do-fn/</a> , but it's not correct as far as I have tried it.</p>
  <pre><code>class CountFn(DoFn):
    def process(element, tracker=DoFn.RestrictionTrackerParam)
      for i in xrange(*tracker.current_restriction()):
        if not tracker.try_claim(i):
          return
        yield element[0], i
  
    def get_initial_restriction(element):
      return (0, element[1])
  </code></pre>
  <p>In this example , we are passing tracker=DoFn.RestrictionTrackerParam in the process method, but as I can see DoFn class does not have any parameter RestrictionTrackerParam.</p>
  <p>As far as I have tested this example is not complete.</p>
  <p>Can i get some help on getting a decent example of splittable dofns used in python sdk.</p>