Commit de111bcf authored by Tobias Winchen's avatar Tobias Winchen
Browse files

Fix ioloop launch of scpi server

parent 7c4bfcf4
......@@ -3,13 +3,17 @@ import logging
from mpikat.core.scpi import ScpiAsyncDeviceServer, scpi_request, raise_or_ok, launch_server
import mpikat.effelsberg.edd.pipeline.EDDPipeline as EDDPipeline
from mpikat.effelsberg.edd.edd_server_product_controller import EddServerProductController
import coloredlogs
from tornado.gen import Return, coroutine, sleep
import tornado
import signal
log = logging.getLogger('mpikat.edd_scpi_interface')
class EddScpiInterface(ScpiAsyncDeviceServer):
def __init__(self, master_controller_ip, master_controller_port, interface, port, ioloop=None):
class EddScpiInterface(ScpiAsyncDeviceServer):
def __init__(self, interface, port, master_ip, master_port, ioloop=None):
@brief A SCPI interface for a EddMasterController instance
......@@ -21,10 +25,16 @@ class EddScpiInterface(ScpiAsyncDeviceServer):
@note If no IOLoop instance is specified the current instance is used.
""""Master ast {}:{}".format(master_ip, master_port))
super(EddScpiInterface, self).__init__(interface, port, ioloop)
self.__controller = EddServerProductController("MASTER", master_controller_ip, master_controller_port)
self.address = (master_ip, master_port)
self.__controller = EddServerProductController("MASTER", master_ip, master_port)
def request_edd_configure(self, req):
@brief Configure the EDD backend
......@@ -69,6 +79,8 @@ class EddScpiInterface(ScpiAsyncDeviceServer):
yield self.__controller.capture_stop()
def request_edd_set(self, req, message):
@brief Set an option for an edd backend component.
......@@ -85,7 +97,6 @@ class EddScpiInterface(ScpiAsyncDeviceServer):
d[i] = {}
d = d[i]
d[p[-1]] = o
yield self.__controller.set(g)
......@@ -98,6 +109,7 @@ class EddScpiInterface(ScpiAsyncDeviceServer):
if __name__ == "__main__":
parser = EDDPipeline.getArgumentParser()
parser.add_argument('--master-controller-ip', dest='master_ip', type=str, default="localhost",
help='The ip for the master controller')
......@@ -105,6 +117,30 @@ if __name__ == "__main__":
help='The port number for the master controller')
args = parser.parse_args()
server = EddScpiInterface(args.master_ip, args.master_port,, args.port)
log = logging.getLogger('mpikat')
fmt=("[ %(levelname)s - %(asctime)s - %(name)s "
"- %(filename)s:%(lineno)s] %(message)s"),
ioloop = tornado.ioloop.IOLoop.current()"Starting Pipeline instance")
server = EddScpiInterface(, args.port, args.master_ip, args.master_port)"Created Pipeline instance")
signal.SIGINT, lambda sig, frame: ioloop.add_callback_from_signal(
EDDPipeline.on_shutdown, ioloop, server))
def start_and_display():"Starting Pipeline server")
log.debug("Started Pipeline server")
"Listening at {0}, Ctrl-C to terminate server".format(
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment