Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

Does a cron task have a timeout ?

By
Emanuel Cino
on 11/5/14, 4:48 AM 3,519 views

I have a very long process of invoice generation and validation that works when I do it from the browser (even if it takes several hours to complete). I created a cron task that executes the same process. I can see that the cron successfully starts, but it seems to never finish. It must be silently killed, because I can see no error.

Do you know if there is some timeout for the cron tasks ? If so, how can I change this setting in order to increase the timeout limit ?

1

Atchuthan - Technical Consultant, Sodexis Inc

--Atchuthan - Technical Consultant, Sodexis Inc--
3918
| 5 3 8
Puducherry, India
--Atchuthan - Technical Consultant, Sodexis Inc--
Passionate coder in Python/Odoo(formerly known as OpenERP).

Contact me via GMail: atchuthantu@gmail.com via Skype: atchuthan_skype
via Linkedin: http://in.linkedin.com/in/atchuthantu
Atchuthan - Technical Consultant, Sodexis Inc
On 11/5/14, 4:59 AM

no time-out is set at CRON job.

but the openerp-server has a time-out.  

1. If time-out needs to be increased, you need to configure openerp-server parameters.

These are the basic options available at OpenERP.

  Multiprocessing options:
    --workers=WORKERS   Specify the number of workers, 0 disable prefork mode.
    --limit-memory-soft=LIMIT_MEMORY_SOFT
                        Maximum allowed virtual memory per worker, when
                        reached the worker be reset after the current request
                        (default 671088640 aka 640MB).
    --limit-memory-hard=LIMIT_MEMORY_HARD
                        Maximum allowed virtual memory per worker, when
                        reached, any memory allocation will fail (default
                        805306368 aka 768MB).
    --limit-time-cpu=LIMIT_TIME_CPU
                        Maximum allowed CPU time per request (default 60).
    --limit-time-real=LIMIT_TIME_REAL
                        Maximum allowed Real time per request (default 120).
    --limit-request=LIMIT_REQUEST
                        Maximum number of request to be processed per worker
                        (default 8192).

2. After every update of record, if it is successful. force the cursor to commit

try:
     YOUR CODE
except Exception as e:
      Handle exception if needed
cr.commit()

By doing this, you could avoid processing the same records if the CRON job is killed due to TIME-OUT.

Thank you very much for this complete answer. If I have no timeout when I do the request from the browser, does it mean that my issue is not a server timeout ? Why would it be different when executing by a cron ? Nice tip for the commit, I will try to use it.

Emanuel Cino
on 11/5/14, 5:24 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 11/5/14, 4:48 AM
Seen: 3519 times
Last updated: 3/16/15, 8:10 AM