From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <dev-bounces@dpdk.org> Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9E05442D17; Wed, 21 Jun 2023 20:28:06 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A9C64068E; Wed, 21 Jun 2023 20:28:06 +0200 (CEST) Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) by mails.dpdk.org (Postfix) with ESMTP id 579624003C for <dev@dpdk.org>; Wed, 21 Jun 2023 20:28:04 +0200 (CEST) Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3a0423ea749so1179281b6e.0 for <dev@dpdk.org>; Wed, 21 Jun 2023 11:28:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1687372083; x=1689964083; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=6v9FNuX7vDu2ihaqEEmMmY1/5RLXkhdxHWtcJt1Yljg=; b=Cbvd0fX6XrZw1AUg0cLa2NKU8uqG/ejeMzx9JB2HU5cAVv4BW3oGwzBTc8+RE33p/R xm5d1sdfNvsDIZqWThTr9SkY/Jjd4hNX0hJjHU2q3DQcWft7JPy80ncknLHo2p2l4esB 5XrfYVaipPREB4JhmdAnoDlqiw7DFdLEOr0Pw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687372083; x=1689964083; 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=6v9FNuX7vDu2ihaqEEmMmY1/5RLXkhdxHWtcJt1Yljg=; b=PAN3yrUOBg2NehoDyqO9jTC+s6/VIoLOL2CMnIN4N//uNKyrYhDtAMi9AtdTmhTYU1 NXwR3QpF7e+P36M3o2m7tXDyYYiAkBTbzDq0aYhbiziJS8s9GkmlajKx3ZktQV+cVC7L iLmeZkNK5fSzQGi/UndurKvgIs7qPesCcXlfuSDKuQ+/rR0dfaiq8ELCBLE2IlhnnMZF a8J0hOjPjTMAsJ2H+J3a82LhB/y2DIhVsJ3rHUjSwYLUgtiGlIalenf2S5oh99B5g6xB mHRGSZVEKN2hKypMJbm+49kLOGF+QUk0vZnHV5GEBQrwwbDmmUgXI+78ff0DsPHQxfeg uMfQ== X-Gm-Message-State: AC+VfDynCCB5SVyt/sD74HNRO70EJ5oz/sZULV9gmXqveF25BBvQva95 NWo6O1cT0r1v8ZsO6iPUrllBm4RSTx/CilzKUPtC8g== X-Google-Smtp-Source: ACHHUZ5ZbXid0tStDHLkS/5SDZCY8L7vOqmbTWFUncl3bFWpqc2xE6vkwIl1gZtvd+g+c5ggdZSPYHLhSb+rrb//QkY= X-Received: by 2002:a05:6808:1792:b0:39e:b986:6609 with SMTP id bg18-20020a056808179200b0039eb9866609mr16228108oib.38.1687372083600; Wed, 21 Jun 2023 11:28:03 -0700 (PDT) MIME-Version: 1.0 References: <20230504123749.1417259-1-juraj.linkes@pantheon.tech> <20230511091408.236638-1-juraj.linkes@pantheon.tech> <20230511091408.236638-5-juraj.linkes@pantheon.tech> In-Reply-To: <20230511091408.236638-5-juraj.linkes@pantheon.tech> From: Jeremy Spewock <jspewock@iol.unh.edu> Date: Wed, 21 Jun 2023 14:27:52 -0400 Message-ID: <CAAA20URC9qgCbt9+j2pXSWwQopFOW4gi47tMTJObPqYQeROAXw@mail.gmail.com> Subject: Re: [RFC PATCH v3 4/4] dts: format docstrigs to google format To: =?UTF-8?Q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech> Cc: thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, lijuan.tu@intel.com, bruce.richardson@intel.com, wathsala.vithanage@arm.com, probb@iol.unh.edu, dev@dpdk.org Content-Type: multipart/alternative; boundary="000000000000a5b46205fea7eda2" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org --000000000000a5b46205fea7eda2 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Acked-by: Jeremy Spweock <jspweock@iol.unh.edu> On Thu, May 11, 2023 at 5:14=E2=80=AFAM Juraj Linke=C5=A1 <juraj.linkes@pan= theon.tech> wrote: > WIP: only one module is reformatted to serve as a demonstration. > > The google format is documented here [0]. > > [0]: https://google.github.io/styleguide/pyguide.html > > Signed-off-by: Juraj Linke=C5=A1 <juraj.linkes@pantheon.tech> > --- > dts/framework/testbed_model/node.py | 152 +++++++++++++++++++--------- > 1 file changed, 103 insertions(+), 49 deletions(-) > > diff --git a/dts/framework/testbed_model/node.py > b/dts/framework/testbed_model/node.py > index 90467981c3..ad8ef442af 100644 > --- a/dts/framework/testbed_model/node.py > +++ b/dts/framework/testbed_model/node.py > @@ -3,8 +3,13 @@ > # Copyright(c) 2022-2023 PANTHEON.tech s.r.o. > # Copyright(c) 2022-2023 University of New Hampshire > > -""" > -A node is a generic host that DTS connects to and manages. > +"""Common functionality for node management. > + > +There's a base class, Node, that's supposed to be extended by other > classes > +with functionality specific to that node type. > +The only part that can be used standalone is the Node.skip_setup static > method, > +which is a decorator used to skip method execution > +if skip_setup is passed by the user on the cmdline or in an env variable= . > """ > > from typing import Any, Callable > @@ -26,10 +31,25 @@ > > > class Node(object): > - """ > - Basic class for node management. This class implements methods that > - manage a node, such as information gathering (of CPU/PCI/NIC) and > - environment setup. > + """The base class for node management. > + > + It shouldn't be instantiated, but rather extended. > + It implements common methods to manage any node: > + > + * connection to the node > + * information gathering of CPU > + * hugepages setup > + > + Arguments: > + node_config: The config from the input configuration file. > + > + Attributes: > + main_session: The primary OS-agnostic remote session used > + to communicate with the node. > + config: The configuration used to create the node. > + name: The name of the node. > + lcores: The list of logical cores that DTS can use on the node. > + It's derived from logical cores present on the node and user > configuration. > """ > > main_session: OSSession > @@ -56,65 +76,89 @@ def __init__(self, node_config: NodeConfiguration): > self._logger.info(f"Created node: {self.name}") > > def set_up_execution(self, execution_config: ExecutionConfiguration) > -> None: > - """ > - Perform the execution setup that will be done for each execution > - this node is part of. > + """Execution setup steps. > + > + Configure hugepages and call self._set_up_execution where > + the rest of the configuration steps (if any) are implemented. > + > + Args: > + execution_config: The execution configuration according to > which > + the setup steps will be taken. > """ > self._setup_hugepages() > self._set_up_execution(execution_config) > > def _set_up_execution(self, execution_config: ExecutionConfiguration= ) > -> None: > - """ > - This method exists to be optionally overwritten by derived > classes and > - is not decorated so that the derived class doesn't have to use > the decorator. > + """Optional additional execution setup steps for derived classes= . > + > + Derived classes should overwrite this > + if they want to add additional execution setup steps. > """ > > def tear_down_execution(self) -> None: > - """ > - Perform the execution teardown that will be done after each > execution > - this node is part of concludes. > + """Execution teardown steps. > + > + There are currently no common execution teardown steps > + common to all DTS node types. > """ > self._tear_down_execution() > > def _tear_down_execution(self) -> None: > - """ > - This method exists to be optionally overwritten by derived > classes and > - is not decorated so that the derived class doesn't have to use > the decorator. > + """Optional additional execution teardown steps for derived > classes. > + > + Derived classes should overwrite this > + if they want to add additional execution teardown steps. > """ > > def set_up_build_target( > self, build_target_config: BuildTargetConfiguration > ) -> None: > - """ > - Perform the build target setup that will be done for each build > target > - tested on this node. > + """Build target setup steps. > + > + There are currently no common build target setup steps > + common to all DTS node types. > + > + Args: > + build_target_config: The build target configuration accordin= g > to which > + the setup steps will be taken. > """ > self._set_up_build_target(build_target_config) > > def _set_up_build_target( > self, build_target_config: BuildTargetConfiguration > ) -> None: > - """ > - This method exists to be optionally overwritten by derived > classes and > - is not decorated so that the derived class doesn't have to use > the decorator. > + """Optional additional build target setup steps for derived > classes. > + > + Derived classes should optionally overwrite this > + if they want to add additional build target setup steps. > """ > > def tear_down_build_target(self) -> None: > - """ > - Perform the build target teardown that will be done after each > build target > - tested on this node. > + """Build target teardown steps. > + > + There are currently no common build target teardown steps > + common to all DTS node types. > """ > self._tear_down_build_target() > > def _tear_down_build_target(self) -> None: > - """ > - This method exists to be optionally overwritten by derived > classes and > - is not decorated so that the derived class doesn't have to use > the decorator. > + """Optional additional build target teardown steps for derived > classes. > + > + Derived classes should overwrite this > + if they want to add additional build target teardown steps. > """ > > def create_session(self, name: str) -> OSSession: > - """ > - Create and return a new OSSession tailored to the remote OS. > + """Create and return a new OS-agnostic remote session. > + > + The returned session won't be used by the object creating it. > + Will be cleaned up automatically. > + > + Args: > + name: The name of the session. > + > + Returns: > + A new OS-agnostic remote session. > """ > session_name =3D f"{self.name} {name}" > connection =3D create_session( > @@ -130,14 +174,24 @@ def filter_lcores( > filter_specifier: LogicalCoreCount | LogicalCoreList, > ascending: bool =3D True, > ) -> list[LogicalCore]: > - """ > - Filter the LogicalCores found on the Node according to > - a LogicalCoreCount or a LogicalCoreList. > + """Filter the node's logical cores that DTS can use. > > - If ascending is True, use cores with the lowest numerical id fir= st > - and continue in ascending order. If False, start with the highes= t > - id and continue in descending order. This ordering affects which > - sockets to consider first as well. > + Logical cores that DTS can use are ones that are present on the > node, > + but filtered according to user config. > + The filter_specifier will filter cores from those logical cores. > + > + Args: > + filter_specifier: Two different filters can be used, one tha= t > specifies > + the number of logical cores per core, cores per socket a= nd > + the number of sockets, > + the other that specifies a logical core list. > + ascending: If True, use cores with the lowest numerical id > first > + and continue in ascending order. If False, start with th= e > highest > + id and continue in descending order. This ordering > affects which > + sockets to consider first as well. > + > + Returns: > + A list of logical cores. > """ > self._logger.debug(f"Filtering {filter_specifier} from > {self.lcores}.") > return lcore_filter( > @@ -147,17 +201,14 @@ def filter_lcores( > ).filter() > > def _get_remote_cpus(self) -> None: > - """ > - Scan CPUs in the remote OS and store a list of LogicalCores. > - """ > + """Scan CPUs in the remote OS and store a list of LogicalCores."= "" > self._logger.info("Getting CPU information.") > self.lcores =3D > self.main_session.get_remote_cpus(self.config.use_first_core) > > def _setup_hugepages(self): > - """ > - Setup hugepages on the Node. Different architectures can supply > different > - amounts of memory for hugepages and numa-based hugepage > allocation may need > - to be considered. > + """Setup hugepages on the Node. > + > + Configure the hugepages only if they're specified in user > configuration. > """ > if self.config.hugepages: > self.main_session.setup_hugepages( > @@ -165,9 +216,7 @@ def _setup_hugepages(self): > ) > > def close(self) -> None: > - """ > - Close all connections and free other resources. > - """ > + """Close all connections and free other resources.""" > if self.main_session: > self.main_session.close() > for session in self._other_sessions: > @@ -176,6 +225,11 @@ def close(self) -> None: > > @staticmethod > def skip_setup(func: Callable[..., Any]) -> Callable[..., Any]: > + """A decorator that skips the decorated function. > + > + When used, the decorator executes an empty lambda function > + instead of the decorated function. > + """ > if SETTINGS.skip_setup: > return lambda *args: None > else: > -- > 2.30.2 > > --000000000000a5b46205fea7eda2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:arial,sa= ns-serif"><div class=3D"gmail-gE gmail-iv gmail-gt"><table class=3D"gmail-c= f gmail-gJ" cellpadding=3D"0"><tbody><tr class=3D"gmail-acZ gmail-xD"><td c= olspan=3D"3"><table class=3D"gmail-cf gmail-adz" cellpadding=3D"0"><tbody><= tr><td class=3D"gmail-ady">Acked-by: Jeremy Spweock <<a href=3D"mailto:j= spweock@iol.unh.edu" target=3D"_blank">jspweock@iol.unh.edu</a>></td></t= r></tbody></table></td></tr></tbody></table></div></div></div><br><div clas= s=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, May 11, 202= 3 at 5:14=E2=80=AFAM Juraj Linke=C5=A1 <juraj.linkes@pantheon.tech> w= rote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0p= x 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">WIP: only = one module is reformatted to serve as a demonstration.<br> <br> The google format is documented here [0].<br> <br> [0]: <a href=3D"https://google.github.io/styleguide/pyguide.html" rel=3D"no= referrer" target=3D"_blank">https://google.github.io/styleguide/pyguide.htm= l</a><br> <br> Signed-off-by: Juraj Linke=C5=A1 <juraj.linkes@pantheon.tech><br> ---<br> =C2=A0dts/framework/testbed_model/node.py | 152 +++++++++++++++++++--------= -<br> =C2=A01 file changed, 103 insertions(+), 49 deletions(-)<br> <br> diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_mo= del/node.py<br> index 90467981c3..ad8ef442af 100644<br> --- a/dts/framework/testbed_model/node.py<br> +++ b/dts/framework/testbed_model/node.py<br> @@ -3,8 +3,13 @@<br> =C2=A0# Copyright(c) 2022-2023 PANTHEON.tech s.r.o.<br> =C2=A0# Copyright(c) 2022-2023 University of New Hampshire<br> <br> -"""<br> -A node is a generic host that DTS connects to and manages.<br> +"""Common functionality for node management.<br> +<br> +There's a base class, Node, that's supposed to be extended by othe= r classes<br> +with functionality specific to that node type.<br> +The only part that can be used standalone is the Node.skip_setup static me= thod,<br> +which is a decorator used to skip method execution<br> +if skip_setup is passed by the user on the cmdline or in an env variable.<= br> =C2=A0"""<br> <br> =C2=A0from typing import Any, Callable<br> @@ -26,10 +31,25 @@<br> <br> <br> =C2=A0class Node(object):<br> -=C2=A0 =C2=A0 """<br> -=C2=A0 =C2=A0 Basic class for node management. This class implements metho= ds that<br> -=C2=A0 =C2=A0 manage a node, such as information gathering (of CPU/PCI/NIC= ) and<br> -=C2=A0 =C2=A0 environment setup.<br> +=C2=A0 =C2=A0 """The base class for node management.<br> +<br> +=C2=A0 =C2=A0 It shouldn't be instantiated, but rather extended.<br> +=C2=A0 =C2=A0 It implements common methods to manage any node:<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0* connection to the node<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0* information gathering of CPU<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0* hugepages setup<br> +<br> +=C2=A0 =C2=A0 Arguments:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 node_config: The config from the input configu= ration file.<br> +<br> +=C2=A0 =C2=A0 Attributes:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 main_session: The primary OS-agnostic remote s= ession used<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 to communicate with the node.<br= > +=C2=A0 =C2=A0 =C2=A0 =C2=A0 config: The configuration used to create the n= ode.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 name: The name of the node.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 lcores: The list of logical cores that DTS can= use on the node.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 It's derived from logical co= res present on the node and user configuration.<br> =C2=A0 =C2=A0 =C2=A0"""<br> <br> =C2=A0 =C2=A0 =C2=A0main_session: OSSession<br> @@ -56,65 +76,89 @@ def __init__(self, node_config: NodeConfiguration):<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._<a href=3D"http://logger.info" rel= =3D"noreferrer" target=3D"_blank">logger.info</a>(f"Created node: {<a = href=3D"http://self.name" rel=3D"noreferrer" target=3D"_blank">self.name</a= >}")<br> <br> =C2=A0 =C2=A0 =C2=A0def set_up_execution(self, execution_config: ExecutionC= onfiguration) -> None:<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 Perform the execution setup that will be done = for each execution<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 this node is part of.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Execution setup steps.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Configure hugepages and call self._set_up_exec= ution where<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 the rest of the configuration steps (if any) a= re implemented.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Args:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 execution_config: The execution = configuration according to which<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 the setup steps wi= ll be taken.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._setup_hugepages()<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._set_up_execution(execution_config)<= br> <br> =C2=A0 =C2=A0 =C2=A0def _set_up_execution(self, execution_config: Execution= Configuration) -> None:<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 This method exists to be optionally overwritte= n by derived classes and<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 is not decorated so that the derived class doe= sn't have to use the decorator.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Optional additional executio= n setup steps for derived classes.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Derived classes should overwrite this<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if they want to add additional execution setup= steps.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""<br> <br> =C2=A0 =C2=A0 =C2=A0def tear_down_execution(self) -> None:<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 Perform the execution teardown that will be do= ne after each execution<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 this node is part of concludes.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Execution teardown steps.<br= > +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 There are currently no common execution teardo= wn steps<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 common to all DTS node types.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._tear_down_execution()<br> <br> =C2=A0 =C2=A0 =C2=A0def _tear_down_execution(self) -> None:<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 This method exists to be optionally overwritte= n by derived classes and<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 is not decorated so that the derived class doe= sn't have to use the decorator.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Optional additional executio= n teardown steps for derived classes.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Derived classes should overwrite this<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if they want to add additional execution teard= own steps.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""<br> <br> =C2=A0 =C2=A0 =C2=A0def set_up_build_target(<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self, build_target_config: BuildTargetCon= figuration<br> =C2=A0 =C2=A0 =C2=A0) -> None:<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 Perform the build target setup that will be do= ne for each build target<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 tested on this node.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Build target setup steps.<br= > +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 There are currently no common build target set= up steps<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 common to all DTS node types.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Args:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 build_target_config: The build t= arget configuration according to which<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 the setup steps wi= ll be taken.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._set_up_build_target(build_target_co= nfig)<br> <br> =C2=A0 =C2=A0 =C2=A0def _set_up_build_target(<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self, build_target_config: BuildTargetCon= figuration<br> =C2=A0 =C2=A0 =C2=A0) -> None:<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 This method exists to be optionally overwritte= n by derived classes and<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 is not decorated so that the derived class doe= sn't have to use the decorator.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Optional additional build ta= rget setup steps for derived classes.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Derived classes should optionally overwrite th= is<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if they want to add additional build target se= tup steps.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""<br> <br> =C2=A0 =C2=A0 =C2=A0def tear_down_build_target(self) -> None:<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 Perform the build target teardown that will be= done after each build target<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 tested on this node.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Build target teardown steps.= <br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 There are currently no common build target tea= rdown steps<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 common to all DTS node types.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._tear_down_build_target()<br> <br> =C2=A0 =C2=A0 =C2=A0def _tear_down_build_target(self) -> None:<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 This method exists to be optionally overwritte= n by derived classes and<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 is not decorated so that the derived class doe= sn't have to use the decorator.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Optional additional build ta= rget teardown steps for derived classes.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Derived classes should overwrite this<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 if they want to add additional build target te= ardown steps.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""<br> <br> =C2=A0 =C2=A0 =C2=A0def create_session(self, name: str) -> OSSession:<br= > -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 Create and return a new OSSession tailored to = the remote OS.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Create and return a new OS-a= gnostic remote session.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 The returned session won't be used by the = object creating it.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Will be cleaned up automatically.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Args:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 name: The name of the session.<b= r> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Returns:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 A new OS-agnostic remote session= .<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0session_name =3D f"{<a href=3D"http:= //self.name" rel=3D"noreferrer" target=3D"_blank">self.name</a>} {name}&quo= t;<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0connection =3D create_session(<br> @@ -130,14 +174,24 @@ def filter_lcores(<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0filter_specifier: LogicalCoreCount | Logi= calCoreList,<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ascending: bool =3D True,<br> =C2=A0 =C2=A0 =C2=A0) -> list[LogicalCore]:<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 Filter the LogicalCores found on the Node acco= rding to<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 a LogicalCoreCount or a LogicalCoreList.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Filter the node's logica= l cores that DTS can use.<br> <br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 If ascending is True, use cores with the lowes= t numerical id first<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 and continue in ascending order. If False, sta= rt with the highest<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 id and continue in descending order. This orde= ring affects which<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 sockets to consider first as well.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Logical cores that DTS can use are ones that a= re present on the node,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 but filtered according to user config.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 The filter_specifier will filter cores from th= ose logical cores.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Args:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 filter_specifier: Two different = filters can be used, one that specifies<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 the number of logi= cal cores per core, cores per socket and<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 the number of sock= ets,<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 the other that spe= cifies a logical core list.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ascending: If True, use cores wi= th the lowest numerical id first<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 and continue in as= cending order. If False, start with the highest<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 id and continue in= descending order. This ordering affects which<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sockets to conside= r first as well.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Returns:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 A list of logical cores.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._logger.debug(f"Filtering {filt= er_specifier} from {self.lcores}.")<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return lcore_filter(<br> @@ -147,17 +201,14 @@ def filter_lcores(<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0).filter()<br> <br> =C2=A0 =C2=A0 =C2=A0def _get_remote_cpus(self) -> None:<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 Scan CPUs in the remote OS and store a list of= LogicalCores.<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Scan CPUs in the remote OS a= nd store a list of LogicalCores."""<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._<a href=3D"http://logger.info" rel= =3D"noreferrer" target=3D"_blank">logger.info</a>("Getting CPU informa= tion.")<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.lcores =3D self.main_session.get_rem= ote_cpus(self.config.use_first_core)<br> <br> =C2=A0 =C2=A0 =C2=A0def _setup_hugepages(self):<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 Setup hugepages on the Node. Different archite= ctures can supply different<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 amounts of memory for hugepages and numa-based= hugepage allocation may need<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 to be considered.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Setup hugepages on the Node.= <br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 Configure the hugepages only if they're sp= ecified in user configuration.<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if self.config.hugepages:<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.main_session.setup_hug= epages(<br> @@ -165,9 +216,7 @@ def _setup_hugepages(self):<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0)<br> <br> =C2=A0 =C2=A0 =C2=A0def close(self) -> None:<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 Close all connections and free other resources= .<br> -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Close all connections and fr= ee other resources."""<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if self.main_session:<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.main_session.close()<b= r> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for session in self._other_sessions:<br> @@ -176,6 +225,11 @@ def close(self) -> None:<br> <br> =C2=A0 =C2=A0 =C2=A0@staticmethod<br> =C2=A0 =C2=A0 =C2=A0def skip_setup(func: Callable[..., Any]) -> Callable= [..., Any]:<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """A decorator that skips the d= ecorated function.<br> +<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 When used, the decorator executes an empty lam= bda function<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 instead of the decorated function.<br> +=C2=A0 =C2=A0 =C2=A0 =C2=A0 """<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if SETTINGS.skip_setup:<br> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return lambda *args: None<b= r> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else:<br> -- <br> 2.30.2<br> <br> </blockquote></div> --000000000000a5b46205fea7eda2--