'load tasks from database'

def _load_tasks(self, project):

    task_queue = project.task_queue
    for task in self.taskdb.load_tasks(self.taskdb.ACTIVE, project.name, self.scheduler_task_fields):
        taskid = task['taskid']
        _schedule = task.get('schedule', self.default_schedule)
        priority = _schedule.get('priority', self.default_schedule['priority'])
        exetime = _schedule.get('exetime', self.default_schedule['exetime'])
        task_queue.put(taskid, priority, exetime)
    project.task_loaded = True
    logger.debug('project:    %s    loaded    %d    tasks.', project.name, len(task_queue))
    if (project not in self._cnt['all']):
        self._update_project_cnt(project.name)
    self._cnt['all'].value((project.name, 'pending'), len(project.task_queue))
