Exemplo n.º 1
0
    def run(self):
        """ worker thread
        """
        if hasattr(tango.ApiUtil, 'cleanup'):
            tango.ApiUtil.cleanup()
        self.__proxy = tango.DeviceProxy(self.__device)

        stime = time.time()
        etime = stime
        ids = []
        while etime - stime < self.__period:
            try:
                id_ = self.__proxy.subscribe_event(
                    self.__attribute, tango.EventType.CHANGE_EVENT, cb_tango)
                ids.append(id_)
            except Exception:
                self.__errors += 1
            else:
                self.__counter += 1
            etime = time.time()
        for id_ in ids:
            self.__proxy.unsubscribe_event(id_)
        self.__qresult.put(
            utils.Result(self.__wid, self.__counter, etime - stime,
                         self.__errors))
Exemplo n.º 2
0
 def run(self):
     """ worker thread
     """
     if hasattr(tango.ApiUtil, 'cleanup'):
         tango.ApiUtil.cleanup()
     self.__proxy = tango.DeviceProxy(self.__device)
     stime = time.time()
     etime = stime
     while etime - stime < self.__period:
         try:
             self.__proxy.command_inout(self.__command)
         except Exception:
             self.__ecounter += 1
         etime = time.time()
         self.__counter += 1
     self.__qresult.put(
         utils.Result(self.__wid, self.__counter, etime - stime,
                      self.__ecounter))
Exemplo n.º 3
0
 def run(self):
     """ worker thread
     """
     if hasattr(tango.ApiUtil, 'cleanup'):
         tango.ApiUtil.cleanup()
     self.__proxy = tango.DeviceProxy(self.__device)
     stime = time.time()
     etime = stime
     while etime - stime < self.__period:
         try:
             self.__proxy.write_pipe(self.__pipe, self.__value)
         except Exception:
             self.__errors += 1
         else:
             self.__counter += 1
         etime = time.time()
     self.__qresult.put(
         utils.Result(self.__wid, self.__counter, etime - stime,
                      self.__errors))
    def run(self):
        """ worker thread
        """
        if hasattr(tango.ApiUtil, 'cleanup'):
            tango.ApiUtil.cleanup()
        self.__proxy = tango.DeviceProxy(self.__device)
        self.__proxy.set_timeout_millis(10000)

        counter_cb = TangoCounterCb()

        id_ = self.__proxy.subscribe_event(self.__attribute,
                                           tango.EventType.CHANGE_EVENT,
                                           counter_cb)
        self.__proxy.EventAttribute = self.__attribute
        self.__proxy.EventSleepPeriod = self.__sleep
        time.sleep(1)
        stime = time.time()
        etime = stime
        self.__proxy.StartEvents()
        time.sleep(self.__period)
        finished = False
        while not finished:
            try:
                self.__proxy.StopEvents()
                finished = True
            except tango.DevFailed:
                # print(str(e))
                self.__errors += 1
        etime = time.time()
        time.sleep(1)
        self.__proxy.unsubscribe_event(id_)
        self.__counter = counter_cb.counter
        self.__errors += counter_cb.errors
        self.__qresult.put(
            utils.Result(self.__wid, self.__counter, etime - stime,
                         self.__errors))