get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/134577/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 134577,
    "url": "https://patches.dpdk.org/api/patches/134577/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/20231123151344.162812-12-juraj.linkes@pantheon.tech/",
    "project": {
        "id": 1,
        "url": "https://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": "<20231123151344.162812-12-juraj.linkes@pantheon.tech>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231123151344.162812-12-juraj.linkes@pantheon.tech",
    "date": "2023-11-23T15:13:34",
    "name": "[v8,11/21] dts: remote session docstring update",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "19c77671def2e273ada0349ff88dd95accef490a",
    "submitter": {
        "id": 1626,
        "url": "https://patches.dpdk.org/api/people/1626/?format=api",
        "name": "Juraj Linkeš",
        "email": "juraj.linkes@pantheon.tech"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/20231123151344.162812-12-juraj.linkes@pantheon.tech/mbox/",
    "series": [
        {
            "id": 30375,
            "url": "https://patches.dpdk.org/api/series/30375/?format=api",
            "web_url": "https://patches.dpdk.org/project/dpdk/list/?series=30375",
            "date": "2023-11-23T15:13:23",
            "name": "dts: docstrings update",
            "version": 8,
            "mbox": "https://patches.dpdk.org/series/30375/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/134577/comments/",
    "check": "success",
    "checks": "https://patches.dpdk.org/api/patches/134577/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 2AE74433AC;\n\tThu, 23 Nov 2023 16:15:29 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 4DDE243067;\n\tThu, 23 Nov 2023 16:14:09 +0100 (CET)",
            "from mail-wm1-f42.google.com (mail-wm1-f42.google.com\n [209.85.128.42]) by mails.dpdk.org (Postfix) with ESMTP id E27E942FB9\n for <dev@dpdk.org>; Thu, 23 Nov 2023 16:14:01 +0100 (CET)",
            "by mail-wm1-f42.google.com with SMTP id\n 5b1f17b1804b1-4083cd3917eso6267285e9.3\n for <dev@dpdk.org>; Thu, 23 Nov 2023 07:14:01 -0800 (PST)",
            "from jlinkes-PT-Latitude-5530.. ([84.245.121.10])\n by smtp.gmail.com with ESMTPSA id\n q4-20020adfea04000000b003296b488961sm1870143wrm.31.2023.11.23.07.13.59\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 23 Nov 2023 07:14:00 -0800 (PST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=pantheon.tech; s=google; t=1700752441; x=1701357241; 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=P0Nblz39VHMsl/sn7WugqAoH0RlFKnbia6lvcHGMAig=;\n b=TIxmYH2jyurT+oXl2/hsFSAIGm8C1jH5wePTEwSRUj916U5XsAymhP39gEtEnglQkw\n j4YWMq44lCFtdiXiVQWFhqAEdFpsb2ZfHtg7LiPFh2W5KDUzsAUel6HK0uTyqaEM36+J\n 4pvAyaL3wETpm6GqRUw/q2J6yqV2aui3I285HM7myRGnUpsgS5vdNZmtFaw1QJwWXhh/\n mH0b5pxduUy5ERyu4DSeWuYCqzGeGLd2cIv4xl5WtnIIc6oTij6XzuvMgeyX95Iqwwkj\n mP8/2Ff9/1sbygDKgSgCXqK7xuTWmVj+eoqIxGciiOr0+SbFzJIINYftTO0hIv3lusqx\n PDww==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1700752441; x=1701357241;\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=P0Nblz39VHMsl/sn7WugqAoH0RlFKnbia6lvcHGMAig=;\n b=v1gGFLx9JYKe/+QuxJ/HIt5D7md+9IaQklHvwRppdyX+GUMjJnoxwFrtElnbfr6TbK\n vp/EssQZXPtz8AoiCOcKQuEuawnlkecyyiTaYXcH7bHC1e9Gv9I5bN4XzcZ4gZBYC7Gu\n MBNepuTE93iEW/AY9MBUfzjat6jqMHqpfF9O2L7PXiSdhISSPzM33o93gD/2dmKEoiit\n 80WYLM/OScUT7Lv1/QFFR2w6Vdk5zwTSE1CjAkrbguLAUstwo6gxVsMhogt/cezY3bvQ\n eUFzDa9Ss+Z1Xm4Q/V8YbT9FRFeKxKSJxhgmqC2a7mwY8qhDkXSSz/QfA0ZCVwP+873s\n lmRQ==",
        "X-Gm-Message-State": "AOJu0YxiMyRrEeGJNu5o8xdQiodw5xYDIZdfjTuCyS7wc0mpwMtbIzPB\n szAEXJZM3Cv4k7BpAOEzj/NmFw==",
        "X-Google-Smtp-Source": "\n AGHT+IFwjiDvbuAMRWMP0KrUGm4xHQRIZS+4fwy2rPx9QPvIOwL2WXze0wh+ygvlD3vBTnxMXm26DA==",
        "X-Received": "by 2002:adf:a447:0:b0:32f:aaff:96dd with SMTP id\n e7-20020adfa447000000b0032faaff96ddmr3462509wra.4.1700752440614;\n Thu, 23 Nov 2023 07:14:00 -0800 (PST)",
        "From": "=?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>",
        "To": "thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, jspewock@iol.unh.edu,\n probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com,\n Luca.Vizzarro@arm.com",
        "Cc": "dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>",
        "Subject": "[PATCH v8 11/21] dts: remote session docstring update",
        "Date": "Thu, 23 Nov 2023 16:13:34 +0100",
        "Message-Id": "<20231123151344.162812-12-juraj.linkes@pantheon.tech>",
        "X-Mailer": "git-send-email 2.34.1",
        "In-Reply-To": "<20231123151344.162812-1-juraj.linkes@pantheon.tech>",
        "References": "<20231115130959.39420-1-juraj.linkes@pantheon.tech>\n <20231123151344.162812-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/remote_session/__init__.py      |  39 +++++-\n .../remote_session/remote_session.py          | 130 +++++++++++++-----\n dts/framework/remote_session/ssh_session.py   |  16 +--\n 3 files changed, 137 insertions(+), 48 deletions(-)",
    "diff": "diff --git a/dts/framework/remote_session/__init__.py b/dts/framework/remote_session/__init__.py\nindex 5e7ddb2b05..51a01d6b5e 100644\n--- a/dts/framework/remote_session/__init__.py\n+++ b/dts/framework/remote_session/__init__.py\n@@ -2,12 +2,14 @@\n # Copyright(c) 2023 PANTHEON.tech s.r.o.\n # Copyright(c) 2023 University of New Hampshire\n \n-\"\"\"\n-The package provides modules for managing remote connections to a remote host (node),\n-differentiated by OS.\n-The package provides a factory function, create_session, that returns the appropriate\n-remote connection based on the passed configuration. The differences are in the\n-underlying transport protocol (e.g. SSH) and remote OS (e.g. Linux).\n+\"\"\"Remote interactive and non-interactive sessions.\n+\n+This package provides modules for managing remote connections to a remote host (node).\n+\n+The non-interactive sessions send commands and return their output and exit code.\n+\n+The interactive sessions open an interactive shell which is continuously open,\n+allowing it to send and receive data within that particular shell.\n \"\"\"\n \n # pylama:ignore=W0611\n@@ -26,10 +28,35 @@\n def create_remote_session(\n     node_config: NodeConfiguration, name: str, logger: DTSLOG\n ) -> RemoteSession:\n+    \"\"\"Factory for non-interactive remote sessions.\n+\n+    The function returns an SSH session, but will be extended if support\n+    for other protocols is added.\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+    Returns:\n+        The SSH remote session.\n+    \"\"\"\n     return SSHSession(node_config, name, logger)\n \n \n def create_interactive_session(\n     node_config: NodeConfiguration, logger: DTSLOG\n ) -> InteractiveRemoteSession:\n+    \"\"\"Factory for interactive remote sessions.\n+\n+    The function returns an interactive SSH session, but will be extended if support\n+    for other protocols is added.\n+\n+    Args:\n+        node_config: The test run configuration of the node to connect to.\n+        logger: The logger instance this session will use.\n+\n+    Returns:\n+        The interactive SSH remote session.\n+    \"\"\"\n     return InteractiveRemoteSession(node_config, logger)\ndiff --git a/dts/framework/remote_session/remote_session.py b/dts/framework/remote_session/remote_session.py\nindex 719f7d1ef7..2059f9a981 100644\n--- a/dts/framework/remote_session/remote_session.py\n+++ b/dts/framework/remote_session/remote_session.py\n@@ -3,6 +3,13 @@\n # Copyright(c) 2022-2023 PANTHEON.tech s.r.o.\n # Copyright(c) 2022-2023 University of New Hampshire\n \n+\"\"\"Base remote session.\n+\n+This module contains the abstract base class for remote sessions and defines\n+the structure of the result of a command execution.\n+\"\"\"\n+\n+\n import dataclasses\n from abc import ABC, abstractmethod\n from pathlib import PurePath\n@@ -15,8 +22,14 @@\n \n @dataclasses.dataclass(slots=True, frozen=True)\n class CommandResult:\n-    \"\"\"\n-    The result of remote execution of a command.\n+    \"\"\"The result of remote execution of a command.\n+\n+    Attributes:\n+        name: The name of the session that executed the command.\n+        command: The executed command.\n+        stdout: The standard output the command produced.\n+        stderr: The standard error output the command produced.\n+        return_code: The return code the command exited with.\n     \"\"\"\n \n     name: str\n@@ -26,6 +39,7 @@ class CommandResult:\n     return_code: int\n \n     def __str__(self) -> str:\n+        \"\"\"Format the command outputs.\"\"\"\n         return (\n             f\"stdout: '{self.stdout}'\\n\"\n             f\"stderr: '{self.stderr}'\\n\"\n@@ -34,13 +48,24 @@ def __str__(self) -> str:\n \n \n class RemoteSession(ABC):\n-    \"\"\"\n-    The base class for defining which methods must be implemented in order to connect\n-    to a remote host (node) and maintain a remote session. The derived classes are\n-    supposed to implement/use some underlying transport protocol (e.g. SSH) to\n-    implement the methods. On top of that, it provides some basic services common to\n-    all derived classes, such as keeping history and logging what's being executed\n-    on the remote node.\n+    \"\"\"Non-interactive remote session.\n+\n+    The abstract methods must be implemented in order to connect to a remote host (node)\n+    and maintain a remote session.\n+    The subclasses must use (or implement) some underlying transport protocol (e.g. SSH)\n+    to implement the methods. On top of that, it provides some basic services common to all\n+    subclasses, such as keeping history and logging what's being executed on the remote node.\n+\n+    Attributes:\n+        name: The name of the session.\n+        hostname: The node's hostname. Could be an IP (possibly with port, separated by a colon)\n+            or a domain name.\n+        ip: The IP address of the node or a domain name, whichever was used in `hostname`.\n+        port: The port of the node, if given in `hostname`.\n+        username: The username used in the connection.\n+        password: The password used in the connection. Most frequently empty,\n+            as the use of passwords is discouraged.\n+        history: The executed commands during this session.\n     \"\"\"\n \n     name: str\n@@ -59,6 +84,16 @@ def __init__(\n         session_name: str,\n         logger: DTSLOG,\n     ):\n+        \"\"\"Connect to the node during initialization.\n+\n+        Args:\n+            node_config: The test run configuration of the node to connect to.\n+            session_name: The name of the session.\n+            logger: The logger instance this session will use.\n+\n+        Raises:\n+            SSHConnectionError: If the connection to the node was not successful.\n+        \"\"\"\n         self._node_config = node_config\n \n         self.name = session_name\n@@ -79,8 +114,13 @@ def __init__(\n \n     @abstractmethod\n     def _connect(self) -> None:\n-        \"\"\"\n-        Create connection to assigned node.\n+        \"\"\"Create a connection to the node.\n+\n+        The implementation must assign the established session to self.session.\n+\n+        The implementation must except all exceptions and convert them to an SSHConnectionError.\n+\n+        The implementation may optionally implement retry attempts.\n         \"\"\"\n \n     def send_command(\n@@ -90,11 +130,24 @@ def send_command(\n         verify: bool = False,\n         env: dict | None = None,\n     ) -> CommandResult:\n-        \"\"\"\n-        Send a command to the connected node using optional env vars\n-        and return CommandResult.\n-        If verify is True, check the return code of the executed command\n-        and raise a RemoteCommandExecutionError if the command failed.\n+        \"\"\"Send `command` to the connected node.\n+\n+        The :option:`--timeout` command line argument and the :envvar:`DTS_TIMEOUT`\n+        environment variable configure the timeout of command execution.\n+\n+        Args:\n+            command: The command to execute.\n+            timeout: Wait at most this long in seconds for `command` execution to complete.\n+            verify: If :data:`True`, will check the exit code of `command`.\n+            env: A dictionary with environment variables to be used with `command` execution.\n+\n+        Raises:\n+            SSHSessionDeadError: If the session isn't alive when sending `command`.\n+            SSHTimeoutError: If `command` execution timed out.\n+            RemoteCommandExecutionError: If verify is :data:`True` and `command` execution failed.\n+\n+        Returns:\n+            The output of the command along with the return code.\n         \"\"\"\n         self._logger.info(f\"Sending: '{command}'\" + (f\" with env vars: '{env}'\" if env else \"\"))\n         result = self._send_command(command, timeout, env)\n@@ -111,29 +164,38 @@ def send_command(\n \n     @abstractmethod\n     def _send_command(self, command: str, timeout: float, env: dict | None) -> CommandResult:\n-        \"\"\"\n-        Use the underlying protocol to execute the command using optional env vars\n-        and return CommandResult.\n+        \"\"\"Send a command to the connected node.\n+\n+        The implementation must execute the command remotely with `env` environment variables\n+        and return the result.\n+\n+        The implementation must except all exceptions and raise:\n+\n+            * SSHSessionDeadError if the session is not alive,\n+            * SSHTimeoutError if the command execution times out.\n         \"\"\"\n \n     def close(self, force: bool = False) -> None:\n-        \"\"\"\n-        Close the remote session and free all used resources.\n+        \"\"\"Close the remote session and free all used resources.\n+\n+        Args:\n+            force: Force the closure of the connection. This may not clean up all resources.\n         \"\"\"\n         self._logger.logger_exit()\n         self._close(force)\n \n     @abstractmethod\n     def _close(self, force: bool = False) -> None:\n-        \"\"\"\n-        Execute protocol specific steps needed to close the session properly.\n+        \"\"\"Protocol specific steps needed to close the session properly.\n+\n+        Args:\n+            force: Force the closure of the connection. This may not clean up all resources.\n+                This doesn't have to be implemented in the overloaded method.\n         \"\"\"\n \n     @abstractmethod\n     def is_alive(self) -> bool:\n-        \"\"\"\n-        Check whether the remote session is still responding.\n-        \"\"\"\n+        \"\"\"Check whether the remote session is still responding.\"\"\"\n \n     @abstractmethod\n     def copy_from(\n@@ -143,12 +205,12 @@ def copy_from(\n     ) -> None:\n         \"\"\"Copy a file from the remote Node to the local filesystem.\n \n-        Copy source_file from the remote Node associated with this remote\n-        session to destination_file on the local filesystem.\n+        Copy `source_file` from the remote Node associated with this remote session\n+        to `destination_file` on the local filesystem.\n \n         Args:\n-            source_file: the file on the remote Node.\n-            destination_file: a file or directory path on the local filesystem.\n+            source_file: The file on the remote Node.\n+            destination_file: A file or directory path on the local filesystem.\n         \"\"\"\n \n     @abstractmethod\n@@ -159,10 +221,10 @@ def copy_to(\n     ) -> None:\n         \"\"\"Copy a file from local filesystem to the remote Node.\n \n-        Copy source_file from local filesystem to destination_file\n-        on the remote Node associated with this remote session.\n+        Copy `source_file` from local filesystem to `destination_file` on the remote Node\n+        associated with this remote session.\n \n         Args:\n-            source_file: the file on the local filesystem.\n-            destination_file: a file or directory path on the remote Node.\n+            source_file: The file on the local filesystem.\n+            destination_file: A file or directory path on the remote Node.\n         \"\"\"\ndiff --git a/dts/framework/remote_session/ssh_session.py b/dts/framework/remote_session/ssh_session.py\nindex a467033a13..782220092c 100644\n--- a/dts/framework/remote_session/ssh_session.py\n+++ b/dts/framework/remote_session/ssh_session.py\n@@ -1,6 +1,8 @@\n # SPDX-License-Identifier: BSD-3-Clause\n # Copyright(c) 2023 PANTHEON.tech s.r.o.\n \n+\"\"\"SSH remote session.\"\"\"\n+\n import socket\n import traceback\n from pathlib import PurePath\n@@ -26,13 +28,8 @@\n class SSHSession(RemoteSession):\n     \"\"\"A persistent SSH connection to a remote Node.\n \n-    The connection is implemented with the Fabric Python library.\n-\n-    Args:\n-        node_config: The configuration of the Node to connect to.\n-        session_name: The name of the session.\n-        logger: The logger used for logging.\n-            This should be passed from the parent OSSession.\n+    The connection is implemented with\n+    `the Fabric Python library <https://docs.fabfile.org/en/latest/>`_.\n \n     Attributes:\n         session: The underlying Fabric SSH connection.\n@@ -78,6 +75,7 @@ def _connect(self) -> None:\n             raise SSHConnectionError(self.hostname, errors)\n \n     def is_alive(self) -> bool:\n+        \"\"\"Overrides :meth:`~.remote_session.RemoteSession.is_alive`.\"\"\"\n         return self.session.is_connected\n \n     def _send_command(self, command: str, timeout: float, env: dict | None) -> CommandResult:\n@@ -85,7 +83,7 @@ def _send_command(self, command: str, timeout: float, env: dict | None) -> Comma\n \n         Args:\n             command: The command to execute.\n-            timeout: Wait at most this many seconds for the execution to complete.\n+            timeout: Wait at most this long in seconds for the command execution to complete.\n             env: Extra environment variables that will be used in command execution.\n \n         Raises:\n@@ -110,6 +108,7 @@ def copy_from(\n         source_file: str | PurePath,\n         destination_file: str | PurePath,\n     ) -> None:\n+        \"\"\"Overrides :meth:`~.remote_session.RemoteSession.copy_from`.\"\"\"\n         self.session.get(str(destination_file), str(source_file))\n \n     def copy_to(\n@@ -117,6 +116,7 @@ def copy_to(\n         source_file: str | PurePath,\n         destination_file: str | PurePath,\n     ) -> None:\n+        \"\"\"Overrides :meth:`~.remote_session.RemoteSession.copy_to`.\"\"\"\n         self.session.put(str(source_file), str(destination_file))\n \n     def _close(self, force: bool = False) -> None:\n",
    "prefixes": [
        "v8",
        "11/21"
    ]
}