Scheduler via hooks

Hi,

Im trying to create a scheduler event that runs every hour (set to “All” for testing).

Ived created the methos in my doctype python file and referenced it in my hooks file of the app as

scheduler_events = {
“all”: [
“access_control.doctype.residential_unit.residential_unit.check_expired”
]
}

I dont think it running cause the data its meant to update has not changed. How can I tell if it actually running and how and where can I create logs so I can put some debug info?

Ived searched the forums and tried ‘bench doctor’ and get this:

bench --site kyalom doctor
-----Checking scheduler status-----
Workers online: 3
-----None Jobs-----

Any other reasons and tricks I can apply to get this to work? Am I missing something?

im on version: Frappe Framework: v8.9.2 (master)

regards
Hemant

Hi @hpema108,

Try sudo supervisorctl restart all :wink:

To test your method, use the bench execute command, so you can debug it without running it as a scheduled event.

Hi @chdecultot

Thanks for your input…already tried the : sudo supervisorctl restart all, that did not work but the reason was my reference to where the script was located which I found by using the bench execute command.

Thanks that solved it for me :wink:

regards

Hi @chdecultot

Interesting thing happening. When i try bench execute the script runs. But it does not seem to run on the scheduler which for now I set to “all” so that would be 3 mins no? Or do I have to set that somewhere too?

I checking in the frappe.log file when it runs as I used frappe.logger().debug(‘Checking Expired pins…’)

Any more ideas?

regards

Humm… Difficult to say. If you have restarted all supervisor processes after changing the path to your command, I really don’t know.

Have you checked bench doctor ?

same as before:

hemant@ubuntu:~/frappe-bench$ bench --site kyalom doctor
-----Checking scheduler status-----
Workers online: 3
-----None Jobs-----
hemant@ubuntu:~/frappe-bench$

Hi @chdecultot,

This issue solved. I had to wait at least 3 mins for the first run of scheduler to run.

All fine and working perfectly. Please close this topic as solved. Thanks.

Regards

1 Like