OJS 3.4 statistics

Hi,

After OJS upgrade to 3.4.0-9 i noticed that there are no new log files in usageStats/archive directory, however there is a log file in usageStats/usageEventLogs/. I tried to investigate this a bit so i found out that usageStats plugin is not part of the OJS 3.4 installation anymore (in 3.2 i had this plugin and it was working fine). I’m not sure how this should work now? I checked documentation but there is nothing about this. Can someone explain how to setup this? Thx.

Regards.

You have to set up a job runner. See https://docs.pkp.sfu.ca/admin-guide/en/deploy-jobs

I have cron setup as:

php tools/runScheduledTasks.php

so i need to setup jobs too?

EDIT: ok, so it seems i need to run:

php lib/pkp/tools/jobs.php run

but i don’t know whats’ the purpose of:

php tools/runScheduledTasks.php. Is this thing now obsolete?

Regards.

Hi @asmecher,

Can i ask you to clarify this because documentation is not clear about it (i posted request for doc. update). So, what exactly should be put in the cron and in which order? For now i have:

tools/runScheduledTasks.php
lib/pkp/tools/jobs.php run
lib/pkp/tools/jobs.php run --class=PKP\jobs\statistics\CompileUsageStats

I found out that running only lib/pkp/tools/jobs.php run will not process statistics logs, so i ran lib/pkp/tools/jobs.php run --class=PKP\jobs\statistics\CompileUsageStats for that. Is that ok or i’m doing something wrong? Thank you.

Regards.

Hi @orcalator

Scheduled tasks are different from jobs and both are needed. Scheduled task are actions run at some specific times, e.g. daily, e.g. to register articles in DOAJ or Crossref, or to process the usage stats log files. Jobs are actions/functions that are run in the ‘background’, asynchronously, so that the user does not need to wait for them.
If the installation is not big, Acron plugin can be used to run scheduled tasks – it is a default setting. Also for small installations, jobs can be run on requests, using the build-in job runner.
Regarding statistics:
the scheduled task UsageStatsLoader should be executed daily. The scheduled task would dispatch lots of jobs per usage stats log file, that would process the log file and compile the statistics.
Here are all the jobs that are run per log file: ojs/classes/tasks/UsageStatsLoader.php at stable-3_4_0 · pkp/ojs · GitHub. Also, the jobs cannot be run arbitrary – all jobs, for all log files, need to be run in exactly the same order, and in chain (meaning that they cannot be run in parallel, but only one after another).

Thus, your setup
lib/pkp/tools/jobs.php run --class=PKP\jobs\statistics\CompileUsageStats
is not correct.
If you are using Cron to run jobs, you should only use
php lib/pkp/tools/jobs.php run
or
php lib/pkp/tools/jobs.php run --once
and adapt the config.inc.php to have
job_runner = Off
as written in the documentation.

Best,
Bozana

@bozana

Thank you for the clarification. After the upgrade, I couldn’t get the logs to process either through scheduled tasks or jobs, but after running lib/pkp/tools/jobs.php run --class=PKP\jobs\statistics\CompileUsageStats, they were processed successfully. However it seems it’s working fine now by running only scheduled tasks and jobs.php.

Regards.

Hi @orcalator

I have just spoken with my colleague, and that cron option for jobs should actually not be used – we will also correct the documentation.
Thus for running the jobs, it is best to use Workers option from the documentation. Or, if your site is not big, you could try using the built-in job runner.

Best,
Bozana