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

changed initalization procedure, made it much more easy

parent 71609a1c
No related branches found
No related tags found
No related merge requests found
Pipeline #245518 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) [![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 # Python Unified Device Interface
Current stable version: 8.0.0 Current stable version: 8.0.1
Stable legacy version: 5.2.7 **SHOULD NOT BE USED ANYMORE!** Stable legacy version: 5.2.7 **SHOULD NOT BE USED ANYMORE!**
## Installation ## Installation
...@@ -65,6 +65,10 @@ Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) ...@@ -65,6 +65,10 @@ Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation)
## Recent changes ## Recent changes
**8.0.1** - 2023-03-14
- bug fixes
- fixed DELETE endpoint for dynamic components
**8.0.0** - 2023-03-11 **8.0.0** - 2023-03-11
- changed initialization routine - changed initialization routine
- the mapping via a dictionary of encapsulated sensor logic to HTTP-Endpoints is not needed anymore - the mapping via a dictionary of encapsulated sensor logic to HTTP-Endpoints is not needed anymore
......
from setuptools import setup, find_packages from setuptools import setup, find_packages
setup(name='wzl-udi', setup(name='wzl-udi',
version='8.0.0', version='8.0.1',
url='https://git-ce.rwth-aachen.de/wzl-mq-public/soil/python', url='https://git-ce.rwth-aachen.de/wzl-mq-public/soil/python',
author='Matthias Bodenbenner', author='Matthias Bodenbenner',
author_email='m.bodenbenner@wzl.mq.rwth-aachen.de', author_email='m.bodenbenner@wzl.mq.rwth-aachen.de',
......
...@@ -192,9 +192,8 @@ class HTTPServer(object): ...@@ -192,9 +192,8 @@ class HTTPServer(object):
return self.prepare_response(response, item, status=status) return self.prepare_response(response, item, status=status)
async def delete(self, request): async def delete(self, request):
logger.info("PUT Request from {}".format(request.url)) logger.info("DELETE Request from {}".format(request.url))
logger.debug('Request: {}'.format(request)) logger.debug('Request: {}'.format(request))
data = await request.json()
uuids = HTTPServer.parse_uuids(request) uuids = HTTPServer.parse_uuids(request)
try: try:
...@@ -208,9 +207,7 @@ class HTTPServer(object): ...@@ -208,9 +207,7 @@ class HTTPServer(object):
if not isinstance(item, Component): if not isinstance(item, Component):
return self.prepare_response({}, None, status=405) return self.prepare_response({}, None, status=405)
try: try:
component_name = await self.loop.run_in_executor(None, component_name = await self.loop.run_in_executor(None, functools.partial(item.remove, uuids[-1]))
functools.partial(item.remove, uuids[-1], *data['args'],
**data['kwargs']))
if self._scheduler is not None: if self._scheduler is not None:
self._scheduler.remove_jobs('/'.join(uuids)) self._scheduler.remove_jobs('/'.join(uuids))
......
...@@ -342,11 +342,11 @@ class Component(Element): ...@@ -342,11 +342,11 @@ class Component(Element):
else: else:
raise UserException('UUID {} is not of the UUID of an component.'.format(uuid)) raise UserException('UUID {} is not of the UUID of an component.'.format(uuid))
def remove(self, uuid: str, *args, **kwargs) -> str: def remove(self, uuid: str) -> str:
for o in self._components: for o in self._components:
if o.uuid == uuid: if o.uuid == uuid:
try: try:
getattr(self._implementation, 'remove')(*args, **kwargs) getattr(self._implementation, 'remove')(uuid)
except Exception as e: except Exception as e:
raise DeviceException(str(e), predecessor=e) raise DeviceException(str(e), predecessor=e)
self._components.remove(o) self._components.remove(o)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment