3 from typing
import List
5 from robot.api
import logger
6 from robot.utils
import DotDict
7 from robot.utils
import timestr_to_secs
10 from ModDaqif.Daqif
import (
18 from ModDaqif.Daqif.DpmControl
import DpmControlSync
19 from ModDaqif.Daqif.DpmDaqControl
import DpmDaqControlSync
25 uris = arg.split(
"@")[1]
26 return uris.split(
",")[0]
31 return DotDict(id=r.getId(), error=r.getError())
38 state=str(r.getState()).split(
".")[1],
39 subState=str(r.getSubState()).split(
".")[1],
41 message=r.getMessage(),
42 timestamp=r.getTimestamp(),
49 available=r.getAvailable(),
50 capacity=r.getCapacity(),
60 """Robot library providing keywords for the daqif.DpmDaqControl and daqif.DpmControl
65 ROBOT_LIBRARY_SCOPE =
"GLOBAL"
68 logger.debug(
"Loading MAL and creating factory")
69 self.
malmal = pymal.loadMal(
"zpb", {})
70 self.
factoryfactory = pymal.CiiFactory.getInstance()
71 self.
factoryfactory.registerMal(
"zpb", self.
malmal)
72 logger.debug(
"Loading MAL and creating factory done")
75 """Creates RR clientss with a given ReplyTime timeout."""
76 timeout = timestr_to_secs(timeout)
if timeout
is not None else 5
78 logger.info(
"Create client for uri %s with timeout %d" % (root_uri, timeout))
80 clients.daq = self.
factoryfactory.getClient(
83 pymal.rr.qos.ReplyTime(datetime.timedelta(seconds=timeout)),
85 clients.dpm = self.
factoryfactory.getClient(
88 pymal.rr.qos.ReplyTime(datetime.timedelta(seconds=timeout)),
93 logger.info(
"Sending DpmControl.Exit(%s) request")
97 logger.info(
"Sending DpmDaqControl.QueryStorageStatus() request")
98 r = clients.dpm.QueryStorageStatus()
103 "Sending DpmDaqControl.QueueDaq(%s) request",
104 dp_spec[0:10].replace(
"\n",
" "),
107 r = clients.daq.QueueDaq(dp_spec)
109 except DaqException
as e:
110 logger.info(
"QueueDaq() failed: %s" % e.getMessage())
114 logger.info(
"Sending DpmDaqControl.AbortDaq(%s) request", daq_id)
115 r = clients.daq.AbortDaq(daq_id)
119 logger.info(
"Sending DpmDaqControl.GetStatus(%s) request", daq_id)
120 r = clients.daq.GetDaqStatus(daq_id)
124 logger.info(
"Sending DpmDaqControl.GetActive() request")
125 daqs = clients.daq.GetActiveDaqs()
129 logger.info(
"Sending DpmDaqControl.GetDaqStatus() until timeout or erro")
130 timeout = timestr_to_secs(timeout)
if timeout
is not None else 3
131 until = time.monotonic() + timeout
133 if time.monotonic() > until:
134 raise TimeoutError(
"Timeout waiting for DAQ error")
135 r = clients.daq.GetDaqStatus(daq_id)
Robot library providing keywords for the daqif.DpmDaqControl and daqif.DpmControl interface.
def dpmctl_create(self, root_uri, timeout=None)
Creates RR clientss with a given ReplyTime timeout.
DaqReply dpmctl_queue_daq(self, Clients clients, str dp_spec)
StorageStatus dpmctl_query_storage_status(self, Clients clients)
str dpmctl_exit(self, Clients clients)
List[DaqStatus] dpmctl_get_active_daqs(self, Clients clients)
DaqStatus dpmctl_await_error(self, Clients clients, str daq_id, str timeout=None)
DaqReply dpmctl_abort_daq(self, Clients clients, str daq_id)
DaqStatus dpmctl_get_daq_status(self, Clients clients, str daq_id)
def dict_from_storagestatus(StorageStatus r)
def dict_from_daqreply(DaqReply r)
def dict_from_daqstatus(DaqStatus r)