def usr_add(self, p_data): """ 增加执行目录时 p_test=false, 为 true 时生成结果文件 :param p_data: {id, run_def_type, result} :return: :rtype: bool """ _type = p_data["run_def_type"] _id = p_data["id"] _result = p_data["result"] if "result" in p_data else False # 生成目录名称 folder_root = "%s/%s_%s" % (self.__home, _type, _id) # 建目录 if not os.path.exists(folder_root): os.mkdir(folder_root) # 建执行结果文件 if _result: from OrcLib.LibCommon import gen_date_str res_folder = "%s/%s" % (folder_root, gen_date_str()) res_file = "%s/default.res" % res_folder if not os.path.exists(res_folder): os.mkdir(res_folder) self.__list.search_list(_type, _id) self.__list.save_list(res_file) return _id
def _create_no(self): """ Create a no, like step_no :return: """ _no = gen_date_str() t_item = self.__session.query(TabStepDef).filter(TabStepDef.step_no == _no).first() if t_item is not None: return self._create_no() else: return _no
def _create_no(self): """ Create a no, like batch_no :return: """ _no = gen_date_str() t_item = self.__session.query(WebPageDet).filter(WebPageDet.batch_no == _no).first() if t_item is not None: return self._create_no() else: return _no
def __create_no(self): """ Create a no :return: """ base_no = gen_date_str() for _index in range(100): if 10 < _index: batch_no = "%s%s" % (base_no, _index + 1) else: batch_no = "%s0%s" % (base_no, _index + 1) _item = self.__session.query(TabBatchDef).filter( TabBatchDef.batch_no == batch_no).first() if _item is None: return batch_no return 1