ws-bom-robot-app 0.0.12__py3-none-any.whl → 0.0.14__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.
- ws_bom_robot_app/config.py +1 -1
- ws_bom_robot_app/task_manager.py +4 -3
- {ws_bom_robot_app-0.0.12.dist-info → ws_bom_robot_app-0.0.14.dist-info}/METADATA +6 -4
- {ws_bom_robot_app-0.0.12.dist-info → ws_bom_robot_app-0.0.14.dist-info}/RECORD +6 -6
- {ws_bom_robot_app-0.0.12.dist-info → ws_bom_robot_app-0.0.14.dist-info}/WHEEL +0 -0
- {ws_bom_robot_app-0.0.12.dist-info → ws_bom_robot_app-0.0.14.dist-info}/top_level.txt +0 -0
ws_bom_robot_app/config.py
CHANGED
|
@@ -13,7 +13,7 @@ class Settings(BaseSettings):
|
|
|
13
13
|
robot_data_db_folder_out: str = 'out'
|
|
14
14
|
robot_data_db_folder_store: str = 'store'
|
|
15
15
|
robot_data_db_retention_days: float = 60
|
|
16
|
-
|
|
16
|
+
robot_task_max_total_parallelism: int = 2 * (os.cpu_count() or 1)
|
|
17
17
|
robot_task_retention_days: float = 1
|
|
18
18
|
robot_cms_host: str = ''
|
|
19
19
|
robot_cms_auth: str = ''
|
ws_bom_robot_app/task_manager.py
CHANGED
|
@@ -133,7 +133,7 @@ class TaskStatistics(BaseModel):
|
|
|
133
133
|
|
|
134
134
|
#region interface
|
|
135
135
|
class TaskManagerStrategy(ABC):
|
|
136
|
-
def __init__(self, max_concurrent_tasks: int = floor(
|
|
136
|
+
def __init__(self, max_concurrent_tasks: int = floor(config.robot_task_max_total_parallelism / config.runtime_options().number_of_workers)):
|
|
137
137
|
self.max_concurrent_tasks = max_concurrent_tasks
|
|
138
138
|
self.semaphore = asyncio.Semaphore(self.max_concurrent_tasks)
|
|
139
139
|
self.running_tasks = dict[str, TaskEntry]()
|
|
@@ -184,6 +184,8 @@ class TaskManagerStrategy(ABC):
|
|
|
184
184
|
task_entry.status.metadata.end_at = str(datetime.now().isoformat())
|
|
185
185
|
#strategy-specific behavior
|
|
186
186
|
self.update_task_status(task_entry)
|
|
187
|
+
#remove from running tasks
|
|
188
|
+
del self.running_tasks[task_entry.id]
|
|
187
189
|
#notify webhooks
|
|
188
190
|
if headers and headers.x_ws_bom_webhooks:
|
|
189
191
|
asyncio.create_task(
|
|
@@ -203,12 +205,11 @@ class TaskManagerStrategy(ABC):
|
|
|
203
205
|
async def _run_task_with_semaphore(self, task_entry: TaskEntry):
|
|
204
206
|
"""Run a task with semaphore control to limit concurrency."""
|
|
205
207
|
async with self.semaphore:
|
|
206
|
-
self.running_tasks[task_entry.id]=task_entry
|
|
207
208
|
await self._execute_task(task_entry)
|
|
208
|
-
del self.running_tasks[task_entry.id]
|
|
209
209
|
|
|
210
210
|
async def _execute_task(self, task_entry: TaskEntry):
|
|
211
211
|
"""Execute a task and handle its lifecycle."""
|
|
212
|
+
self.running_tasks[task_entry.id]=task_entry
|
|
212
213
|
task_entry.status.metadata.start_at = str(datetime.now().isoformat())
|
|
213
214
|
task_entry.task = asyncio.create_task(task_entry.coroutine)
|
|
214
215
|
task_entry.task.add_done_callback(self.task_done_callback(task_entry, task_entry.headers))
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: ws_bom_robot_app
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.14
|
|
4
4
|
Summary: A FastAPI application serving ws bom/robot/llm platform ai.
|
|
5
5
|
Home-page: https://github.com/websolutespa/bom
|
|
6
6
|
Author: Websolute Spa
|
|
@@ -69,19 +69,21 @@ robot_cms_files_folder=llmKbFile
|
|
|
69
69
|
|
|
70
70
|
```bash
|
|
71
71
|
fastapi dev --port 6001
|
|
72
|
-
#uvicorn --reload --host 0.0.0.0 --port 6001
|
|
72
|
+
#uvicorn main:app --app-dir ./ws_bom_robot_app --reload --host 0.0.0.0 --port 6001
|
|
73
73
|
```
|
|
74
74
|
|
|
75
75
|
- production
|
|
76
76
|
|
|
77
|
-
```bash
|
|
78
|
-
|
|
77
|
+
```bash
|
|
78
|
+
uvicorn main:app --host 0.0.0.0 --port 6001
|
|
79
79
|
```
|
|
80
80
|
|
|
81
81
|
- production with [multipler workers](https://fastapi.tiangolo.com/deployment/server-workers/#multiple-workers)
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
84
|
fastapi run --port 6001 --workers 4
|
|
85
|
+
#uvicorn main:app --host 0.0.0.0 --port 6001 --workers 4
|
|
86
|
+
#gunicorn -w 4 -k uvicorn.workers.UvicornWorker main:app --bind
|
|
85
87
|
```
|
|
86
88
|
|
|
87
89
|
### 🔖 Windows requirements
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
ws_bom_robot_app/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
2
|
ws_bom_robot_app/auth.py,sha256=84nIbmJsMrNs0sxIQGEHbjsjc2P6ZrZZGSn8dkiL6is,895
|
|
3
|
-
ws_bom_robot_app/config.py,sha256=
|
|
3
|
+
ws_bom_robot_app/config.py,sha256=V5ZrX_JnzpsN32hTTezTfOvEZYkIQBy0lxIQ9JFHdFE,3170
|
|
4
4
|
ws_bom_robot_app/cron_manager.py,sha256=0Yt5AMTPGlXZ_M5ck0SKMX8wvzoPsseEezg_s0Q3HKY,9224
|
|
5
5
|
ws_bom_robot_app/main.py,sha256=MIR2WgxX9HwkNSY2JMRRxrLt-ZGs_TfrhX_BbTbigTI,3909
|
|
6
|
-
ws_bom_robot_app/task_manager.py,sha256=
|
|
6
|
+
ws_bom_robot_app/task_manager.py,sha256=Lb79EvdJBY-Ko88OzGqPVbnVYvBJ2I0q9pzet848yBs,15936
|
|
7
7
|
ws_bom_robot_app/util.py,sha256=3aBK-bhsvKJwJeWOHh0c1B1BOyJ_tnUxOa1mJmFKwYQ,2618
|
|
8
8
|
ws_bom_robot_app/llm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
9
|
ws_bom_robot_app/llm/agent_description.py,sha256=SDJYMmwfdMxEK3a_HDEQ19bfNKmwMSFf5hqU0VSCCIE,4705
|
|
@@ -39,7 +39,7 @@ ws_bom_robot_app/llm/vector_store/integration/sitemap.py,sha256=nPbIywp-ZwWbWStv
|
|
|
39
39
|
ws_bom_robot_app/llm/vector_store/loader/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
40
40
|
ws_bom_robot_app/llm/vector_store/loader/base.py,sha256=dhZ7F4EJmuYa2TBMggWVpQe4_NmS2wi312lHnNm5Jm0,4571
|
|
41
41
|
ws_bom_robot_app/llm/vector_store/loader/json_loader.py,sha256=qo9ejRZyKv_k6jnGgXnu1W5uqsMMtgqK_uvPpZQ0p74,833
|
|
42
|
-
ws_bom_robot_app-0.0.
|
|
43
|
-
ws_bom_robot_app-0.0.
|
|
44
|
-
ws_bom_robot_app-0.0.
|
|
45
|
-
ws_bom_robot_app-0.0.
|
|
42
|
+
ws_bom_robot_app-0.0.14.dist-info/METADATA,sha256=XhRlOchK5gvuLSgTvyqIAK13PqvmxEB7puJGQE7YoI8,5859
|
|
43
|
+
ws_bom_robot_app-0.0.14.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
|
44
|
+
ws_bom_robot_app-0.0.14.dist-info/top_level.txt,sha256=Yl0akyHVbynsBX_N7wx3H3ZTkcMLjYyLJs5zBMDAKcM,17
|
|
45
|
+
ws_bom_robot_app-0.0.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|