2 # -*- coding: utf-8 -*-
3 ##############################################################################
5 # OpenERP, Open Source Management Solution
6 # Copyright (C) 2004-2011 OpenERP SA (<http://www.openerp.com>)
8 # This program is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU Affero General Public License as
10 # published by the Free Software Foundation, either version 3 of the
11 # License, or (at your option) any later version.
13 # This program is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU Affero General Public License for more details.
18 # You should have received a copy of the GNU Affero General Public License
19 # along with this program. If not, see <http://www.gnu.org/licenses/>.
21 ##############################################################################
23 """ Cron jobs scheduling
25 Cron jobs are defined in the ir_cron table/model. This module deals with all
26 cron jobs, for all databases of a single OpenERP server instance.
28 It defines a single master thread that will spawn (a bounded number of)
29 threads to process individual cron jobs.
31 The thread runs forever, checking every 60 seconds for new
32 'database wake-ups'. It maintains a heapq of database wake-ups. At each
33 wake-up, it will call ir_cron._run_jobs_multithread() for the given database. _run_jobs_multithread
34 will check the jobs defined in the ir_cron table and spawn accordingly threads
37 This module's behavior depends on the following configuration variable:
38 openerp.conf.max_cron_threads.
50 _logger = logging.getLogger(__name__)
52 # TODO: perhaps in the future we could consider a flag on ir.cron jobs
53 # that would cause database wake-up even if the database has not been
54 # loaded yet or was already unloaded (e.g. 'force_db_wakeup' or something)
57 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: