dotask 0.3.2__tar.gz → 0.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,16 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dotask
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: 发布订阅注解方式
5
5
  Home-page: https://gitee.com/d-yz/task-manager
6
6
  Author: dyz
7
7
  Author-email: 837701454@qq.com
8
8
  Keywords: 发布订阅,注解,dotask
9
9
  Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.8
11
- Classifier: Programming Language :: Python :: 3.9
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
14
11
  Classifier: License :: OSI Approved :: Apache Software License
15
12
  Classifier: Operating System :: OS Independent
16
13
  Description-Content-Type: text/markdown
@@ -1,7 +1,10 @@
1
+ import sys
1
2
  import threading
2
3
  import functools
3
4
  import time
4
5
  import queue
6
+ import traceback
7
+ import os
5
8
  from queue import Queue
6
9
  from typing import Optional, Callable, Any, List, Set, Dict
7
10
  from dotask.util import logger
@@ -152,7 +155,7 @@ def task(
152
155
  # logger.info(f"消费后发布[{t}]:{consume_result}")
153
156
 
154
157
  except Exception as e:
155
- logger.error(f"Consumer [{thread_name}] failed to process message: {e}")
158
+ logger.error(f"Consumer [{thread_name}] failed to process message: {e}, Approximate exception location: File {get_business_error_line()}")
156
159
  topic_manager.unfinished_tasks.put({"unfinished_data":data,"occurred":subscribe,"error":e})
157
160
 
158
161
  # 开始消费
@@ -170,4 +173,13 @@ def task(
170
173
  raise ValueError(f"Unsupported role: {role}, available options: producer/consumer")
171
174
 
172
175
  wrapper_result = wrapper()
173
- return wrapper_result
176
+ return wrapper_result
177
+
178
+
179
+ def get_business_error_line():
180
+ exc_type, exc_value, exc_tb = sys.exc_info()
181
+ tb_frames = traceback.extract_tb(exc_tb)
182
+ business_frame = tb_frames[-1]
183
+ business_file, business_line = business_frame[0], business_frame[1]
184
+ business_file_abs = os.path.abspath(business_file)
185
+ return f"{business_file_abs}:{business_line}"
@@ -8,7 +8,8 @@ LOG_COLORS = {
8
8
  logging.ERROR: "\033[31m",
9
9
  logging.CRITICAL: "\033[35m"
10
10
  }
11
- WHITE_COLOR = "\033[38;5;252m"
11
+ BLUE_COLOR = "\033[38;5;67m"
12
+ # WHITE_COLOR = "\033[38;5;252m"
12
13
  RESET_COLOR = "\033[0m" # 重置颜色,避免影响后续输出
13
14
 
14
15
 
@@ -18,7 +19,7 @@ class ColoredFormatter(logging.Formatter):
18
19
  # 获取当前日志级别对应的颜色
19
20
  color = LOG_COLORS.get(record.levelno, RESET_COLOR)
20
21
 
21
- record.msg = f"{WHITE_COLOR}{record.msg}{RESET_COLOR}"
22
+ record.msg = f"{BLUE_COLOR}{record.msg}{RESET_COLOR}"
22
23
  record.levelname = f"{color}{record.levelname}{RESET_COLOR}"
23
24
  # 调用父类的format方法完成整体格式化
24
25
  return super().format(record)
@@ -36,7 +37,7 @@ def setup_colored_logging():
36
37
 
37
38
  # 创建自定义彩色格式化器
38
39
  formatter = ColoredFormatter(
39
- f"{WHITE_COLOR}%(asctime)s - %(levelname)s - %(message)s",
40
+ f"{BLUE_COLOR}%(asctime)s - %(levelname)s - %(message)s",
40
41
  datefmt="%Y-%m-%d %H:%M:%S"
41
42
  )
42
43
  console_handler.setFormatter(formatter)
@@ -1,16 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dotask
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: 发布订阅注解方式
5
5
  Home-page: https://gitee.com/d-yz/task-manager
6
6
  Author: dyz
7
7
  Author-email: 837701454@qq.com
8
8
  Keywords: 发布订阅,注解,dotask
9
9
  Classifier: Programming Language :: Python :: 3
10
- Classifier: Programming Language :: Python :: 3.8
11
- Classifier: Programming Language :: Python :: 3.9
12
- Classifier: Programming Language :: Python :: 3.10
13
- Classifier: Programming Language :: Python :: 3.11
10
+ Classifier: Programming Language :: Python :: 3.12
14
11
  Classifier: License :: OSI Approved :: Apache Software License
15
12
  Classifier: Operating System :: OS Independent
16
13
  Description-Content-Type: text/markdown
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = dotask
3
- version = 0.3.2
3
+ version = 0.3.4
4
4
  author = dyz
5
5
  author_email = 837701454@qq.com
6
6
  description = 发布订阅注解方式
@@ -9,14 +9,11 @@ long_description_content_type = text/markdown
9
9
  url = https://gitee.com/d-yz/task-manager
10
10
  classifiers =
11
11
  Programming Language :: Python :: 3
12
- Programming Language :: Python :: 3.8
13
- Programming Language :: Python :: 3.9
14
- Programming Language :: Python :: 3.10
15
- Programming Language :: Python :: 3.11
12
+ Programming Language :: Python :: 3.12
16
13
  License :: OSI Approved :: Apache Software License
17
14
  Operating System :: OS Independent
18
15
  keywords = 发布订阅,注解,dotask
19
- python_requires = >=3.8
16
+ python_requires = >=3.12
20
17
 
21
18
  [options]
22
19
  packages = dotask
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes