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 2CE7B429C4; Fri, 28 Apr 2023 21:33:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A718F406B5; Fri, 28 Apr 2023 21:33:16 +0200 (CEST) Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by mails.dpdk.org (Postfix) with ESMTP id 830B840698 for ; Fri, 28 Apr 2023 21:33:15 +0200 (CEST) Received: by mail-pg1-f177.google.com with SMTP id 41be03b00d2f7-5191796a483so142696a12.0 for ; Fri, 28 Apr 2023 12:33:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1682710394; x=1685302394; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=SJg3m0M69Rl6vhvwVXnuXaw8q4JFfm4h4l2Yx4X8oeU=; b=VQj1U63I/fg11s7rWZj4JKvmtPi4jyo4lhjdMIqmdvplsBsqtYBdcfglZ4L1fv8oKB xGheTIoXxPOW6L+k6iwo+zK5vuVzc7sYGd5ND+cZIImvB6Ll6qJMcxv0NPpRhEZgnG3A RTCZwboWKTTXaHk0yT0apamWLPlRNd1v7debE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682710394; x=1685302394; 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=SJg3m0M69Rl6vhvwVXnuXaw8q4JFfm4h4l2Yx4X8oeU=; b=TNw+Y0qBQo53cw0ovPYX4Zk935I14Bc3Pf3TKi0gJua1mspgCkbmObkSDVzopFNonq cCycGEEln5z2jap8xJgMOeQWDN7tNlCQ6IqOmDq/pvwDZukZvucbxJfYWZZe7ceVyEkb hO0+is4pf9x/5i/7f9+20bdKhEsmPyi5pYuzqdUrTfaSpskE9tCsSg/BcZBEcyHvy1qv DpSHqVh76hd2I3vUV4sLT8dIfzNQ0eflYfuqIrcT/DVk1kVQ0DggileXMASL2iBXxCou zHRnxHq5jv4hW292UkPtzzpvh9dkhBVrPFiaj+fN7UCPgft6fs4TqFT0i0qnenym4FR5 z8dA== X-Gm-Message-State: AC+VfDzIgNJlKtkCYplBMnADj0TKKJ9HouFLXfENd0RA8oRrOTP/ZW5y nZsMFlsRMg3XCNPXx976t8n6CBA5WE90VMw4sZlBmg== X-Google-Smtp-Source: ACHHUZ45MQeprbr8bZSl73bkbM+CuAf90lTugyaJ8f0MFXjNgepBbOGS8djQSht/7E2UbtKjvLFonWGG12o0sYlEzHY= X-Received: by 2002:a17:90b:180a:b0:23d:15d8:1bc3 with SMTP id lw10-20020a17090b180a00b0023d15d81bc3mr6629977pjb.39.1682710394475; Fri, 28 Apr 2023 12:33:14 -0700 (PDT) MIME-Version: 1.0 References: <20230323104040.484708-1-juraj.linkes@pantheon.tech> <20230323104040.484708-5-juraj.linkes@pantheon.tech> In-Reply-To: <20230323104040.484708-5-juraj.linkes@pantheon.tech> From: Jeremy Spewock Date: Fri, 28 Apr 2023 15:33:03 -0400 Message-ID: Subject: Re: [RFC PATCH v1 4/4] dts: format docstrigs to google format To: =?UTF-8?Q?Juraj_Linke=C5=A1?= Cc: thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, lijuan.tu@intel.com, bruce.richardson@intel.com, wathsala.vithanage@arm.com, dev@dpdk.org Content-Type: multipart/alternative; boundary="00000000000052b09205fa6a8b85" 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 --00000000000052b09205fa6a8b85 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Acked-by: Jeremy Spweock On Thu, Mar 23, 2023 at 6:40=E2=80=AFAM Juraj Linke=C5=A1 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 > --- > 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 > > --00000000000052b09205fa6a8b85 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Acked-by: Jeremy Spweock <jspweock@iol.unh.edu>

On Thu, Mar 23, 2023 at 6:40=E2=80= =AFAM Juraj Linke=C5=A1 <juraj.linkes@pantheon.tech> wrote:
=
WIP: only one module is r= eformatted to serve as a demonstration.

The google format is documented here [0].

[0]: https://google.github.io/styleguide/pyguide.htm= l

Signed-off-by: Juraj Linke=C5=A1 <juraj.linkes@pantheon.tech>
---
=C2=A0dts/framework/testbed_model/node.py | 152 +++++++++++++++++++--------= -
=C2=A01 file changed, 103 insertions(+), 49 deletions(-)

diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_mo= del/node.py
index 90467981c3..ad8ef442af 100644
--- a/dts/framework/testbed_model/node.py
+++ b/dts/framework/testbed_model/node.py
@@ -3,8 +3,13 @@
=C2=A0# Copyright(c) 2022-2023 PANTHEON.tech s.r.o.
=C2=A0# 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 othe= r classes
+with functionality specific to that node type.
+The only part that can be used standalone is the Node.skip_setup static me= thod,
+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.<= br> =C2=A0"""

=C2=A0from typing import Any, Callable
@@ -26,10 +31,25 @@


=C2=A0class Node(object):
-=C2=A0 =C2=A0 """
-=C2=A0 =C2=A0 Basic class for node management. This class implements metho= ds that
-=C2=A0 =C2=A0 manage a node, such as information gathering (of CPU/PCI/NIC= ) and
-=C2=A0 =C2=A0 environment setup.
+=C2=A0 =C2=A0 """The base class for node management.
+
+=C2=A0 =C2=A0 It shouldn't be instantiated, but rather extended.
+=C2=A0 =C2=A0 It implements common methods to manage any node:
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0* connection to the node
+=C2=A0 =C2=A0 =C2=A0 =C2=A0* information gathering of CPU
+=C2=A0 =C2=A0 =C2=A0 =C2=A0* hugepages setup
+
+=C2=A0 =C2=A0 Arguments:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 node_config: The config from the input configu= ration file.
+
+=C2=A0 =C2=A0 Attributes:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 main_session: The primary OS-agnostic remote s= ession used
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 to communicate with the node. +=C2=A0 =C2=A0 =C2=A0 =C2=A0 config: The configuration used to create the n= ode.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 name: The name of the node.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 lcores: The list of logical cores that DTS can= use on the node.
+=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.
=C2=A0 =C2=A0 =C2=A0"""

=C2=A0 =C2=A0 =C2=A0main_session: OSSession
@@ -56,65 +76,89 @@ def __init__(self, node_config: NodeConfiguration):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._logger.info(f"Created node: {self.name}")

=C2=A0 =C2=A0 =C2=A0def set_up_execution(self, execution_config: ExecutionC= onfiguration) -> None:
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 Perform the execution setup that will be done = for each execution
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 this node is part of.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Execution setup steps.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Configure hugepages and call self._set_up_exec= ution where
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 the rest of the configuration steps (if any) a= re implemented.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Args:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 execution_config: The execution = configuration according to which
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 the setup steps wi= ll be taken.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._setup_hugepages()
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._set_up_execution(execution_config)<= br>
=C2=A0 =C2=A0 =C2=A0def _set_up_execution(self, execution_config: Execution= Configuration) -> None:
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 This method exists to be optionally overwritte= n by derived classes and
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 is not decorated so that the derived class doe= sn't have to use the decorator.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Optional additional executio= n setup steps for derived classes.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Derived classes should overwrite this
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if they want to add additional execution setup= steps.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""

=C2=A0 =C2=A0 =C2=A0def tear_down_execution(self) -> None:
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 Perform the execution teardown that will be do= ne after each execution
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 this node is part of concludes.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Execution teardown steps. +
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 There are currently no common execution teardo= wn steps
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 common to all DTS node types.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._tear_down_execution()

=C2=A0 =C2=A0 =C2=A0def _tear_down_execution(self) -> None:
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 This method exists to be optionally overwritte= n by derived classes and
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 is not decorated so that the derived class doe= sn't have to use the decorator.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Optional additional executio= n teardown steps for derived classes.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Derived classes should overwrite this
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if they want to add additional execution teard= own steps.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""

=C2=A0 =C2=A0 =C2=A0def set_up_build_target(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self, build_target_config: BuildTargetCon= figuration
=C2=A0 =C2=A0 =C2=A0) -> None:
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 Perform the build target setup that will be do= ne for each build target
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 tested on this node.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Build target setup steps. +
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 There are currently no common build target set= up steps
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 common to all DTS node types.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Args:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 build_target_config: The build t= arget configuration according to which
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 the setup steps wi= ll be taken.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._set_up_build_target(build_target_co= nfig)

=C2=A0 =C2=A0 =C2=A0def _set_up_build_target(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self, build_target_config: BuildTargetCon= figuration
=C2=A0 =C2=A0 =C2=A0) -> None:
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 This method exists to be optionally overwritte= n by derived classes and
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 is not decorated so that the derived class doe= sn't have to use the decorator.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Optional additional build ta= rget setup steps for derived classes.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Derived classes should optionally overwrite th= is
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if they want to add additional build target se= tup steps.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""

=C2=A0 =C2=A0 =C2=A0def tear_down_build_target(self) -> None:
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 Perform the build target teardown that will be= done after each build target
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 tested on this node.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Build target teardown steps.=
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 There are currently no common build target tea= rdown steps
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 common to all DTS node types.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._tear_down_build_target()

=C2=A0 =C2=A0 =C2=A0def _tear_down_build_target(self) -> None:
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 This method exists to be optionally overwritte= n by derived classes and
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 is not decorated so that the derived class doe= sn't have to use the decorator.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Optional additional build ta= rget teardown steps for derived classes.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Derived classes should overwrite this
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 if they want to add additional build target te= ardown steps.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""

=C2=A0 =C2=A0 =C2=A0def create_session(self, name: str) -> OSSession: -=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 Create and return a new OSSession tailored to = the remote OS.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Create and return a new OS-a= gnostic remote session.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 The returned session won't be used by the = object creating it.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Will be cleaned up automatically.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Args:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 name: The name of the session. +
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Returns:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 A new OS-agnostic remote session= .
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0session_name =3D f"{
self.name} {name}&quo= t;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0connection =3D create_session(
@@ -130,14 +174,24 @@ def filter_lcores(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0filter_specifier: LogicalCoreCount | Logi= calCoreList,
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ascending: bool =3D True,
=C2=A0 =C2=A0 =C2=A0) -> list[LogicalCore]:
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 Filter the LogicalCores found on the Node acco= rding to
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 a LogicalCoreCount or a LogicalCoreList.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Filter the node's logica= l cores that DTS can use.

-=C2=A0 =C2=A0 =C2=A0 =C2=A0 If ascending is True, use cores with the lowes= t numerical id first
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 and continue in ascending order. If False, sta= rt with the highest
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 id and continue in descending order. This orde= ring affects which
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 sockets to consider first as well.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Logical cores that DTS can use are ones that a= re present on the node,
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 but filtered according to user config.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 The filter_specifier will filter cores from th= ose logical cores.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Args:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 filter_specifier: Two different = filters can be used, one that specifies
+=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
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 the number of sock= ets,
+=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.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 ascending: If True, use cores wi= th the lowest numerical id first
+=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
+=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
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 sockets to conside= r first as well.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Returns:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 A list of logical cores.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._logger.debug(f"Filtering {filt= er_specifier} from {self.lcores}.")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return lcore_filter(
@@ -147,17 +201,14 @@ def filter_lcores(
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0).filter()

=C2=A0 =C2=A0 =C2=A0def _get_remote_cpus(self) -> None:
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 Scan CPUs in the remote OS and store a list of= LogicalCores.
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Scan CPUs in the remote OS a= nd store a list of LogicalCores."""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self._logger.info("Getting CPU informa= tion.")
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.lcores =3D self.main_session.get_rem= ote_cpus(self.config.use_first_core)

=C2=A0 =C2=A0 =C2=A0def _setup_hugepages(self):
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 Setup hugepages on the Node. Different archite= ctures can supply different
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 amounts of memory for hugepages and numa-based= hugepage allocation may need
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 to be considered.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Setup hugepages on the Node.=
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 Configure the hugepages only if they're sp= ecified in user configuration.
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if self.config.hugepages:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.main_session.setup_hug= epages(
@@ -165,9 +216,7 @@ def _setup_hugepages(self):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0)

=C2=A0 =C2=A0 =C2=A0def close(self) -> None:
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 Close all connections and free other resources= .
-=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """Close all connections and fr= ee other resources."""
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if self.main_session:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0self.main_session.close() =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0for session in self._other_sessions:
@@ -176,6 +225,11 @@ def close(self) -> None:

=C2=A0 =C2=A0 =C2=A0@staticmethod
=C2=A0 =C2=A0 =C2=A0def skip_setup(func: Callable[..., Any]) -> Callable= [..., Any]:
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """A decorator that skips the d= ecorated function.
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 When used, the decorator executes an empty lam= bda function
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 instead of the decorated function.
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 """
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if SETTINGS.skip_setup:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return lambda *args: None =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0else:
--
2.30.2

--00000000000052b09205fa6a8b85--