4

I'm trying to run this code:

from pytz import utc
from apscheduler.schedulers.background import BackgroundScheduler
from apscheduler.jobstores.mongodb import MongoDBJobStore

jobstores = {
  'default': MongoDBJobStore(database='apscheduler', collection='jobs', host='xxx', port=27017)
}
sched = BackgroundScheduler(jobstores=jobstores)
@sched.scheduled_job('interval', seconds=1)
def job():
    print 'This job is run every second.'

sched.start()

but get error: ValueError: This Job cannot be serialized since the reference to its callable () could not be determined. Consider giving a textual reference (module:function name) instead.

Aviv Noy
  • 526
  • 2
  • 7
  • 20

1 Answers1

0

The problem was that i used decorator scheduled_job.

Aviv Noy
  • 526
  • 2
  • 7
  • 20
  • This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - [From Review](/review/low-quality-posts/10185203) – Lawrence Aiello Nov 12 '15 at 18:56
  • @LawrenceAiello This *is* an answer (the OP solved their own problem). Just not a descriptive one. – Ajean Nov 13 '15 at 00:26