Project

General

Profile

Prewikka Scheduled Jobs

Added by Rudolf Spring 11 months ago

I'm running Prelude 4.1.5 on Gentoo 4.17.10. Everything works except Scheduled Jobs in Prewikka. In the GUI the default jobs (Search history deletion/Hourly - Alert deletion/Daily - Heartbeat deletion/Daily) are listed as executed and scheduled for next execution. But all 3 jobs don't do anything. I'm running Prewikka with wsgi and uid:guid apache:apache prewikka-crontab runs with the same uid:gid. Any ideas ?


Replies (10)

RE: Prewikka Scheduled Jobs - Added by Antoine LUONG 11 months ago

Hello, did you configure the [cron] sections in prewikka.conf? This is necessary for the alert/heartbeat deletion.

RE: Prewikka Scheduled Jobs - Added by Rudolf Spring 11 months ago

I configured the 3 cron sections in prewikka.conf.

[cron alert]
age: 1

[cron heartbeat]
age: 1

[cron search_history]
size: 10

RE: Prewikka Scheduled Jobs - Added by Antoine LUONG 11 months ago

Did you restart the prewikka-crontab service after modifying the configuration? Are there any errors in the logs?

RE: Prewikka Scheduled Jobs - Added by Antoine LUONG 11 months ago

It may be a bug with the prewikka-crontab executable currently not working with Python3. Can you apply the following patch?

diff --git a/scripts/prewikka-crontab b/scripts/prewikka-crontab
index 9d90fd5..41d03c5 100644
--- a/scripts/prewikka-crontab
+++ b/scripts/prewikka-crontab
@@ -71,7 +71,7 @@ def _daemonize(options):
         getattr(sys, i).close()
         setattr(sys, i, nd)

-    os.umask(027)
+    os.umask(0o27)
     os.chdir('/')

     _LOCKFD.write('%s\n' % (os.getpid()))

RE: Prewikka Scheduled Jobs - Added by Rudolf Spring 11 months ago

prewikka-crontab runs as:

apache 27784 9.6 0.6 211816 54908 ? Ss 20:23 0:00 /usr/bin/python2.7 /usr/lib/python-exec/python2.7/prewikka-crontab

I'm not sure if the patch would help. For testing i applied it.

If i select in the GUI under Apps Update/Confirm and return to Scheduled Jobs I have an error for Search history deletion: Scheduled job with invalid extension type 'search_history'. But only in this order. Normally i don't have this error. Maybe not related to my problem.

RE: RE: Prewikka Scheduled Jobs - Added by Antoine LUONG 11 months ago

No, that's unrelated (it was fixed in version 4.1.8).

RE: Prewikka Scheduled Jobs - Added by Rudolf Spring 11 months ago

I changed my openrc init script to:

start-stop-daemon --start --make-pidfile --pidfile /var/run/prewikka-crontab --user=apache:apache --exec /usr/bin/prewikka-crontab -- d - -c /etc/prewikka/prewikka.conf

New with the -c and -d options. Lockfile /tmp/prewikka-crontab-xxxxxxxxxxxxxxxxxx.lock created now with correct uid:gid.

The Prewikka_Crontab table:

---------------------------+--------+------------+----------------+--------+---------------------+---------+--------+-------+ | id | name | userid | schedule | ext_type | ext_id | base | enabled | runcnt | error |
---------------------------+--------+------------+----------------+--------+---------------------+---------+--------+-------+ | 1 | Search history deletion | NULL | 0 * * * * | search_history | NULL | 2018-08-01 09:00:04 | 1 | 95 | NULL | | 2 | Alert deletion | NULL | 0 23 * * * | alert | NULL | 2018-08-01 09:20:21 | 1 | 8 | NULL | | 3 | Heartbeat deletion | NULL | 0 23 * * * | heartbeat | NULL | 2018-08-01 09:20:21 | 1 | 8 | NULL |
---------------------------+--------+------------+----------------+--------+---------------------+---------+--------+-------+

No userid ? Timezone support doesn't work properly. Scheduled jobs are executed one hour later as scheduled. 09:20 was actually 10:20. TZ is Atlantic/Canary in GUI/Admin/Preferences.

RE: Prewikka Scheduled Jobs - Added by Rudolf Spring 11 months ago

Cronjobs are working now. Problem was TZ. Machine is suspended after 01:00. With default cronjob time the jobs where never really executed because 00:00 is actually 01:00 with my TZ setting. Maybe you can fix the TZ behaviour in a future release.

RE: Prewikka Scheduled Jobs - Added by Thomas ANDREJAK 11 months ago

What is your version of python-croniter ?

RE: Prewikka Scheduled Jobs - Added by Rudolf Spring 11 months ago

dev-python/croniter-0.3.17::gentoo USE="{-test}" PYTHON_TARGETS="python2_7 python3_6 -python3_4 -python3_5"

    (1-10/10)