This is how my scheduler configuration and the registered job look like
from django.core.management import call_command
def start():
from django_apscheduler.jobstores import register_events, DjangoJobStore, register_job
from apscheduler.schedulers.background import BackgroundScheduler
scheduler = BackgroundScheduler()
scheduler.add_jobstore(DjangoJobStore(), 'djangojobstore')
try:
@register_job(scheduler, 'interval', minutes=1, name="daily_bakcup", misfire_grace_time = 300, max_instances=3)
def backup():
call_command('DB_Backup')
except Exception as e:
print("Error" , e)
register_events(scheduler)
scheduler.start()
Here is the explanation of what the job does and where the error come.
So, the job is to take a backup of the database using Django's python manage.py dumpdata > file.json
command, then upload it to Azure container.
The thing I wanted to achieve is to perform the job and log the execution in the Job Execution tables (which is expected to happen implicitly when jobstores are used.) in the Database.
Hence, it performs the job but doesn't log the execution in the tables, instead, I get the below in the console.
Job 'user_accounts.backup.backup' no longer exists! Skipping logging of job execution...
Any suggestions and solutions would help a lot. Thanks!