正在显示
2 个修改的文件
包含
12 行增加
和
5 行删除
| ... | ... | @@ -61,13 +61,19 @@ def pull_metric(): |
| 61 | 61 | # 获取数据并汇聚为1min的数据入库 |
| 62 | 62 | # 结束 |
| 63 | 63 | except Exception as e: |
| 64 | + sys_session.rollback() | |
| 64 | 65 | StructurePrint().print(e.__str__()+":" + traceback.format_exc(), "error") |
| 65 | 66 | finally: |
| 66 | - sys_session.rollback() | |
| 67 | 67 | if sys_session: |
| 68 | - sys_session.close() | |
| 68 | + try: | |
| 69 | + sys_session.close() | |
| 70 | + except Exception as e: | |
| 71 | + StructurePrint().print(e.__str__()+":" + traceback.format_exc(), "error") | |
| 69 | 72 | if sys_ds: |
| 70 | - sys_ds.Destroy() | |
| 73 | + try: | |
| 74 | + sys_ds.Destroy() | |
| 75 | + except Exception as e: | |
| 76 | + StructurePrint().print(e.__str__()+":" + traceback.format_exc(), "error") | |
| 71 | 77 | |
| 72 | 78 | |
| 73 | 79 | def start_schedule(): |
| ... | ... | @@ -77,7 +83,8 @@ def start_schedule(): |
| 77 | 83 | schedule.every(1).minutes.do(pull_metric) |
| 78 | 84 | stop_run_continuously = run_continuously() |
| 79 | 85 | except Exception as e: |
| 80 | - StructurePrint().print(e.__str__()+":" + traceback.format_exc(), "error") | |
| 86 | + StructurePrint().print("start_schedule:"+e.__str__() + | |
| 87 | + ":" + traceback.format_exc(), "error") | |
| 81 | 88 | |
| 82 | 89 | # Do some other things... |
| 83 | 90 | # # Stop the background thread | ... | ... |
请
注册
或
登录
后发表评论