Hooks.py updated but scheduled job not running

erpnext v13-beta

Scenario:

  1. Custom app created and working fine.
  2. hooks.py updated with adding the scheduled job on hourly basis
  3. restarted bench and wait for the scheduled task to run.

Situation:
The scheduled task does not run.
Site is set for enable-scheduler
Scheduled Job Log does not show any errors
Scheduled Job Type does not list the newly added scheduled job to the list

Solution:
Go to bench console:

In [1]: from frappe.core.doctype.scheduled_job_type.scheduled_job_type import sync_jobs
In [2]: sync_jobs()
In [3]: frappe.db.commit()

The scheduled job type will now show the newly added scheduled job
The scheduled job will run and show in scheduled job log.

Hope it helps others.

3 Likes

Or you can just run

bench migrate

Reference: frappe/migrate.py at version-13-beta · frappe/frappe · GitHub

4 Likes