ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

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.

1 Like

Or you can just run

bench migrate

Reference: https://github.com/frappe/frappe/blob/version-13-beta/frappe/migrate.py#L72

3 Likes