title: How to dynamically add a scheduled task to Celery beat
body: <p>Using Celery ver.3.1.23, I am trying to dynamically add a scheduled task to celery beat. I have one celery worker and one celery beat instance running.</p>
  
  <p>Triggering a standard celery task y running task.delay() works ok. When I define a scheduled periodic task as a setting in configuration, celery beat runs it.</p>
  
  <p>However what I need is to be able to add a task that runs at specified crontab at runtime. After adding a task to persistent scheduler, celery beat doesn't seem to detect the newly added new task. I can see that the celery-schedule file does have an entry with new task.</p>
  
  <p>Code:</p>
  
  <pre><code>scheduler = PersistentScheduler(app=current_app, schedule_filename='celerybeat-schedule')
  scheduler.add(name="adder",
            task="app.tasks.add",
            schedule=crontab(minute='*/1'),
            args=(1,2))
  scheduler.close()
  </code></pre>
  
  <p>When I run:</p>
  
  <pre><code>print(scheduler.schedule)
  </code></pre>
  
  <p>I get:</p>
  
  <pre><code>{'celery.backend_cleanup': &lt;Entry: celery.backend_cleanup celery.backend_cleanup() &lt;crontab: 0 4 * * * (m/h/d/dM/MY)&gt;,
  'adder': &lt;Entry: adder app.tasks.add(1, 2) &lt;crontab: */1 * * * * (m/h/d/dM/MY)&gt;}
  </code></pre>
  
  <p>​</p>
  
  <p>Note that app.tasks.add has the <code>@celery.task</code> decorator.</p>