Dynamically add periodic tasks from a flash application

I have a flash application deployed to a hero. I need to schedule a background task to run at a specific time. I tried using the apscheduler module. Although it allows you to define periodic tasks by easily adding them from the application at runtime, this is what I am looking for.

I tried using the same jobs in apscheduler

import time from apscheduler.scheduler import Scheduler from apscheduler.jobstores.shelve_store import ShelveJobStore sched = Scheduler() sched.add_jobstore(ShelveJobStore('jobstore.db'), 'shelve') sched.start() 

And from the terminal I tried this,

 Python 2.7.5 (default, May 12 2013, 12:00:47) [GCC 4.8.0 20130502 (prerelease)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> from apscheduler.scheduler import Scheduler >>> sc = Scheduler() >>> sc.add_jobstore('jobstore.db', 'shelve') Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/dhananjay/git/blast/venv/lib/python2.7/site-packages/apscheduler/scheduler.py", line 168, in add_jobstore jobstore.load_jobs() AttributeError: 'str' object has no attribute 'load_jobs' 

I came across this question while looking for a celery based approach. He talks about the same problem from the point of view of django, but I cannot get it to work with my application (I completely ignore django)

+4
source share
1 answer

When you tried to run it from the terminal, you gave the add_jobstore line as the first parameter instead of the job repository. He expects the job store to be the first parameter, see the Documentation for more information .

Regarding the planning of background tasks in Heroku, I would recommend reading the article Working dynamic, background tasks and queues on this subject.

0
source

Source: https://habr.com/ru/post/1500899/


All Articles