def init_scheduler(self): """Init all jobs related to the engine from db.""" jobs = db_api.job_get_all(self.context, engine_id=self.engine_id) if not jobs: LOG.info(_LI("No job found from db")) return True for job in jobs: if self.bilean_scheduler.is_exist(job.id): continue task_name = "_%s_task" % (job.job_type) task = getattr(self, task_name) self.bilean_task.add_job(task, job.id, job_type=job.job_type, params=job.parameters)
def init_scheduler(self): """Init all jobs related to the engine from db.""" admin_context = bilean_context.get_admin_context() jobs = [] or db_api.job_get_all(admin_context, scheduler_id=self.scheduler_id) for job in jobs: if self._is_exist(job.id): continue LOG.info(_LI("Add job '%(job_id)s' to scheduler '%(id)s'."), {'job_id': job.id, 'id': self.scheduler_id}) self._add_job(job.id, job.job_type, **job.parameters) LOG.info(_LI("Initialise users from keystone.")) users = user_mod.User.init_users(admin_context) # Init daily job for all users if users: for user in users: job_id = self._generate_job_id(user.id, self.DAILY) if self._is_exist(job_id): continue self._add_daily_job(user)