diff options
Diffstat (limited to 'postgresqleu/scheduler/util.py')
-rw-r--r-- | postgresqleu/scheduler/util.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/postgresqleu/scheduler/util.py b/postgresqleu/scheduler/util.py index 40c23d23..526fabe5 100644 --- a/postgresqleu/scheduler/util.py +++ b/postgresqleu/scheduler/util.py @@ -8,6 +8,15 @@ def notify_job_change(): curs.execute("NOTIFY pgeu_scheduled_job") +def trigger_immediate_job_run(command): + from .models import ScheduledJob + + j = ScheduledJob.objects.get(command=command) + j.nextrun = datetime.now() + j.save(update_fields=['nextrun']) + notify_job_change() + + def _get_next_time(times): # Next time will be the first one that's after current time current = datetime.now().time() |