Skip to Content

Contributors

queue_job, how to set time limit for jobrunner

Dear community,

So far, when there is a job queue that spend long time to run, it seem time limit now follow "limit_time_cpu".

Which surprise me, because I though it should follow "limit_time_real_cron" as in Odoo cron.

limit_time_cpu which is for http request, normally not a high value, i.e, 60 seconds. But to accommodate the long running job, I am forced to expand the value which can be harmful.

Am I missing something?

Many thanks
Kitti U.




by Kitti Upariphutthiphong - 06:06 - 12 Apr 2024

Follow-Ups

  • Re: queue_job, how to set time limit for jobrunner
    Thanks a lot Tom for your recipe, this can be very helpful.

    Kitti

    On Sat, Apr 13, 2024, 9:12 PM Tom Blauwendraat <notifications@odoo-community.org> wrote:
    On 4/12/24 19:07, Stéphane Bidoul wrote:
    
    
    > If you need long running jobs, you need to launch a second Odoo 
    
    
    > instance on the same database with different time limits.
    
    Instead of starting the whole Odoo, it's also possible to start the 
    jobrunner as a separate service like this:
    
    python -c "import odoo; odoo.tools.config.parse_config(); from 
    odoo.addons import queue_job; runner = 
    queue_job.jobrunner.QueueJobRunner.from_environ_or_config(); runner.run()"
    
    I don't remember why we chose this or where I got it from, but it works.
    
    Maybe it helps! (Probably here you'd have to add an extra line of Python 
    to change the cpu_limit setting after parsing the config)
    
    

    _______________________________________________
    Mailing-List: https://odoo-community.org/groups/contributors-15
    Post to: mailto:contributors@odoo-community.org
    Unsubscribe: https://odoo-community.org/groups?unsubscribe


    by Kitti Upariphutthiphong - 08:06 - 13 Apr 2024
  • Re: queue_job, how to set time limit for jobrunner
    On 4/12/24 19:07, Stéphane Bidoul wrote:
    
    > If you need long running jobs, you need to launch a second Odoo 
    
    > instance on the same database with different time limits.
    
    Instead of starting the whole Odoo, it's also possible to start the 
    jobrunner as a separate service like this:
    
    python -c "import odoo; odoo.tools.config.parse_config(); from 
    odoo.addons import queue_job; runner = 
    queue_job.jobrunner.QueueJobRunner.from_environ_or_config(); runner.run()"
    
    I don't remember why we chose this or where I got it from, but it works.
    
    Maybe it helps! (Probably here you'd have to add an extra line of Python 
    to change the cpu_limit setting after parsing the config)
    
    

    by Tom Blauwendraat - 04:11 - 13 Apr 2024
  • Re: queue_job, how to set time limit for jobrunner
    Hi Stephane

    Thanks for the confirmation. I also came across this README and it confirms what you say.


    Unlike the regular job runner, where jobs are dispatched to the HttpWorkers, jobs are processed on the CronWorker threads by the job runner crons. This is a design decision because:

    Thanks!
    Kitti



    On Sat, Apr 13, 2024 at 12:07 AM Stéphane Bidoul <notifications@odoo-community.org> wrote:
    Hi Kitti,

    The jobs triggered by queue_job run in regular workers. So limit_time_cpu/limit_time_real apply (the job runner actually launch them with an HTTP request).
    limit_time_real_cron is exclusively for Odoo regular cron jobs (Scheduled Actions).

    If you need long running jobs, you need to launch a second Odoo instance on the same database with different time limits.

    Best regards,

    -Stéphane

    On Fri, Apr 12, 2024 at 6:06 PM Kitti Upariphutthiphong <notifications@odoo-community.org> wrote:
    Dear community,

    So far, when there is a job queue that spend long time to run, it seem time limit now follow "limit_time_cpu".

    Which surprise me, because I though it should follow "limit_time_real_cron" as in Odoo cron.

    limit_time_cpu which is for http request, normally not a high value, i.e, 60 seconds. But to accommodate the long running job, I am forced to expand the value which can be harmful.

    Am I missing something?

    Many thanks
    Kitti U.



    _______________________________________________
    Mailing-List: https://odoo-community.org/groups/contributors-15
    Post to: mailto:contributors@odoo-community.org
    Unsubscribe: https://odoo-community.org/groups?unsubscribe

    _______________________________________________
    Mailing-List: https://odoo-community.org/groups/contributors-15
    Post to: mailto:contributors@odoo-community.org
    Unsubscribe: https://odoo-community.org/groups?unsubscribe


    by Kitti Upariphutthiphong - 03:56 - 13 Apr 2024
  • Re: queue_job, how to set time limit for jobrunner
    Hi Kitti,

    The jobs triggered by queue_job run in regular workers. So limit_time_cpu/limit_time_real apply (the job runner actually launch them with an HTTP request).
    limit_time_real_cron is exclusively for Odoo regular cron jobs (Scheduled Actions).

    If you need long running jobs, you need to launch a second Odoo instance on the same database with different time limits.

    Best regards,

    -Stéphane

    On Fri, Apr 12, 2024 at 6:06 PM Kitti Upariphutthiphong <notifications@odoo-community.org> wrote:
    Dear community,

    So far, when there is a job queue that spend long time to run, it seem time limit now follow "limit_time_cpu".

    Which surprise me, because I though it should follow "limit_time_real_cron" as in Odoo cron.

    limit_time_cpu which is for http request, normally not a high value, i.e, 60 seconds. But to accommodate the long running job, I am forced to expand the value which can be harmful.

    Am I missing something?

    Many thanks
    Kitti U.



    _______________________________________________
    Mailing-List: https://odoo-community.org/groups/contributors-15
    Post to: mailto:contributors@odoo-community.org
    Unsubscribe: https://odoo-community.org/groups?unsubscribe


    by Stéphane Bidoul - 07:06 - 12 Apr 2024