title: Is it possible to have Celery run an infinite loop in the background? (flask)
body: <p>I have the following celery task:</p>
  
  <pre><code>@celery.task
  def ScrapeWhileTrue():
      current_titles = scrape_title()
      current_urls = scrape_url()
      while(True):
          time.sleep(10)
          print("completing a test")
          current_titles2 = scrape_title()
          current_urls2 = scrape_url()
          if current_titles != current_titles2:
              print("New listings!")
              new_titles = set(current_titles2) - set(current_titles)
              new_urls = set(current_urls2) - set(current_urls)
              # send_mail(new_titles, new_urls)
              current_titles = current_titles2
              current_urls = current_urls2
  </code></pre>
  
  <p>Mt HTML contains two buttons, one which sends the data from the form to a different function. The second button I would like to be toggle-able. While its toggled, I would like it to run the above Celery task.</p>
  
  <pre><code>@app.route('/', methods=['GET', 'POST'])
  def index():
  
      if request.form['submit'] == 'Send':
          #Set info
          global url
          url = CraiglistScraper(location, postal, max_price, radius, query, carorpart)
          flash('Info set')
  
      else:
          flash('Scraping')
          ScrapeWhileTrue()
  
  
      return redirect(url_for('index'))
  </code></pre>
  
  <p>Is it possible to have something like this happen? Or would I need to run it as a Daemon (I have no idea how)?</p>
  
  <p>Thanks!</p>