Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/133918/?format=api
http://patches.dpdk.org/api/patches/133918/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231106171601.160749-18-juraj.linkes@pantheon.tech/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20231106171601.160749-18-juraj.linkes@pantheon.tech>", "list_archive_url": "https://inbox.dpdk.org/dev/20231106171601.160749-18-juraj.linkes@pantheon.tech", "date": "2023-11-06T17:15:55", "name": "[v5,17/23] dts: node docstring update", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "81ed7b972fd1cb1ce57b06c5bf90e6acd525e94c", "submitter": { "id": 1626, "url": "http://patches.dpdk.org/api/people/1626/?format=api", "name": "Juraj Linkeš", "email": "juraj.linkes@pantheon.tech" }, "delegate": { "id": 2642, "url": "http://patches.dpdk.org/api/users/2642/?format=api", "username": "mcoquelin", "first_name": "Maxime", "last_name": "Coquelin", "email": "maxime.coquelin@redhat.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20231106171601.160749-18-juraj.linkes@pantheon.tech/mbox/", "series": [ { "id": 30173, "url": "http://patches.dpdk.org/api/series/30173/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30173", "date": "2023-11-06T17:15:38", "name": "dts: add dts api docs", "version": 5, "mbox": "http://patches.dpdk.org/series/30173/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/133918/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/133918/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 05FA0432BB;\n\tMon, 6 Nov 2023 18:18:31 +0100 (CET)", "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 9EE9B42DA7;\n\tMon, 6 Nov 2023 18:16:31 +0100 (CET)", "from mail-ej1-f49.google.com (mail-ej1-f49.google.com\n [209.85.218.49]) by mails.dpdk.org (Postfix) with ESMTP id 6DD0442D3F\n for <dev@dpdk.org>; Mon, 6 Nov 2023 18:16:28 +0100 (CET)", "by mail-ej1-f49.google.com with SMTP id\n a640c23a62f3a-9dbb3d12aefso676798566b.0\n for <dev@dpdk.org>; Mon, 06 Nov 2023 09:16:28 -0800 (PST)", "from jlinkes-PT-Latitude-5530.. (ip-46.34.243.197.o2inet.sk.\n [46.34.243.197]) by smtp.gmail.com with ESMTPSA id\n s10-20020a170906354a00b009b947aacb4bsm47016eja.191.2023.11.06.09.16.26\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 06 Nov 2023 09:16:27 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=pantheon.tech; s=google; t=1699290988; x=1699895788; darn=dpdk.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=NUm7xMiT/BRHjWTmLVv9u7rEe8Sqswv+nKyJJdnT3gQ=;\n b=B0teg2IKd/Lp9uzo116X4/hm73lCFOART6Uml6MqDpYUzHZneywyCtOZKHUbtmxf+I\n Q6p+F8XYXP/UPomNzd/bff79nGXA5sJvnKiqfeirezhxPqrJP3zs3w4Mv6zsMnW5VeTp\n FJLCbwJmLjq5U5S2Kr48R8WHkM2y7/qZEE6YSQEqM6Thg6kUu0NrMmUQNyKHNSYVLWQt\n A41zU5KbrP7cmYxTwxX6d4JHebPO0DJER7++Tnk09qVcQYJXrtUzBwqg/8NEWfaNNvdy\n UBnzowllKX4OSDaL75jtTWYwFp2b4/G+8/qEHdAws9gUzjGrOhKzNZQIi6M7vrgRx4kJ\n C3tQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1699290988; x=1699895788;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=NUm7xMiT/BRHjWTmLVv9u7rEe8Sqswv+nKyJJdnT3gQ=;\n b=tYxnDXZjsrHjfKgXKZH+fNp4yURI2Oi70hoDGHCDGK9FGYicUEzF9cIRrwZ2HFb5Ji\n AZSXW5hsV5i6qHOU592An1bvab7gmxPSB8EsJFLBn5YM2+8+TPPJvJDp8UnJp58ZUGkF\n ovnLD8b3oFOvQKQwhzPHzsD4vL11yZ6shLwpXUK2noNfPH7EpLYz/FUi1Rm0+jl20yFm\n hOm0SJnqYX3D6NiOg+dc14ogasfbkwIu8+bs3I9YBhatRvrTLeC0CwpUQm6wrchAkfJn\n QmiCZMewRwBitLrVxdyuGMRQs/hg3o/7DWrUN7DRD5BgonjhuprACejEHmySoRrHNAh7\n uXFQ==", "X-Gm-Message-State": "AOJu0YymjWjfQiuSm/InAHTmy83PkrZOowKS3tEURjFlCwbf/joskZlR\n z8lPmKhV5zxgdPBOZ/H09mjTuw==", "X-Google-Smtp-Source": "\n AGHT+IEi1+olSKT5i1zRua1hNp6bO2gkjvFs3F1Nakj+Om6+h9KZTnU3vPRf7+GDIpkofddcX3RjrQ==", "X-Received": "by 2002:a17:906:fd89:b0:9cd:26e9:a8ae with SMTP id\n xa9-20020a170906fd8900b009cd26e9a8aemr15862998ejb.42.1699290988035;\n Mon, 06 Nov 2023 09:16:28 -0800 (PST)", "From": "=?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>", "To": "thomas@monjalon.net, Honnappa.Nagarahalli@arm.com,\n bruce.richardson@intel.com, jspewock@iol.unh.edu, probb@iol.unh.edu,\n paul.szczepanek@arm.com, yoan.picchi@foss.arm.com", "Cc": "dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>", "Subject": "[PATCH v5 17/23] dts: node docstring update", "Date": "Mon, 6 Nov 2023 18:15:55 +0100", "Message-Id": "<20231106171601.160749-18-juraj.linkes@pantheon.tech>", "X-Mailer": "git-send-email 2.34.1", "In-Reply-To": "<20231106171601.160749-1-juraj.linkes@pantheon.tech>", "References": "<20230831100407.59865-1-juraj.linkes@pantheon.tech>\n <20231106171601.160749-1-juraj.linkes@pantheon.tech>", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=UTF-8", "Content-Transfer-Encoding": "8bit", "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>,\n <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>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org" }, "content": "Format according to the Google format and PEP257, with slight\ndeviations.\n\nSigned-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>\n---\n dts/framework/testbed_model/node.py | 191 +++++++++++++++++++---------\n 1 file changed, 131 insertions(+), 60 deletions(-)", "diff": "diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py\nindex 7571e7b98d..abf86793a7 100644\n--- a/dts/framework/testbed_model/node.py\n+++ b/dts/framework/testbed_model/node.py\n@@ -3,8 +3,13 @@\n # Copyright(c) 2022-2023 PANTHEON.tech s.r.o.\n # Copyright(c) 2022-2023 University of New Hampshire\n \n-\"\"\"\n-A node is a generic host that DTS connects to and manages.\n+\"\"\"Common functionality for node management.\n+\n+A node is any host/server DTS connects to.\n+\n+The base class, :class:`Node`, provides functionality common to all nodes and is supposed\n+to be extended by subclasses with functionality specific to each node type.\n+The decorator :func:`Node.skip_setup` can be used without subclassing.\n \"\"\"\n \n from abc import ABC\n@@ -35,10 +40,22 @@\n \n \n class Node(ABC):\n- \"\"\"\n- Basic class for node management. This class implements methods that\n- manage a node, such as information gathering (of CPU/PCI/NIC) and\n- environment setup.\n+ \"\"\"The base class for node management.\n+\n+ It shouldn't be instantiated, but rather subclassed.\n+ It implements common methods to manage any node:\n+\n+ * Connection to the node,\n+ * Hugepages setup.\n+\n+ Attributes:\n+ main_session: The primary OS-aware remote session used to communicate with the node.\n+ config: The node configuration.\n+ name: The name of the node.\n+ lcores: The list of logical cores that DTS can use on the node.\n+ It's derived from logical cores present on the node and the test run configuration.\n+ ports: The ports of this node specified in the test run configuration.\n+ virtual_devices: The virtual devices used on the node.\n \"\"\"\n \n main_session: OSSession\n@@ -52,6 +69,17 @@ class Node(ABC):\n virtual_devices: list[VirtualDevice]\n \n def __init__(self, node_config: NodeConfiguration):\n+ \"\"\"Connect to the node and gather info during initialization.\n+\n+ Extra gathered information:\n+\n+ * The list of available logical CPUs. This is then filtered by\n+ the ``lcores`` configuration in the YAML test run configuration file,\n+ * Information about ports from the YAML test run configuration file.\n+\n+ Args:\n+ node_config: The node's test run configuration.\n+ \"\"\"\n self.config = node_config\n self.name = node_config.name\n self._logger = getLogger(self.name)\n@@ -60,7 +88,7 @@ def __init__(self, node_config: NodeConfiguration):\n self._logger.info(f\"Connected to node: {self.name}\")\n \n self._get_remote_cpus()\n- # filter the node lcores according to user config\n+ # filter the node lcores according to the test run configuration\n self.lcores = LogicalCoreListFilter(\n self.lcores, LogicalCoreList(self.config.lcores)\n ).filter()\n@@ -77,9 +105,14 @@ def _init_ports(self) -> None:\n self.configure_port_state(port)\n \n def set_up_execution(self, execution_config: ExecutionConfiguration) -> None:\n- \"\"\"\n- Perform the execution setup that will be done for each execution\n- this node is part of.\n+ \"\"\"Execution setup steps.\n+\n+ Configure hugepages and call :meth:`_set_up_execution` where\n+ the rest of the configuration steps (if any) are implemented.\n+\n+ Args:\n+ execution_config: The execution test run configuration according to which\n+ the setup steps will be taken.\n \"\"\"\n self._setup_hugepages()\n self._set_up_execution(execution_config)\n@@ -88,58 +121,74 @@ def set_up_execution(self, execution_config: ExecutionConfiguration) -> None:\n self.virtual_devices.append(VirtualDevice(vdev))\n \n def _set_up_execution(self, execution_config: ExecutionConfiguration) -> None:\n- \"\"\"\n- This method exists to be optionally overwritten by derived classes and\n- is not decorated so that the derived class doesn't have to use the decorator.\n+ \"\"\"Optional additional execution setup steps for subclasses.\n+\n+ Subclasses should override this if they need to add additional execution setup steps.\n \"\"\"\n \n def tear_down_execution(self) -> None:\n- \"\"\"\n- Perform the execution teardown that will be done after each execution\n- this node is part of concludes.\n+ \"\"\"Execution teardown steps.\n+\n+ There are currently no common execution teardown steps common to all DTS node types.\n \"\"\"\n self.virtual_devices = []\n self._tear_down_execution()\n \n def _tear_down_execution(self) -> None:\n- \"\"\"\n- This method exists to be optionally overwritten by derived classes and\n- is not decorated so that the derived class doesn't have to use the decorator.\n+ \"\"\"Optional additional execution teardown steps for subclasses.\n+\n+ Subclasses should override this if they need to add additional execution teardown steps.\n \"\"\"\n \n def set_up_build_target(\n self, build_target_config: BuildTargetConfiguration\n ) -> None:\n- \"\"\"\n- Perform the build target setup that will be done for each build target\n- tested on this node.\n+ \"\"\"Build target setup steps.\n+\n+ There are currently no common build target setup steps common to all DTS node types.\n+\n+ Args:\n+ build_target_config: The build target test run configuration according to which\n+ the setup steps will be taken.\n \"\"\"\n self._set_up_build_target(build_target_config)\n \n def _set_up_build_target(\n self, build_target_config: BuildTargetConfiguration\n ) -> None:\n- \"\"\"\n- This method exists to be optionally overwritten by derived classes and\n- is not decorated so that the derived class doesn't have to use the decorator.\n+ \"\"\"Optional additional build target setup steps for subclasses.\n+\n+ Subclasses should override this if they need to add additional build target setup steps.\n \"\"\"\n \n def tear_down_build_target(self) -> None:\n- \"\"\"\n- Perform the build target teardown that will be done after each build target\n- tested on this node.\n+ \"\"\"Build target teardown steps.\n+\n+ There are currently no common build target teardown steps common to all DTS node types.\n \"\"\"\n self._tear_down_build_target()\n \n def _tear_down_build_target(self) -> None:\n- \"\"\"\n- This method exists to be optionally overwritten by derived classes and\n- is not decorated so that the derived class doesn't have to use the decorator.\n+ \"\"\"Optional additional build target teardown steps for subclasses.\n+\n+ Subclasses should override this if they need to add additional build target teardown steps.\n \"\"\"\n \n def create_session(self, name: str) -> OSSession:\n- \"\"\"\n- Create and return a new OSSession tailored to the remote OS.\n+ \"\"\"Create and return a new OS-aware remote session.\n+\n+ The returned session won't be used by the node creating it. The session must be used by\n+ the caller. The session will be maintained for the entire lifecycle of the node object,\n+ at the end of which the session will be cleaned up automatically.\n+\n+ Note:\n+ Any number of these supplementary sessions may be created.\n+\n+ Args:\n+ name: The name of the session.\n+\n+ Returns:\n+ A new OS-aware remote session.\n \"\"\"\n session_name = f\"{self.name} {name}\"\n connection = create_session(\n@@ -157,19 +206,19 @@ def create_interactive_shell(\n privileged: bool = False,\n app_args: str = \"\",\n ) -> InteractiveShellType:\n- \"\"\"Create a handler for an interactive session.\n+ \"\"\"Factory for interactive session handlers.\n \n- Instantiate shell_cls according to the remote OS specifics.\n+ Instantiate `shell_cls` according to the remote OS specifics.\n \n Args:\n shell_cls: The class of the shell.\n- timeout: Timeout for reading output from the SSH channel. If you are\n- reading from the buffer and don't receive any data within the timeout\n- it will throw an error.\n+ timeout: Timeout for reading output from the SSH channel. If you are reading from\n+ the buffer and don't receive any data within the timeout it will throw an error.\n privileged: Whether to run the shell with administrative privileges.\n app_args: The arguments to be passed to the application.\n+\n Returns:\n- Instance of the desired interactive application.\n+ An instance of the desired interactive application shell.\n \"\"\"\n if not shell_cls.dpdk_app:\n shell_cls.path = self.main_session.join_remote_path(shell_cls.path)\n@@ -186,14 +235,22 @@ def filter_lcores(\n filter_specifier: LogicalCoreCount | LogicalCoreList,\n ascending: bool = True,\n ) -> list[LogicalCore]:\n- \"\"\"\n- Filter the LogicalCores found on the Node according to\n- a LogicalCoreCount or a LogicalCoreList.\n+ \"\"\"Filter the node's logical cores that DTS can use.\n+\n+ Logical cores that DTS can use are the ones that are present on the node, but filtered\n+ according to the test run configuration. The `filter_specifier` will filter cores from\n+ those logical cores.\n+\n+ Args:\n+ filter_specifier: Two different filters can be used, one that specifies the number\n+ of logical cores per core, cores per socket and the number of sockets,\n+ and another one that specifies a logical core list.\n+ ascending: If :data:`True`, use cores with the lowest numerical id first and continue\n+ in ascending order. If :data:`False`, start with the highest id and continue\n+ in descending order. This ordering affects which sockets to consider first as well.\n \n- If ascending is True, use cores with the lowest numerical id first\n- and continue in ascending order. If False, start with the highest\n- id and continue in descending order. This ordering affects which\n- sockets to consider first as well.\n+ Returns:\n+ The filtered logical cores.\n \"\"\"\n self._logger.debug(f\"Filtering {filter_specifier} from {self.lcores}.\")\n return lcore_filter(\n@@ -203,17 +260,14 @@ def filter_lcores(\n ).filter()\n \n def _get_remote_cpus(self) -> None:\n- \"\"\"\n- Scan CPUs in the remote OS and store a list of LogicalCores.\n- \"\"\"\n+ \"\"\"Scan CPUs in the remote OS and store a list of LogicalCores.\"\"\"\n self._logger.info(\"Getting CPU information.\")\n self.lcores = self.main_session.get_remote_cpus(self.config.use_first_core)\n \n def _setup_hugepages(self) -> None:\n- \"\"\"\n- Setup hugepages on the Node. Different architectures can supply different\n- amounts of memory for hugepages and numa-based hugepage allocation may need\n- to be considered.\n+ \"\"\"Setup hugepages on the node.\n+\n+ Configure the hugepages only if they're specified in the node's test run configuration.\n \"\"\"\n if self.config.hugepages:\n self.main_session.setup_hugepages(\n@@ -221,8 +275,11 @@ def _setup_hugepages(self) -> None:\n )\n \n def configure_port_state(self, port: Port, enable: bool = True) -> None:\n- \"\"\"\n- Enable/disable port.\n+ \"\"\"Enable/disable `port`.\n+\n+ Args:\n+ port: The port to enable/disable.\n+ enable: :data:`True` to enable, :data:`False` to disable.\n \"\"\"\n self.main_session.configure_port_state(port, enable)\n \n@@ -232,15 +289,17 @@ def configure_port_ip_address(\n port: Port,\n delete: bool = False,\n ) -> None:\n- \"\"\"\n- Configure the IP address of a port on this node.\n+ \"\"\"Add an IP address to `port` on this node.\n+\n+ Args:\n+ address: The IP address with mask in CIDR format. Can be either IPv4 or IPv6.\n+ port: The port to which to add the address.\n+ delete: If :data:`True`, will delete the address from the port instead of adding it.\n \"\"\"\n self.main_session.configure_port_ip_address(address, port, delete)\n \n def close(self) -> None:\n- \"\"\"\n- Close all connections and free other resources.\n- \"\"\"\n+ \"\"\"Close all connections and free other resources.\"\"\"\n if self.main_session:\n self.main_session.close()\n for session in self._other_sessions:\n@@ -249,6 +308,11 @@ def close(self) -> None:\n \n @staticmethod\n def skip_setup(func: Callable[..., Any]) -> Callable[..., Any]:\n+ \"\"\"Skip the decorated function.\n+\n+ The :option:`--skip-setup` command line argument and the :envvar:`DTS_SKIP_SETUP`\n+ environment variable enable the decorator.\n+ \"\"\"\n if SETTINGS.skip_setup:\n return lambda *args: None\n else:\n@@ -258,6 +322,13 @@ def skip_setup(func: Callable[..., Any]) -> Callable[..., Any]:\n def create_session(\n node_config: NodeConfiguration, name: str, logger: DTSLOG\n ) -> OSSession:\n+ \"\"\"Factory for OS-aware sessions.\n+\n+ Args:\n+ node_config: The test run configuration of the node to connect to.\n+ name: The name of the session.\n+ logger: The logger instance this session will use.\n+ \"\"\"\n match node_config.os:\n case OS.linux:\n return LinuxSession(node_config, name, logger)\n", "prefixes": [ "v5", "17/23" ] }{ "id": 133918, "url": "