From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 07BE945460; Fri, 14 Jun 2024 22:48:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE53F40674; Fri, 14 Jun 2024 22:48:50 +0200 (CEST) Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by mails.dpdk.org (Postfix) with ESMTP id 5FED84060B for ; Fri, 14 Jun 2024 22:48:49 +0200 (CEST) Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-52b7ecafe05so303963e87.3 for ; Fri, 14 Jun 2024 13:48:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1718398128; x=1719002928; darn=dpdk.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=LoPWR5VenoXynaACDPpS8IrwMTZnep2yN5Q0eWsdMgw=; b=MJc/GlOAMVzSOSCtEaDoAtrrzi1hGYyqyrDfI6Lj7d1521QTqC7rdRYcr3d3db1tNr gxhg7M6SFmYWYc2WLQKp3fIrKvYhnzYg5Dwn/jATZfzheDf+zVKsG+PrHxrEpz+pvMX3 DPCXlESuEEeNv4ygI0gJgHLpiATS7Y9hdgKjQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718398128; x=1719002928; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LoPWR5VenoXynaACDPpS8IrwMTZnep2yN5Q0eWsdMgw=; b=QQdyARXrQt17X6MupUxKa2Yx6GvERUATgEpMku532YKewIZY39VtSo/mxoEk30jYWo IOhH4WlgBWO6OhPB/PmL4MfDqBFzJgQaaHoqzsZg8PWftJUSBL0UeRtG8oQoqIu+Wxkf 51FtyMUj3Ozn+f53HAmU6aS9/x1MxDthP+HTNiGzB4D6dsJbCiDuvrMXTrWSn+KI3EHf A4PMk9hVXy+rnxSHwx31+SoQuTLtbIRtJR+25InJFCiqhIVtQn0E8FHZLdBGoUkp0HUL 5rGmQu4GS0Cx5/73aAKlM/QyLkoSLdBUI87L3gs2PxDyqzTG/4TuXk6VffwrAW80Beut SvEw== X-Forwarded-Encrypted: i=1; AJvYcCWDumZp4WCYN5wToLa86RNMvgbHLT93PWD2eTgojKr++GbLLBxpHrtPS9iQN8cCPB6mNGTLHpq9QtgFmyE= X-Gm-Message-State: AOJu0YxEEB0j3ROn1uDE69amq41qYEMzZ3/brJ5TaiGfL3nW8KKalcKO 2MvWI/nSFygk13FHWLcCEW+h/kKPXGsceI7pRNdPGpSXmkh327v1H5zLnO9gN5CHmx3KQxwyzwg jAcFdvuCss84WZPvGppcKm8Ff0eVn0mHncXlWvw== X-Google-Smtp-Source: AGHT+IHveMIWCW/JFoRCFwlnwwmIy/np1NVfWd09hiW+MLSGwtkVOli1dyVN6vTWJ0l5c/us4l1QQtIXg0YASC3IIqc= X-Received: by 2002:a2e:7015:0:b0:2ec:18c7:169d with SMTP id 38308e7fff4ca-2ec18c71855mr12405381fa.1.1718398128303; Fri, 14 Jun 2024 13:48:48 -0700 (PDT) MIME-Version: 1.0 References: <20240501161623.26672-1-jspewock@iol.unh.edu> <20240529194910.26803-1-jspewock@iol.unh.edu> <20240529194910.26803-3-jspewock@iol.unh.edu> In-Reply-To: <20240529194910.26803-3-jspewock@iol.unh.edu> From: Nicholas Pratte Date: Fri, 14 Jun 2024 16:48:37 -0400 Message-ID: Subject: Re: [PATCH v3 2/3] dts: Add missing docstring from XML-RPC server To: jspewock@iol.unh.edu Cc: paul.szczepanek@arm.com, wathsala.vithanage@arm.com, probb@iol.unh.edu, Luca.Vizzarro@arm.com, thomas@monjalon.net, juraj.linkes@pantheon.tech, Honnappa.Nagarahalli@arm.com, yoan.picchi@foss.arm.com, dev@dpdk.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Just a small nitpick. Otherwise: Reviewed-by: Nicholas Pratte > class QuittableXMLRPCServer(SimpleXMLRPCServer): > - """Basic XML-RPC server. > + r"""Basic XML-RPC server. > > The server may be augmented by functions serializable by the :mod:`marshal` module. > + > + Example: > + :: > + > + def hello_world(): > + # to be sent to the XML-RPC server > + print("Hello World!") > + > + # start the XML-RPC server on the remote node > + # the example assumes you're already connect to a tg_node This just a very small nitpick, but you wrote 'connect' when it should be 'connected.' > + # this is done by starting a Python shell on the remote node > + from framework.remote_session import PythonShell This comment is related to the one I made above, but maybe you could move the above comment 'assumes you're already connected to a tg_node' on this line instead of where it is right now. I had to rescan this a couple times when reading. Again, this is just an extremely minuscule nitpick, but I figured I'd bring it up, in any case. > + session = tg_node.create_interactive_shell(PythonShell, timeout=5, privileged=True) > + > + # then importing the modules needed to run the server > + # and the modules for any functions later added to the server > + session.send_command("import xmlrpc") > + session.send_command("from xmlrpc.server import SimpleXMLRPCServer") > + > + # sending the source code of this class to the Python shell > + from xmlrpc.server import SimpleXMLRPCServer > + src = inspect.getsource(QuittableXMLRPCServer) > + src = "\n".join([l for l in src.splitlines() if not l.isspace() and l != ""]) > + spacing = "\n" * 4 > + session.send_command(spacing + src + spacing) > + > + # then starting the server with: > + command = "s = QuittableXMLRPCServer(('0.0.0.0', {listen_port}));s.serve_forever()" > + session.send_command(command, "XMLRPC OK") > + > + # now the server is running on the remote node and we can add functions to it > + # first connect to the server from the execution node > + import xmlrpc.client > + server_url = f"http://{tg_node.config.hostname}:8000" > + rpc_server_proxy = xmlrpc.client.ServerProxy(server_url) > + > + # get the function bytes to send > + import marshal > + function_bytes = marshal.dumps(hello_world.__code__) > + rpc_server_proxy.add_rpc_function(hello_world.__name__, function_bytes) > + > + # now we can execute the function on the server > + xmlrpc_binary_recv: xmlrpc.client.Binary = rpc_server_proxy.hello_world() > + print(str(xmlrpc_binary_recv)) > """ > > def __init__(self, *args, **kwargs): > -- > 2.45.1 >