Skip to content
Snippets Groups Projects
Commit 28906dbe authored by Matthias Stefan Bodenbenner's avatar Matthias Stefan Bodenbenner
Browse files

fixed streaming functions

parent 4db5298e
Branches
Tags 9.3.3
No related merge requests found
Pipeline #373291 passed
[![Build](https://git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/lava/unified-device-interface/python/badges/master/pipeline.svg)](https://git-ce.rwth-aachen.de/wzl-mq-ms/forschung-lehre/lava/unified-device-interface/python/commits/master)
# Python Unified Device Interface
Current stable version: 9.3.2
Current stable version: 9.3.3
## Installation
1. Install the WZL-UDI package via pip
......@@ -58,6 +58,9 @@ Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation)
## Recent changes
**9.3.3** - 2024-03-15
- fixed streaming functions
**9.3.2** - 2024-03-14
- fixed semantic name resolution (again)
......
......@@ -4,7 +4,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
long_description = fh.read()
setup(name='wzl-udi',
version='9.3.2',
version='9.3.3',
url='https://git-ce.rwth-aachen.de/wzl-mq-public/soil/python',
project_urls={
"Bug Tracker": "https://git-ce.rwth-aachen.de/wzl-mq-public/soil/python/-/issues",
......
......@@ -273,9 +273,10 @@ class HTTPServer(object):
try:
async for item in item.invoke_generator(data["arguments"], legacy_mode=self._legacy_mode):
self._publisher.publish('/'.join(uuids), json.dumps(item))
except RuntimeError as e:
if not isinstance(e.__cause__, StopAsyncIteration):
raise e
response = {}
except StopAsyncIteration:
pass
else:
response = await item.invoke(data["arguments"], legacy_mode=self._legacy_mode)
status = 200
......
......@@ -117,7 +117,6 @@ class Function(Element):
return returns
async def invoke_generator(self, arguments: List[Variable], legacy_mode: bool = False) -> Dict[str, List[Dict[str, Any]]]:
returns = {"returns": []}
args = {}
if self._implementation is None:
raise NotImplementedException(self._uuid, self._name)
......@@ -146,7 +145,7 @@ class Function(Element):
except StopIteration as e:
raise e
except StopIteration or StopAsyncIteration as e:
raise e
raise StopAsyncIteration()
except Exception as e:
raise DeviceException(str(e), predecessor=e)
......
......@@ -9,10 +9,12 @@ from wzl.mqtt.exceptions import ClientNotFoundError
from .component import Component
from .event import Event
from . import variable
from .variable import Variable
from .semantics import Namespaces
from ..utils import root_logger
from ..utils import serialize
from ..utils.resources import ResourceType
logger = root_logger.get(__name__)
......@@ -105,7 +107,7 @@ class Job(ABC):
try:
uuids = self.topic.split('/')
element = model.__getitem__(uuids)
return element.semantic_name, element.serialize_semantics('data')
return element.semantic_name, element.serialize_semantics(ResourceType.data)
except Exception:
return "", rdflib.Graph()
......@@ -114,7 +116,7 @@ class Job(ABC):
data = self._retrieve_metadata(model)
data['uuid'] = self.topic
data['value'] = self.value
data['timestamp'] = figure.serialize_time(datetime.datetime.now())
data['timestamp'] = variable.serialize_time(datetime.datetime.now())
return data
except Exception as e:
raise JobError()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment