From 5198cc3068c277fb7a9024f61cbf05fd64cce8ca Mon Sep 17 00:00:00 2001 From: Auke Klazema <klazema@astron.nl> Date: Tue, 18 Jun 2019 14:33:15 +0000 Subject: [PATCH] SW-705: Fix mising function --- MAC/Services/src/observation_control_rpc.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/MAC/Services/src/observation_control_rpc.py b/MAC/Services/src/observation_control_rpc.py index 58fc05a1440..168823acd43 100644 --- a/MAC/Services/src/observation_control_rpc.py +++ b/MAC/Services/src/observation_control_rpc.py @@ -20,7 +20,8 @@ import logging -from lofar.messaging.rpc import RPCClient, RPCClientContextManagerMixin +from lofar.messaging import RPCClient, RPCClientContextManagerMixin, DEFAULT_BUSNAME, \ + DEFAULT_BROKER, DEFAULT_RPC_TIMEOUT from lofar.mac.config import DEFAULT_OBSERVATION_CONTROL_SERVICE_NAME ''' Simple RPC client for Service ObservationControl2 @@ -34,5 +35,12 @@ class ObservationControlRPCClient(RPCClientContextManagerMixin): super().__init__() self._rpc_client = rpc_client + @staticmethod + def create(exchange=DEFAULT_BUSNAME, broker=DEFAULT_BROKER, timeout=DEFAULT_RPC_TIMEOUT): + """Create a OTDBRPC connecting to the given exchange/broker on the default DEFAULT_OTDB_SERVICENAME service""" + return ObservationControlRPCClient( + RPCClient(service_name=DEFAULT_OBSERVATION_CONTROL_SERVICE_NAME, + exchange=exchange, broker=broker, timeout=timeout)) + def abort_observation(self, sas_id): return self._rpc_client.execute('AbortObservation', sas_id=sas_id) -- GitLab