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.

6

OE8 + WSGI : CRON Not working

By
swapnil wagh
on 10/10/14, 10:55 AM 2,064 views

Issue: https://github.com/odoo/odoo/issues/3091

I am struggling to make cron/scheduler working in Openerp/ Odoo 8 with mod_wsgi
First I had problem with Odoo css and js were not loading with apache 2.4 and Ubuntu 14.04
http://goo.gl/LLBCAg Later I started working on Ubuntu 12.04 with apahce 2.2 it work for me, still my question on forum is open if any one face same issue and has solution please share.

Now I am struggling with other problem, and its problem from v7 , here is my conf

<VirtualHost *:80>
        ServerName domain.com
        WSGIScriptAlias / /home/swapnil/my_workspace/OpenERP/odoo-workspace/odoo-8.0/openerp-wsgi.py
        WSGIDaemonProcess oe user=openerp group=openerp processes=4 python-path=/home/swapnil/my_workspace/OpenERP/odoo-workspace/odoo-8.0display-name=apache-openerp
        WSGIProcessGroup oe
        <Directory /home/swapnil/my_workspace/OpenERP/odoo-workspace/odoo-8.0 >
                #Options FollowSymLinks
                #AllowOverride All
                Order deny,allow
                Allow from all
        </Directory>
        ErrorLog /home/logs/apache-openerp.log
</VirtualHost>

openerp-wsgi.py conf:

import openerp

#----------------------------------------------------------
# Common
#----------------------------------------------------------
openerp.multi_process = True # Nah!

# Equivalent of --load command-line option
openerp.conf.server_wide_modules = ['web']
conf = openerp.tools.config

# Path to the OpenERP Addons repository (comma-separated for
# multiple locations)

conf['addons_path'] = '/home/swapnil/my_workspace/OpenERP/odoo-workspace/odoo-8.0/openerp/addons,/home/swapnil/my_workspace/OpenERP/odoo-workspace/odoo-8.0/addons'   #path from home folder to openerp

# Optional database config if not using local socket
#conf['db_name'] = 'mycompany'
conf['db_host'] = 'localhost'
conf['db_user'] = 'odoo'
conf['db_port'] = 5432
conf['db_password'] = 'password'

#----------------------------------------------------------
# Generic WSGI handlers application
#----------------------------------------------------------
application = openerp.service.wsgi_server.application

#----------------------------------------------------------
# Gunicorn
#----------------------------------------------------------
# Standard OpenERP XML-RPC port is 8069
bind = '0.0.0.0:8069'
pidfile = '.gunicorn.pid'
workers = 4
timeout = 240
max_requests = 2000

After this everything work fine for me except the crons :(
Any one can help me to solve this issue.

6

Vasiliy Birukov

--Vasiliy Birukov--
3446
| 6 6 8
Russian Federation
--Vasiliy Birukov--

Help develop and implement any project on base Odoo.

Vasiliy Birukov
On 12/5/14, 9:08 AM

Try our module cron for manual start cron from odoo interface.

2
odookillsme
On 1/13/15, 8:45 AM

You need to add these lines to your wsgi-file in order to make cron jobs work

from openerp.service.server import ThreadedServer
 

and after the "openerp.service.server.load_server_wide_modules()"


ThreadedServer(None).cron_spawn()

2
Viktor Nagy
On 10/11/14, 10:43 AM

I just run into this same problem running an instance with uwsgi (not gunicorn). The instance was running fine for more than a month, but no cron jobs were running.
The reason behind this unexpected behavior was pretty simple. The cron jobs are never started running only a simple wsgi application.

I've followed the code base as much as I could, and the only places where cron jobs are started are when openerp is started from the command line. Thus cron is never started for wsgi apps.
For this reason, you have 2 possibilities:

  1. run a separate openerp-server instance that is initialised, and will only consume your cron job
  2. add the cron init code to your wsgi initialisation

I've tried the latter. My current setup seems to work well, but I'm not sure if it's really OK or not. Here follows what I did:

  1. Add an `import cron` line towards the top of openerp/service/wsgi_server.py.
  2. Add `cron.start_service()` around line 413, after the `openerp.service.start_internal()` call.
  3. Restart your server

@Viktor Thanks for comment will try it for sure

swapnil wagh
on 10/13/14, 3:30 AM

@Viktor sorry I forgot to mention the version I am looking for odoo 8 your solution work at least for me in v7. You have any idea for v8 as the code is completely different

swapnil wagh
on 10/14/14, 11:45 AM
nope

On Tue, Oct 14, 2014 at 5:45 PM, swapnil wagh <wagh-aswapnil-gmail-com@mail.odoo.com> wrote:

@Viktor sorry I forgot to mention the version I am looking for odoo 8 your solution work at least for me in v7. You have any idea for v8 as the code is completely different

--
swapnil wagh
Sent by OpenERP S.A. using Odoo about Forum Post False

Viktor Nagy
on 10/15/14, 1:20 AM
Please let me know if you git the solution, thanks in advance

On Wed, Oct 15, 2014 at 10:51 AM, Nagy Viktor <viktor.nagy@toolpart.hu> wrote:
nope

On Tue, Oct 14, 2014 at 5:45 PM, swapnil wagh <wagh-aswapnil-gmail-com@mail.odoo.com> wrote:

@Viktor sorry I forgot to mention the version I am looking for odoo 8 your solution work at least for me in v7. You have any idea for v8 as the code is completely different

--
swapnil wagh
Sent by OpenERP S.A. using Odoo about Forum Post False

--
Viktor Nagy
Sent by OpenERP S.A. using Odoo about Forum Post False

swapnil wagh
on 10/15/14, 6:44 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

3 follower(s)

Stats

Asked: 10/10/14, 10:55 AM
Seen: 2064 times
Last updated: 3/16/15, 8:10 AM