Code Monkey home page Code Monkey logo

oorq's Introduction

RQ for OpenObject

Using python-rq for OpenObject tasks.

API compatibility

  • For OpenERP v5 the module versions are v1.X.X or below and branch is api_v5 Build Status
  • For OpenERP v6 the module versions are v2.X.X and branch is api_v6 Build Status
  • For OpenERP v7 the module versions are v3.X.X and branch is api_v7 Build Status

Example to do a async write.

Add the decorator to the function

from osv import osv
from oorq.decorators import job

class ResPartner(osv.osv):
    _name = 'res.partner'
    _inherit = 'res.partner'

    @job(async=True)
    def write(self, cursor, user, ids, vals, context=None):
        res = super(ResPartner,
                    self).write(cursor, user, ids, vals, context)
        return res

ResPartner()

Start the worker

$ PYTHONPATH=~/Projects/OpenERP/server/bin:~/Projects/OpenERP/server/bin/addons rq worker

Do fun things :)

oorq's People

Contributors

amatmv avatar davidmunoznovoa avatar eberloso avatar ecarreras avatar francescpuig7 avatar gdalmau avatar guillejb avatar lcbautista avatar mroig avatar polsala avatar sim6 avatar tinogis avatar xevib avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

oorq's Issues

Scheduler

OpenERP cronjobs not always work... It would be very nice if we can use the queue system to do some cronjobs, like celery does.

The idea is make a decorator cron like:

@cron(min, hour, dom, month, dow)
def some_cron_function(self, cursor, uid, context=None):
    pass

Then we need to register cronjob function. Find a way to do it elegantly..

That's all.

Check if SSL connection is currently allowed on autoworker

AUTOWORKER_REDIS_URL is forced with redis:// -> rediss:// for ssl connections?
self.connection = Redis.from_url(self.config['redis_url']) # this is called on autoworker init and if

def setup_redis_connection():
    redis_conn = get_current_connection()
    if not redis_conn:
        if config.get('redis_url', False):
            oorq_log('Connecting to redis using redis_url: %s'
                     % config['redis_url'])
            redis_conn = from_url(config['redis_url'])
        else:
            oorq_log('Connecting to redis using defaults')
            redis_conn = Redis()
        push_connection(redis_conn)
    os.environ['AUTOWORKER_REDIS_URL'] = get_redis_url(redis_conn)
    return redis_conn


def get_redis_url(redis_conn):
    """
    Creates redis url from redis connection
    :param redis_conn:
    :return: url on the form redis://host:port/db
    """
    if not redis_conn:
        return False
    return 'redis://{host}:{port}/{db}'.format(
        **redis_conn.connection_pool.connection_kwargs
    )

Symbolic links like oorq/requirements.txt do not work in windows git repositories

requirements.txt is a symbolic link and that is a problem for windows. It downloads it like a normal text file with this contents:

../requirements.txt

When updating this module or updating all modules pip fails installs to process the file.

Can it be changed to a normal text file? If you hate repeating your self, may be the root file can be the symbolic link to the one inside oorq folder.

[8.0] Is this module suitable for setting up Redis for Caching in Odoo?

@ecarreras ,

I've just come across this module on Github. My apologies for writing a question in the form of a github issue I was just not sure how to contact you.

Regarding this module, would this be suitable for setting up as a caching mechanism in Odoo 8.0? I'm working on implementing a module (product_multi_image - https://github.com/pedrobaeza/product-attribute/tree/8.0-product_images WIP) to store and display multiple product images on the backend (sales >> product), and front-end (website_sale product pages).

Due to the size of the catalog i'll be building I think it may be necessary for me to implement a caching and cache-warming module in order to keep the instances running with decent performance.

I've heard of Redis being used with Odoo in various forum posts, however there is not much information publicly available on the subject.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.