[pytango] 36/122: Fix dev_state/status to be gevent safe (Issue #57, PR #61)
Sandor Bodo-Merle
sbodomerle-guest at moszumanska.debian.org
Thu Sep 28 19:18:16 UTC 2017
This is an automated email from the git hooks/post-receive script.
sbodomerle-guest pushed a commit to tag v9.2.1
in repository pytango.
commit a1fede4edbb0707c5a11ce488f532a1e41b883e1
Author: Tiago Coutinho <coutinhotiago at gmail.com>
Date: Mon Sep 26 17:47:01 2016 +0200
Fix dev_state/status to be gevent safe (Issue #57, PR #61)
Patch dev_state, dev_status, read_attr_hardware and always_executed_hook
---
tango/server.py | 66 +++++++++++++++++++++++++++++++++++++++++++--------------
1 file changed, 50 insertions(+), 16 deletions(-)
diff --git a/tango/server.py b/tango/server.py
index 36af53f..615d0aa 100644
--- a/tango/server.py
+++ b/tango/server.py
@@ -413,25 +413,50 @@ def __patch_pipe_methods(tango_device_klass, pipe):
__patch_pipe_write_method(tango_device_klass, pipe)
-def __patch_init_delete_device(klass):
+def __patch_standard_device_methods(klass):
# TODO allow to force non green mode
- green_mode = True
- if green_mode == GreenMode.Synchronous:
- pass
- else:
- init_device_orig = klass.init_device
- @functools.wraps(init_device_orig)
- def init_device(self):
- return get_worker().execute(init_device_orig, self)
- setattr(klass, "init_device", init_device)
+ init_device_orig = klass.init_device
+
+ @functools.wraps(init_device_orig)
+ def init_device(self):
+ return get_worker().execute(init_device_orig, self)
+ setattr(klass, "init_device", init_device)
+
+ delete_device_orig = klass.delete_device
+
+ @functools.wraps(delete_device_orig)
+ def delete_device(self):
+ return get_worker().execute(delete_device_orig, self)
+ setattr(klass, "delete_device", delete_device)
+
+ dev_state_orig = klass.dev_state
- delete_device_orig = klass.delete_device
- @functools.wraps(delete_device_orig)
- def delete_device(self):
- return get_worker().execute(delete_device_orig, self)
- setattr(klass, "delete_device", delete_device)
+ @functools.wraps(dev_state_orig)
+ def dev_state(self):
+ return get_worker().execute(dev_state_orig, self)
+ setattr(klass, "dev_state", dev_state)
+ dev_status_orig = klass.dev_status
+
+ @functools.wraps(dev_status_orig)
+ def dev_status(self):
+ return get_worker().execute(dev_status_orig, self)
+ setattr(klass, "dev_status", dev_status)
+
+ read_attr_hardware_orig = klass.read_attr_hardware
+
+ @functools.wraps(read_attr_hardware_orig)
+ def read_attr_hardware(self, attr_list):
+ return get_worker().execute(read_attr_hardware_orig, self, attr_list)
+ setattr(klass, "read_attr_hardware", read_attr_hardware)
+
+ always_executed_hook_orig = klass.always_executed_hook
+
+ @functools.wraps(always_executed_hook_orig)
+ def always_executed_hook(self):
+ return get_worker().execute(always_executed_hook_orig, self)
+ setattr(klass, "always_executed_hook", always_executed_hook)
class _DeviceClass(DeviceClass):
@@ -508,7 +533,7 @@ def __create_tango_deviceclass_klass(tango_device_klass, attrs=None):
cmd_name, cmd_info = attr_obj.__tango_command__
cmd_list[cmd_name] = cmd_info
- __patch_init_delete_device(tango_device_klass)
+ __patch_standard_device_methods(tango_device_klass)
devclass_name = klass_name + "Class"
@@ -628,6 +653,15 @@ class Device(LatestDeviceImpl):
pass
delete_device.__doc__ == LatestDeviceImpl.delete_device.__doc__
+ def read_attr_hardware(self, attr_list):
+ return LatestDeviceImpl.read_attr_hardware(self, attr_list)
+
+ def dev_state(self):
+ return LatestDeviceImpl.dev_state(self)
+
+ def dev_status(self):
+ return LatestDeviceImpl.dev_status(self)
+
def get_device_properties(self, ds_class = None):
if ds_class is None:
try:
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pytango.git
More information about the debian-science-commits
mailing list