vantiqservicesdk 0.4.1__tar.gz → 0.4.2__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.
- {vantiqservicesdk-0.4.1/src/main/python/vantiqservicesdk.egg-info → vantiqservicesdk-0.4.2}/PKG-INFO +1 -1
- {vantiqservicesdk-0.4.1 → vantiqservicesdk-0.4.2}/pyproject.toml +1 -1
- {vantiqservicesdk-0.4.1 → vantiqservicesdk-0.4.2/src/main/python/vantiqservicesdk.egg-info}/PKG-INFO +1 -1
- {vantiqservicesdk-0.4.1 → vantiqservicesdk-0.4.2}/src/main/python/vantiqservicesdk.py +7 -10
- {vantiqservicesdk-0.4.1 → vantiqservicesdk-0.4.2}/LICENSE +0 -0
- {vantiqservicesdk-0.4.1 → vantiqservicesdk-0.4.2}/README.md +0 -0
- {vantiqservicesdk-0.4.1 → vantiqservicesdk-0.4.2}/setup.cfg +0 -0
- {vantiqservicesdk-0.4.1 → vantiqservicesdk-0.4.2}/src/main/python/vantiqservicesdk.egg-info/SOURCES.txt +0 -0
- {vantiqservicesdk-0.4.1 → vantiqservicesdk-0.4.2}/src/main/python/vantiqservicesdk.egg-info/dependency_links.txt +0 -0
- {vantiqservicesdk-0.4.1 → vantiqservicesdk-0.4.2}/src/main/python/vantiqservicesdk.egg-info/requires.txt +0 -0
- {vantiqservicesdk-0.4.1 → vantiqservicesdk-0.4.2}/src/main/python/vantiqservicesdk.egg-info/top_level.txt +0 -0
|
@@ -10,7 +10,7 @@ from contextlib import asynccontextmanager
|
|
|
10
10
|
from enum import Enum
|
|
11
11
|
from os.path import exists
|
|
12
12
|
from threading import Thread
|
|
13
|
-
from typing import Union, Any, Set, TypeVar, List, Callable, Iterable
|
|
13
|
+
from typing import Union, Any, Set, TypeVar, List, Callable, Iterable
|
|
14
14
|
|
|
15
15
|
import yaml
|
|
16
16
|
from fastapi import FastAPI, APIRouter, WebSocket, WebSocketDisconnect
|
|
@@ -73,7 +73,7 @@ class BaseVantiqServiceConnector:
|
|
|
73
73
|
cur_class = self.__class__
|
|
74
74
|
self._logger = logging.getLogger(f"{cur_class.__module__}.{cur_class.__name__}")
|
|
75
75
|
|
|
76
|
-
# noinspection PyUnusedLocal
|
|
76
|
+
# noinspection PyUnusedLocal
|
|
77
77
|
@asynccontextmanager
|
|
78
78
|
async def __lifespan(self, app):
|
|
79
79
|
await self._startup()
|
|
@@ -98,8 +98,6 @@ class BaseVantiqServiceConnector:
|
|
|
98
98
|
async with self._config_set:
|
|
99
99
|
if self._client_config is None:
|
|
100
100
|
await self._config_set.wait()
|
|
101
|
-
if self._client_config is None:
|
|
102
|
-
raise RuntimeError('Client config not set')
|
|
103
101
|
return self._client_config
|
|
104
102
|
|
|
105
103
|
async def _set_client_config(self, config: dict) -> bool:
|
|
@@ -182,8 +180,7 @@ class BaseVantiqServiceConnector:
|
|
|
182
180
|
task.add_done_callback(__complete_request)
|
|
183
181
|
|
|
184
182
|
except WebSocketDisconnect:
|
|
185
|
-
|
|
186
|
-
await self._clear_client_config()
|
|
183
|
+
pass
|
|
187
184
|
|
|
188
185
|
finally:
|
|
189
186
|
# Cancel all active requests
|
|
@@ -195,11 +192,11 @@ class BaseVantiqServiceConnector:
|
|
|
195
192
|
# Get the procedure name and parameters
|
|
196
193
|
self._logger.debug('Request was: %s', request)
|
|
197
194
|
procedure_name: str = request.get("procName", "unknown")
|
|
198
|
-
params = request.get("params"
|
|
195
|
+
params = request.get("params")
|
|
199
196
|
|
|
200
197
|
# In the future, it should be set by an explicit value isSystemRequest. For compatibility reasons, we
|
|
201
198
|
# must accept appending "__system" to the requestId as equivalent
|
|
202
|
-
is_system_request = request.get("isSystemRequest", False) or request.get("requestId"
|
|
199
|
+
is_system_request = request.get("isSystemRequest", False) or request.get("requestId").endswith("__system")
|
|
203
200
|
|
|
204
201
|
# Invoke the procedure and store the result
|
|
205
202
|
request_timer = self.__get_resource_metric(self._resources_executions, procedure_name)
|
|
@@ -259,7 +256,7 @@ class BaseVantiqServiceConnector:
|
|
|
259
256
|
# Send the response
|
|
260
257
|
await websocket.send({"type": "websocket.send", "bytes": encoded_response})
|
|
261
258
|
|
|
262
|
-
def _handle_exception(self, e: Exception, request: dict, response:
|
|
259
|
+
def _handle_exception(self, e: Exception, request: dict, response: dict) -> bytes:
|
|
263
260
|
# Log and record error
|
|
264
261
|
procedure_name = request.get("procName", "unknown")
|
|
265
262
|
self._logger.debug(f"Error invoking procedure {procedure_name}", exc_info=e)
|
|
@@ -376,7 +373,7 @@ class LoggerConfig:
|
|
|
376
373
|
"""
|
|
377
374
|
DEFAULT_MONITORING_INTERVAL = 2 * 60
|
|
378
375
|
|
|
379
|
-
def __init__(self, config_files:
|
|
376
|
+
def __init__(self, config_files: List[str] = None, monitor_interval: int = None):
|
|
380
377
|
self._logger = logging.getLogger(__name__)
|
|
381
378
|
self._config_files = config_files or []
|
|
382
379
|
self._config_files.append('logger.yaml')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|