title: How can I do background work in python 3 Google App Engine standard environment?
body: <p>I have an endpoint on my appengine app (<code>/start</code>) that I use to kick off a process. In the python 2 environment I used <code>deferred</code> to run the process outside of the request context. On appengine flex, you can <a href="https://cloud.google.com/appengine/docs/flexible/python/migrating#background_threads" rel="nofollow noreferrer">run background threads</a> that live outside of the request environment. At first look, I thought this was <a href="https://cloud.google.com/appengine/docs/standard/python3/python-differences#background_threads" rel="nofollow noreferrer">also true</a> of the python 3 standard environment, however at a closer look it contains this note:</p>
  
  <blockquote>
    <p>However note that new threads or processes may not run after the inbound request is served.</p>
  </blockquote>
  
  <p>Does this mean that once the request is served the background thread that I started will be killed? If so, what is the best way to start background work?</p>
  
  <p>I could re-create the <code>deferred</code> library by creating a queue in cloud task and pickling everything, but that's a last resort.</p>