This question has been flagged
2 Replies
3924 Views

Is there a function (or variable) that returns the worker variable as set by the config file or startup option? Ideally something that would be XML-RPC compatible.

Avatar
Discard

worker variable ? Your question is not clear. Please explain waht you want to get.

Author

There is a worker configuration directive (or runtime option) to allow OpenERP/Odoo to run in multi-threaded mode. I would like to get the value of this setting. I have an application that creates a huge bunch of sales order line via XMLRPC and would like to process them in parallel, but I would like the application to know how many threads it could request at once.

Author Best Answer

After much searching in the code I didn't find anything that would return the required value. I created a simple one-liner in web_services.py to achieve the wanted behavior.

Here is what was done:

-Added 'get_workers' to the if in the dispatch method from the common class.

-Added the exp_get_workers defined as such:

def exp_get_workers(self):
        return tools.config.get('workers', 1)

Avatar
Discard
Best Answer

Counting records is not as easy as it seems to be. You cancreate easliy report for it. If you want XML-RCP you need to create it by hand.

 

Marek Mosiewicz

http://consultantodoo.com

Avatar
Discard
Author

What I need is the configured thread concurrency as set by the workers configuration variable (or startup variable). I am building a XML-RPC library for .NET integration and would like to be able to process a few things asynchronously (As this is meant to create hundreds of recordings + a few hundred searches or gets) at the press of a button and knowing the maximum thread concurrency is key for an efficient system.

I think you can use WSGI to control number of workers. Unfortunetly they are processes not threads, as threads suffer from single lock in Python


2014-08-28 19:28 GMT+02:00 Michael St-Georges <m.stgeorges@mail.odoo.com>:

What I need is the configured thread concurrency as set by the workers configuration variable (or startup variable). I am building a XML-RPC library for .NET integration and would like to be able to process a few things asynchronously (As this is meant to create hundreds of recordings + a few hundred searches or gets) at the press of a button and knowing the maximum thread concurrency is key for an efficient system.

--
Michael St-Georges Sent by Odoo Inc. using Odoo. about Forum Post False