title: Multiprocessing subject to timer
body: <p>I have a large list L to operate over.  Let f() be the function which operates on L.  f() takes another variable, which expires every 15 minutes and needs to be renewed.  Here is an example, in serial:</p>
  
  <pre><code>def main():
      L = openList()
      # START THE CLOCK
      clockStart = dt.datetime.now()
      clockExp = clockStart + dt.timedelta(seconds=900)
      a = getRenewed()
      for item in L:
          f(item, a)   # operate on item given a
          # CHECK TIME REMAINING
          clockCur = dt.datetime.now()
          clockRem = (clockExp - clockCur).total_seconds()
          # RENEW a IF NEEDED
          if clockRem &lt; 5: # renew with 5 seconds left
              clockStart = dt.datetime.now()
              clockExp = clockStart + dt.timedelta(seconds=900)
              a = getRenewed()
  </code></pre>
  
  <p>Since f() takes a few seconds (or longer sometimes), I would like to parallelize the code. Any tips for how to do that given the timer?  I envision sharing clockExp and "a", and when a process satisfies clockRem &lt; 5, it calls getRenewed() and shares the new "a" and clockExp, and repeat.</p>