导航

2024年9月11日

摘要: def multi_row(test={}): if not test.get("name"): test["name"] = [] test.get("name").append("script boy") return test def once_row(test={}): """dict(). 阅读全文

posted @ 2024-09-11 23:33 old_dog~ 阅读(3) 评论(0) 推荐(0) 编辑

2024年9月10日

摘要: 背景 基于k8s 部署crontab任务,同时支持热加载crontab配置,避免更新crontab配置而导致的更新代码与更新docker 镜像。 执行 公司环境,直接在web页面操作的,删除部分敏感信息且不展示操作命令 1、增加configmap: metadata: name: cron-task 阅读全文

posted @ 2024-09-10 23:22 old_dog~ 阅读(11) 评论(0) 推荐(0) 编辑

2022年8月26日

摘要: # encoding: utf-8import loggingERROR_NOT_FOUNDED_FILE = "error_not_founded_file"class GeneralError(Exception): def __init__(self, value, description): 阅读全文

posted @ 2022-08-26 18:05 old_dog~ 阅读(79) 评论(0) 推荐(0) 编辑

2022年7月28日

摘要: @xxx_blueprint.route("/file", methods=["GET"]) def group_trend(): def generate(): data = StringIO() w = csv.writer(data) titles = ["v1", "v2", "v3"] t 阅读全文

posted @ 2022-07-28 11:54 old_dog~ 阅读(97) 评论(0) 推荐(0) 编辑

2022年6月20日

摘要: # 实现代码 blueprint_d = dict() dirs = os.listdir(base_dir) # 获取apps路径下所有文件夹列表 for d in dirs: ## 1、遍历模块文件夹 file_path = os.path.join(base_dir, d) # apps/每个 阅读全文

posted @ 2022-06-20 19:17 old_dog~ 阅读(175) 评论(0) 推荐(0) 编辑

摘要: python的推导式包括字典、数据、元组、集合推导式。 实现上,一重推导式介绍比较多,二重或者多重几乎没有。 以字典推导式为例,简单的介绍下实现方式: # @Time : 2022/6/20 17:56 # @Software: PyCharm # 1、一重## 普通方式 tmp_dict = {} 阅读全文

posted @ 2022-06-20 19:10 old_dog~ 阅读(98) 评论(0) 推荐(0) 编辑

2022年2月27日

摘要: 背景: 有这样一段代码,有两种执行方式: crontab定时器、手动执行 #!bin.bash echo $redispasswd 你猜,结果一样不? 1、手动执行 2、crontab定时器 创建定时器 输出日志 答案只有一个: 不一样 原因: crontab创建子进程的时候只会给基本的环境变量,导 阅读全文

posted @ 2022-02-27 13:59 old_dog~ 阅读(115) 评论(0) 推荐(0) 编辑

2022年2月12日

摘要: 背景: pg更新后psql 指令必须携带 -h指令,导致很多直接使用“psql”的shell脚本无法连接。 方案: 1、挨个更新调用psql的地方: 显然太多了,改不过来。 2、新建文件:/usr/bin/psql, 记得修改可执行权限哦: chmod 755 /usr/bin/psql #!/bi 阅读全文

posted @ 2022-02-12 13:31 old_dog~ 阅读(106) 评论(0) 推荐(0) 编辑

2021年11月11日

摘要: 出于项目需求,需要读取某个进程的最新日志,而这个进程刚好是supervisor管控。 很自然地我就想到了,根据日志的编辑时间排序,获取最新的日志文件。 然而,发现了奇怪的一幕: 发现什么没有? webcgj-0.std这个最初的日志编辑时间居然比webcgj-0.std.1的编辑时间完。不应该是we 阅读全文

posted @ 2021-11-11 02:05 old_dog~ 阅读(213) 评论(0) 推荐(0) 编辑

2021年10月11日

摘要: python2安转包时提示: pip install xxx时,提示 Microsoft Visual C++ 9.0 is required 下载并安装: 链接:https://pan.baidu.com/s/1PgGtOv1I7zQU4NYNrabldw 提取码:j13j 阅读全文

posted @ 2021-10-11 09:27 old_dog~ 阅读(91) 评论(0) 推荐(0) 编辑