title: Interact with long running python process
body: <p>I have a long running python process running headless on a raspberrypi (controlling a garden) like so:</p>
  
  <pre><code>from time import sleep
  
  def run_garden():
      while 1:
          /* do work */
          sleep(60)
  
  if __name__ == "__main__":
      run_garden()
  </code></pre>
  
  <p>The 60 second sleep period is plenty of time for any changes happening in my garden (humidity, air temp, turn on pump, turn off fan etc), BUT what if i want to manually override these things?</p>
  
  <p>Currently, in my <code>/* do work */</code> loop, i first call out to another server where I keep config variables, and I can update those config variables via a web console, but it lacks any sort of real time feel, because it relies on the 60 second loop (e.g. you might update the web console, and then wait 45 seconds for the desired effect to take effect)</p>
  
  <p>The raspberryPi running <code>run_garden()</code> is dedicated to the garden and it is basically the only thing taking up resources. So i know i have room to do something, I just dont know what.</p>
  
  <p>Once the loop picks up the fact that a config var has been updated, the loop could then do exponential backoff to keep checking for interaction, rather than wait 60 seconds, but it just doesnt feel like that is a whole lot better.</p>
  
  <p>Is there a better way to basically jump into this long running process?</p>