dotask 0.3.1__tar.gz → 0.3.3__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,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dotask
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: 发布订阅注解方式
5
5
  Home-page: https://gitee.com/d-yz/task-manager
6
6
  Author: dyz
@@ -0,0 +1,4 @@
1
+ from .task import task
2
+ from .task import topic_manager
3
+
4
+ __all__ = ["task", "topic_manager"]
@@ -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}"
@@ -0,0 +1,6 @@
1
+ from .logger import logger
2
+ from .shell import Shell
3
+ from .limit import TokenBucket
4
+ from .timer import Timer
5
+
6
+ __all__ = ["logger", "TokenBucket", "Shell", "Timer"]
@@ -2,7 +2,7 @@ import threading
2
2
  from dotask.util import logger
3
3
 
4
4
  class Timer:
5
- def __init__(self,interval:int,task):
5
+ def __init__(self,interval:float,task):
6
6
  self.interval = interval
7
7
  self.task = task
8
8
  # 存储定时对象
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dotask
3
- Version: 0.3.1
3
+ Version: 0.3.3
4
4
  Summary: 发布订阅注解方式
5
5
  Home-page: https://gitee.com/d-yz/task-manager
6
6
  Author: dyz
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = dotask
3
- version = 0.3.1
3
+ version = 0.3.3
4
4
  author = dyz
5
5
  author_email = 837701454@qq.com
6
6
  description = 发布订阅注解方式
@@ -1,2 +0,0 @@
1
- from .task import task,topic_manager
2
-
@@ -1,4 +0,0 @@
1
- from .logger import logger
2
- from .shell import Shell
3
- from .limit import TokenBucket
4
- from .timer import Timer
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes