OppiaMobile Community

Cron summary tasks not running after the update

Hi
I have noticed a week after I updated to the new version of the oppia server (v0.12.9) , the cron summary task is nolonger running. And its showing the "Cron tasks have not been run for over 7 days " notification.

Hi @hakimks,
I’ve noticed this happen before occasionally where the cron locks don;t get removed… I think it maybe if the is a server restart, or upgrade when some of the services stop and restart whilst the cron tasks are running.
You can remove/delete the oppia_summary_cron_lock row from the settings table (as you’ve shown above), then try running the cron task again (either manually, or wait until it’s next scheduled to run) and check the lock has been removed correctly
Cheers,
Alex

1 Like

Thanks Alex. It worked.

1 Like

hi @alex
The cron summary task fails , after like 24 hours. So I have to delete the lock every day or so.

Hi @hakimks,
I’m not exactly sure what might be going wrong here, as we have the same code on the core Oppia server and aren’t running into the same issue. But there are a couple of things you could check/test…

In the last code update we made an update so the main cron and summary cron couldn;t be run at the same time (it caused confusion with the summary stats if they were run at the same time).

So I think the first thing to check would be if the 2 cron tasks are set to run at the same time or not. For info on our live core Oppia server we use:

*/20 * * * * /home/www/oppiamobile-cron.sh
*/15 * * * * /home/www/oppiamobile-summary-cron.sh

You could also check that the main cron (python ./django-oppia/manage.py oppiacron --hours=48)
has the --hours param, without that, for a server with a lot of data, it might take a long time to run.

The last option I can think of right now, is to have a single .sh script for both the crons, so something like:

#!/bin/bash
cd /home/www/
source env/bin/activate

python ./django-oppia/manage.py oppiacron --hours=48
python ./django-oppia/manage.py update_summaries

Then the update summaries should always run after the main cron has finished, and so shouldn;t be any conflict.

Hope that helps, but please let me know how you get on

Cheers,
Alex

Hi @hakimks… I noticed that this has also started to happen on the core Oppia server, so I had another look.
It seems that there was a coding error, so the summary cron lock didn’t get removed correctly if the core cron was already running. So this explains the issue you were getting.
I’ve put the fix into the next release branch (https://github.com/DigitalCampus/django-oppia/tree/release-0-12-10), so you can pull that, or the approach of running the crons in a single script should also work.
Cheers,
Alex

1 Like