Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address the execution of scheduled tasks and jobs #9682

Closed
jonasraoni opened this issue Feb 1, 2024 · 3 comments · Fixed by #9689 or #9690
Closed

Address the execution of scheduled tasks and jobs #9682

jonasraoni opened this issue Feb 1, 2024 · 3 comments · Fixed by #9689 or #9690
Assignees
Labels
Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days.
Milestone

Comments

@jonasraoni
Copy link
Contributor

Describe the bug

  • The php tools/runScheduledTasks.php runs scheduled tasks AND jobs.
  • The php lib/pkp/tools/jobs.php run runs only jobs.

Therefore, the execution of scheduled tasks ends up shadowing the usage of the job runner. After skimming the code, looks like the scheduled task PKP\task\ProcessQueueJobs will run all the queued jobs (which might be too resource intensive).

Solution

  • The long-term solution will probably be coded at Replace task scheduler by Laravel scheduler #9678
  • I think it might make sense to keep the php tools/runScheduledTasks.php as it is, doing everything. It will save less skilled users (that won't upgrade the system properly/deal with sysadmin details).
  • As it's tough to call the runScheduledTasks.php frequently inside the job runner (e.g. when using the worker mode, it would probably require dispatching a job that dispatches itself, which is risky if not done properly), then I think a configuration to control whether the runScheduledTasks.php will also run jobs is enough. This will allow skilled users to run the scheduled tasks and jobs separately.

What application are you using?
OJS 3.4

@jonasraoni jonasraoni added the Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days. label Feb 1, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Feb 2, 2024
jonasraoni added a commit to jonasraoni/pkp-lib that referenced this issue Feb 2, 2024
@jonasraoni jonasraoni self-assigned this Feb 2, 2024
@jonasraoni jonasraoni added this to the 3.4.0-5 milestone Feb 2, 2024
@jonasraoni
Copy link
Contributor Author

jonasraoni commented Feb 2, 2024

@touhidurabir You can take a look at this one as well. I think the job_runner setting should also control the execution of jobs at the runScheduledTasks.php, so that's what I did.

@touhidurabir
Copy link
Member

touhidurabir commented Feb 5, 2024

@jonasraoni I approve the changes. even though that was not our initial thought as we want to people move away from job runner as mush as possible but I see the advantage of allowing it run through when running it via cron even when it's disable . This will allow to utilize the job runner with defined constrains through cron even when it's turn off for application request life cycle .

@jonasraoni
Copy link
Contributor Author

Thanks, so I'll merge!

tl;dr:
job_runner = on: The job execution is managed by the application, jobs will be executed together with the scheduled tasks.
job_runner = off: The job execution is fully offloaded to the sysadmin (jobs.php).

jonasraoni added a commit that referenced this issue Feb 5, 2024
…ouple-scheduled-tasks-from-jobs

#9682 Decoupled the execution of scheduled tasks to the ex…
jonasraoni added a commit that referenced this issue Feb 5, 2024
…heduled-tasks-from-jobs

#9682 Decoupled the execution of scheduled tasks to the ex…
ipula pushed a commit to ipula/pkp-lib that referenced this issue Feb 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement:1:Minor A new feature or improvement that can be implemented in less than 3 days.
Projects
None yet
2 participants