Hi,
I was facing today some issues with our crontab, so I’m wondering if there is a post/doc somewhere explaining how runScheduledTasks need to be called.
Thanks for your time,
m.
Hi,
I was facing today some issues with our crontab, so I’m wondering if there is a post/doc somewhere explaining how runScheduledTasks need to be called.
Thanks for your time,
m.
Hi @marc,
Start with the “Scheduled Tasks” section of docs/README
.
Regards,
Alec Smecher
Public Knowledge Project Team
Done (looong time ago ), but the document only talk about this call:
$ php /path/to/ojs2/tools/runScheduledTasks.php
And as far as I know, it won’t be enough if you want to run statistics, DOI autoregistration, etc.
For instance, I run this hourly for each of my journals:
$ php tools/runScheduledTasks.php
$ php tools/runScheduledTasks.php plugins/generic/usageStats/scheduledTasksAutoStage.xml
$ php tools/runScheduledTasks.php plugins/importexport/crossref/scheduledTasks.xml
But I don’t know what if other modules need a specific call or the first call will do the job.
Cheers,
m.
Hi @marc,
Sorry for the obvious answer!
The scheduled tasks should get registered in the database when the system gets installed. You can check what’s registered by executing in your database…
SELECT * FROM scheduled_tasks;
This should give you a list of tasks that’ll get executed when you run the runScheduledTasks.php
script.
Regards,
Alec Smecher
Public Knowledge Project Team
Thanks Alec. This query is a great trick.
I didn’t explain myself (probably because I didn’t understand much OJS cron till now).
What I really was asking for was a list of xmls that could should be called (if you are not using acron and the module is enabled).
This grep shows the full list, isn’t it?
$ grep "scheduledTasks.dtd" * -R
lib/pkp/dtd/scheduledTasks.dtd
plugins/importexport/crossref/scheduledTasks.xml
plugins/generic/pln/xml/scheduledTasks.xml
plugins/generic/objectsForReview/xml/scheduledTasks.xml
plugins/generic/usageStats/scheduledTasksAutoStage.xml
plugins/generic/usageStats/scheduledTasksExternalLogFiles.xml
plugins/generic/usageStats/scheduledTasks.xml
plugins/generic/alm/scheduledTasks.xml
registry/scheduledTasks.xml
So now a new (last) question rise to me:
If we don’t include a xml as a parameter, the script assumes “registry/scheduledTasks.xml”?
Cheers,
m.
Hi @marc,
Yes, registry/scheduledTasks.xml
is the default.
Regards,
Alec Smecher
Public Knowledge Project Team
I’ve always thought it a bit non-intuitive that there are two distinct queues for scheduled tasks, and the database registry seems to be effectively ignored. The acron plugin uses the AcronPlugin::parseCronTab
callback for plugins in addition to the registry/scheduledTasks.xml
, and does this through a “setting” intermediary at that. The cron CLI calls use registry/scheduledTasks.xml
as default, and requires explicit naming of any plugin tasks in separate cron calls. Neither uses the scheduled_tasks
table, to my understanding. This leaves us with no way to, for example, use acron with a disabled scheduledTasksAutostage.xml in favor of scheduledTasksExternalLogFiles.xml, at least not without modifying the files.
The way I would have expected it to work would be for the core system and plugins to register tasks in the scheduled_tasks
table, allow the administrator to enable or disable those tasks via the interface, and then consistently call the enabled tasks via either an acron run, or a cron call to the runScheduledTasks.php without a parameter.
Am I missing a piece, or ahead of my time?
This is how all the CMS I know work, and this is why I thought adding a single line in your crontab was enough. May be a xml-based distributed configuration could be more flexible but as @ctgraham points, is not the usual pattern and is less intuitive.
I think this is not a priority now, but IMHO would be nice to delegate the registering task in OJS and simplify the administration/installation. Indeed, if somebody is really interested in changing an specific plugin scheduled task it could be done directly in the DB and if we see this as a requirement, in a far future a frontend ui could be developed.
@asmecher what do you think?
Hi all,
I’ve passed this along to another developer to have a look at – stay tuned for a few days, much of the team is just finished a code sprint and will be traveling back home.
Regards,
Alec Smecher
Public Knowledge Project Team
As was said, not a priority and no hurry at all, but would be great if somebody could take a look and estimate the efforts needed. Thanks @asmecher
Is bumping allowed?
HI @marc
Ah, sorry, apparently I have totally forgotten/lost this thread… I will take a look and think about…
Thanks!!!
Bozana
No worry. Me too.
Hi all,
Sorry for the delay again…
I agree with @marc and @ctgraham. I opened a new issue for that: unify the use of schedulesTasks for Cron and Acron · Issue #2550 · pkp/pkp-lib · GitHub.
I believe that this can be done after the 3.1 release which is currently our high priority.
Thanks a lot!!!
Best,
Bozaan