sunholo 0.136.3__py3-none-any.whl → 0.138.0__py3-none-any.whl

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.
@@ -8,11 +8,12 @@ from tenacity import AsyncRetrying, retry_if_exception_type, wait_random_exponen
8
8
  log = setup_logging("sunholo_AsyncTaskRunner")
9
9
 
10
10
  class AsyncTaskRunner:
11
- def __init__(self, retry_enabled=False, retry_kwargs=None, timeout=120):
11
+ def __init__(self, retry_enabled:bool=False, retry_kwargs:dict=None, timeout:int=120, max_concurrency:int=20):
12
12
  self.tasks = []
13
13
  self.retry_enabled = retry_enabled
14
14
  self.retry_kwargs = retry_kwargs or {}
15
15
  self.timeout = timeout
16
+ self.semaphore = asyncio.Semaphore(max_concurrency)
16
17
 
17
18
  def add_task(self, func: Callable[..., Any], *args: Any, **kwargs: Any):
18
19
  """
@@ -136,10 +137,11 @@ class AsyncTaskRunner:
136
137
  Returns:
137
138
  Any: The result of the task.
138
139
  """
139
- if asyncio.iscoroutinefunction(func):
140
- return await func(*args, **kwargs)
141
- else:
142
- return await asyncio.to_thread(func, *args, **kwargs)
140
+ async with self.semaphore: # Use semaphore to limit concurrent executions
141
+ if asyncio.iscoroutinefunction(func):
142
+ return await func(*args, **kwargs)
143
+ else:
144
+ return await asyncio.to_thread(func, *args, **kwargs)
143
145
 
144
146
  async def _send_heartbeat(self, func_name: str, completion_event: asyncio.Event, queue: asyncio.Queue, interval: int = 2):
145
147
  """
sunholo/utils/config.py CHANGED
@@ -104,7 +104,7 @@ def reload_config_file(config_file, filename):
104
104
  Helper function to load a config file and update the cache.
105
105
  """
106
106
  from ..custom_logging import log
107
- with open(config_file, 'r') as file:
107
+ with open(config_file, 'r', encoding='utf-8') as file:
108
108
  if filename.endswith('.json'):
109
109
  config = json.load(file)
110
110
  else:
@@ -123,7 +123,7 @@ class ConfigManager:
123
123
  from ..custom_logging import log
124
124
  from ruamel.yaml import YAML
125
125
 
126
- with open(config_file, 'r') as file:
126
+ with open(config_file, 'r', encoding='utf-8') as file:
127
127
  if filename.endswith('.json'):
128
128
  config = json.load(file)
129
129
  else:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sunholo
3
- Version: 0.136.3
3
+ Version: 0.138.0
4
4
  Summary: AI DevOps - a package to help deploy GenAI to the Cloud.
5
5
  Author-email: Holosun ApS <multivac@sunholo.com>
6
6
  License: Apache License, Version 2.0
@@ -96,7 +96,7 @@ sunholo/genai/init.py,sha256=yG8E67TduFCTQPELo83OJuWfjwTnGZsyACospahyEaY,687
96
96
  sunholo/genai/process_funcs_cls.py,sha256=D6eNrc3vtTZzwdkacZNOSfit499N_o0C5AHspyUJiYE,33690
97
97
  sunholo/genai/safety.py,sha256=mkFDO_BeEgiKjQd9o2I4UxB6XI7a9U-oOFjZ8LGRUC4,1238
98
98
  sunholo/invoke/__init__.py,sha256=o1RhwBGOtVK0MIdD55fAIMCkJsxTksi8GD5uoqVKI-8,184
99
- sunholo/invoke/async_class.py,sha256=G8vD2H94fpBc37mSJSQODEKJ67P2mPQEHabtDaLOvxE,8033
99
+ sunholo/invoke/async_class.py,sha256=OmRHaRf_yXNDWftWPpziytXh1TAhMumxnNhN_PGpQFs,8230
100
100
  sunholo/invoke/direct_vac_func.py,sha256=dACx3Zh7uZnuWLIFYiyLoyXUhh5-eUpd2RatDUd9ov8,9753
101
101
  sunholo/invoke/invoke_vac_utils.py,sha256=sJc1edHTHMzMGXjji1N67c3iUaP7BmAL5nj82Qof63M,2053
102
102
  sunholo/langfuse/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -150,8 +150,8 @@ sunholo/tools/web_browser.py,sha256=8Gdf02F4zCOeSnijnfaL6jzk4oaSI0cj48o-esoWzwE,
150
150
  sunholo/utils/__init__.py,sha256=Hv02T5L2zYWvCso5hzzwm8FQogwBq0OgtUbN_7Quzqc,89
151
151
  sunholo/utils/api_key.py,sha256=Ct4bIAQZxzPEw14hP586LpVxBAVi_W9Serpy0BK-7KI,244
152
152
  sunholo/utils/big_context.py,sha256=HuP9_r_Nx1jvZHxjMEihgoZAXmnCh80zzsj1fq3mIOg,6021
153
- sunholo/utils/config.py,sha256=bz0ODJyqnoHQIsk4pmNpVxxq5WvwS0SfOq4cnCjQPJk,9105
154
- sunholo/utils/config_class.py,sha256=zhp71gNZb-t1cbkN2N3zwCAEiX0FSvKaKlpBxosgI4U,9750
153
+ sunholo/utils/config.py,sha256=wZ78bC5s9XuQDtDB0lSDZo_IZ9ROH-VnMJaRM6BN5Lw,9123
154
+ sunholo/utils/config_class.py,sha256=uSRiJLj8t5UgWNxaq8W4KPnzxb4SkUJ1avXecDHuP-E,9768
155
155
  sunholo/utils/config_schema.py,sha256=Wv-ncitzljOhgbDaq9qnFqH5LCuxNv59dTGDWgd1qdk,4189
156
156
  sunholo/utils/gcp.py,sha256=lus1HH8YhFInw6QRKwfvKZq-Lz-2KQg4ips9v1I_3zE,4783
157
157
  sunholo/utils/gcp_project.py,sha256=Fa0IhCX12bZ1ctF_PKN8PNYd7hihEUfb90kilBfUDjg,1411
@@ -168,9 +168,9 @@ sunholo/vertex/init.py,sha256=1OQwcPBKZYBTDPdyU7IM4X4OmiXLdsNV30C-fee2scQ,2875
168
168
  sunholo/vertex/memory_tools.py,sha256=tBZxqVZ4InTmdBvLlOYwoSEWu4-kGquc-gxDwZCC4FA,7667
169
169
  sunholo/vertex/safety.py,sha256=S9PgQT1O_BQAkcqauWncRJaydiP8Q_Jzmu9gxYfy1VA,2482
170
170
  sunholo/vertex/type_dict_to_json.py,sha256=uTzL4o9tJRao4u-gJOFcACgWGkBOtqACmb6ihvCErL8,4694
171
- sunholo-0.136.3.dist-info/licenses/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
172
- sunholo-0.136.3.dist-info/METADATA,sha256=Clc_3rLVQs1OFsuOwNRFZh2trZi_X6k0cgNIZj967f0,10067
173
- sunholo-0.136.3.dist-info/WHEEL,sha256=ooBFpIzZCPdw3uqIQsOo4qqbA4ZRPxHnOH7peeONza0,91
174
- sunholo-0.136.3.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
175
- sunholo-0.136.3.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
176
- sunholo-0.136.3.dist-info/RECORD,,
171
+ sunholo-0.138.0.dist-info/licenses/LICENSE.txt,sha256=SdE3QjnD3GEmqqg9EX3TM9f7WmtOzqS1KJve8rhbYmU,11345
172
+ sunholo-0.138.0.dist-info/METADATA,sha256=kEmRqIP4K23Zy9yzU8d3cAPc3MwlMiflbjdkUAN8CRY,10067
173
+ sunholo-0.138.0.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
174
+ sunholo-0.138.0.dist-info/entry_points.txt,sha256=bZuN5AIHingMPt4Ro1b_T-FnQvZ3teBes-3OyO0asl4,49
175
+ sunholo-0.138.0.dist-info/top_level.txt,sha256=wt5tadn5--5JrZsjJz2LceoUvcrIvxjHJe-RxuudxAk,8
176
+ sunholo-0.138.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.0.1)
2
+ Generator: setuptools (80.3.1)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5