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 4618445482; Mon, 17 Jun 2024 17:07:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 372064028B; Mon, 17 Jun 2024 17:07:05 +0200 (CEST) Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by mails.dpdk.org (Postfix) with ESMTP id DFEEA4028A for ; Mon, 17 Jun 2024 17:07:03 +0200 (CEST) Received: by mail-pj1-f45.google.com with SMTP id 98e67ed59e1d1-2c4e9dc81c4so2405917a91.0 for ; Mon, 17 Jun 2024 08:07:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1718636823; x=1719241623; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Ou3hxJxe+YXybqVWFnVHVlax2RjuVYeprdWdmLlBtjA=; b=Td4KkFA7pdLOmAw1vjT+5NRWjy23hiP0KU80RnZPD+iFiWtfPnbv6R/TPuynbiESdR ui/VOaw9CZDZ8ZIdPkAOgJg5/Dfx7rfdGgy8J4BB1uGOkyFf3Al4YmXkhIRahCjLyUWe rk5jsKtLlr61L3GFAdPh1jB7lm969iKbNJZ5s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718636823; x=1719241623; h=content-transfer-encoding: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=Ou3hxJxe+YXybqVWFnVHVlax2RjuVYeprdWdmLlBtjA=; b=Hn/05OS5K80yEYvSHcU2g/jOu6IAvU3r8x1ASv6IWsqPxQJGGBdEolq13GF7CpS/HI Zoupf+7kw/ptizGmFIuDrxXprCbyeBtl7FAUQeDOk1Y8lRY+pP8h5+EWDqHqIknXK/yD 8rBKcycNxIXmqzxemGOjrM/RZAwnT3S9mG5kQ/2+N16X5Zkm6tmVUxMFzSsHkbf5gM6p jp9vJ3JYG8USnl/0VDGVzEg+z4HYJpXUSPCNnX8qPJR0WFM230ChgamUawTtEMWH8sT7 Nz2la8cQRqwYQaIprKFuGvnNrZtsjSNP0Em3iYci0ZrpHKfpefKGP6cx9mvCOdG4k2iq PWEg== X-Forwarded-Encrypted: i=1; AJvYcCVN5+e97DfE1e5ttHyDP2iR0exNUal9SnQURmPFzN1FyytrCk70q6u0wF2Z7/5cKG8HXk9mZOWEjrtJnB4= X-Gm-Message-State: AOJu0YwBeWTmP2ofvwJN+92eDwj3aCEtrEJILDjZ+yEPwXw3nxGr8/0h NMT0yyZa3teekYUwVv8ggFLqnb6orwH8Sb33IlW3i9UxmqLZELYr9kJwCyoQZeng/bOy5viFRtT Zq9ddAjtDQYTH0PE2A63gnzjYM/CM38FtoDtQbw== X-Google-Smtp-Source: AGHT+IG3A3IKX6ncz32jtElzv1WGULJazdcaHpQvCiFFvTs9XNZ9IP0m+aFHmFaAec2YGJcchUb8kraykOGgYVa5mF0= X-Received: by 2002:a17:90a:4812:b0:2c2:dd53:4fbf with SMTP id 98e67ed59e1d1-2c4dbd44ec6mr9728203a91.49.1718636823038; Mon, 17 Jun 2024 08:07:03 -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: From: Jeremy Spewock Date: Mon, 17 Jun 2024 11:06:51 -0400 Message-ID: Subject: Re: [PATCH v3 2/3] dts: Add missing docstring from XML-RPC server To: Nicholas Pratte 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" Content-Transfer-Encoding: quoted-printable 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 On Fri, Jun 14, 2024 at 4:48=E2=80=AFPM Nicholas Pratte wrote: > > 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.' Good catch, I'll fix this. > > > + # this is done by starting a Python shell on the remote no= de > > + 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. I agree when looking at this more in-depth that the order should be swapped, this comment looks like a continuation of the first line, but then there is another just kind of thrown in-between. good catch. > > > + session =3D tg_node.create_interactive_shell(PythonShell, = timeout=3D5, privileged=3DTrue) > > + > > + # then importing the modules needed to run the server > > + # and the modules for any functions later added to the ser= ver > > + session.send_command("import xmlrpc") > > + session.send_command("from xmlrpc.server import SimpleXMLR= PCServer") > > + > > + # sending the source code of this class to the Python shel= l > > + from xmlrpc.server import SimpleXMLRPCServer > > + src =3D inspect.getsource(QuittableXMLRPCServer) > > + src =3D "\n".join([l for l in src.splitlines() if not l.is= space() and l !=3D ""]) > > + spacing =3D "\n" * 4 > > + session.send_command(spacing + src + spacing) > > + > > + # then starting the server with: > > + command =3D "s =3D QuittableXMLRPCServer(('0.0.0.0', {list= en_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 =3D f"http://{tg_node.config.hostname}:8000" > > + rpc_server_proxy =3D xmlrpc.client.ServerProxy(server_url) > > + > > + # get the function bytes to send > > + import marshal > > + function_bytes =3D marshal.dumps(hello_world.__code__) > > + rpc_server_proxy.add_rpc_function(hello_world.__name__, fu= nction_bytes) > > + > > + # now we can execute the function on the server > > + xmlrpc_binary_recv: xmlrpc.client.Binary =3D rpc_server_pr= oxy.hello_world() > > + print(str(xmlrpc_binary_recv)) > > """ > > > > def __init__(self, *args, **kwargs): > > -- > > 2.45.1 > >