Exemple #1
0
 def update_outer_link(self, link_id, **kwargs):
     if 'mod_time' not in kwargs:
         kwargs['mod_time'] = self.now()
     ret = yield db_helper.update_table_values(self._get_inst(),
                                               self._executor, link_id,
                                               self.link_tab, **kwargs)
     raise gen.Return(ret)
Exemple #2
0
    def complete_job(self,
                     job_id,
                     complete_status=type_define.STATUS_JOB_COMPLETED):
        yield db_helper.update_table_values(self._get_inst(),
                                            self._executor,
                                            job_id,
                                            self.record_tab,
                                            status=complete_status,
                                            mod_time=self.now())
        if complete_status == type_define.STATUS_JOB_CANCEL:
            yield self.delete_job_mark(job_id)
        else:
            yield self.update_job_all_mark(
                job_id, type_define.STATUS_JOB_MARK_COMPLETED)

        raise gen.Return(True)
Exemple #3
0
 def set_common_config(self, config_type, key, label):
     sql = 'SELECT * FROM %s WHERE type=%s AND key_id=%s' % (
         self.config_tab, config_type, key)
     exist = yield self._executor.async_select(self._get_inst(True), sql)
     if exist:
         yield db_helper.update_table_values(self._get_inst(),
                                             self._executor,
                                             exist[0]['id'],
                                             self.config_tab,
                                             label=label)
     else:
         yield db_helper.insert_into_table_return_id(self._get_inst(),
                                                     self._executor,
                                                     self.config_tab,
                                                     type=config_type,
                                                     key_id=key,
                                                     label=label)
     raise gen.Return(True)
Exemple #4
0
 def update_job_mark(self, job_id, uid, status, branch_id=None):
     sql = 'SELECT * FROM %s WHERE uid=%s AND job_id=%s' % (self.mark_tab,
                                                            uid, job_id)
     if branch_id:
         sql += ' AND branch_id=%s' % branch_id
     exist = yield self._executor.async_select(self._get_inst(True), sql)
     if exist:
         ret = yield db_helper.update_table_values(self._get_inst(),
                                                   self._executor,
                                                   exist[0]['id'],
                                                   self.mark_tab,
                                                   status=status)
     else:
         info = {'job_id': job_id, 'uid': uid, 'status': status}
         if branch_id:
             info['branch_id'] = branch_id
         ret = yield db_helper.insert_into_table_return_id(
             self._get_inst(), self._executor, self.mark_tab, **info)
     raise gen.Return(ret)
Exemple #5
0
 def update_protect_question(self, question_id, **kwargs):
     ret = yield db_helper.update_table_values(self._get_inst(), self._executor, question_id, self.question_tab, **kwargs)
     raise gen.Return(ret)
Exemple #6
0
 def update_dept(self, dept_id, **kwargs):
     ret = yield db_helper.update_table_values(self._get_inst(), self._executor, dept_id, self.dept_tab, **kwargs)
     raise gen.Return(ret)
Exemple #7
0
 def update_account(self, uid, **kwargs):
     ret = yield db_helper.update_table_values(self._get_inst(), self._executor, uid, self.account_tab, **kwargs)
     raise gen.Return(ret)
Exemple #8
0
 def update_rule_type(self, type_id, **kwargs):
     ret = yield db_helper.update_table_values(self._get_inst(),
                                               self._executor, type_id,
                                               self.rule_type_tab, **kwargs)
     raise gen.Return(ret)
Exemple #9
0
 def update_job_node(self, node_id, **kwargs):
     ret = yield db_helper.update_table_values(self._get_inst(),
                                               self._executor, node_id,
                                               self.node_tab, **kwargs)
     raise gen.Return(ret)
Exemple #10
0
 def update_job_timer_task(self, task_id, **kwargs):
     ret = yield db_helper.update_table_values(self._get_inst(),
                                               self._executor, task_id,
                                               self.timer_task_tab,
                                               **kwargs)
     raise gen.Return(ret)
Exemple #11
0
 def update_admin_job(self, job_id, **kwargs):
     ret = yield db_helper.update_table_values(self._get_inst(),
                                               self._executor, job_id,
                                               self.admin_job_tab, **kwargs)
     raise gen.Return(ret)
Exemple #12
0
 def update_job_auto_path(self, path_id, **kwargs):
     ret = yield db_helper.update_table_values(self._get_inst(),
                                               self._executor, path_id,
                                               self.auto_path_tab, **kwargs)
     raise gen.Return(ret)