From: Jeremy Spewock <jspewock@iol.unh.edu>
To: "Juraj Linkeš" <juraj.linkes@pantheon.tech>
Cc: probb@iol.unh.edu, yoan.picchi@foss.arm.com, npratte@iol.unh.edu,
Honnappa.Nagarahalli@arm.com, wathsala.vithanage@arm.com,
paul.szczepanek@arm.com, Luca.Vizzarro@arm.com,
thomas@monjalon.net, dev@dpdk.org
Subject: Re: [PATCH v4 3/4] dts: add methods for modifying MTU to testpmd shell
Date: Thu, 20 Jun 2024 15:23:54 -0400 [thread overview]
Message-ID: <CAAA20USv1hZaGy4tgTmCXJqhqP=onrWxqjhWgdL=QB-+mtxPug@mail.gmail.com> (raw)
In-Reply-To: <dff89e16-0173-4069-878c-d1c34df1ae13@pantheon.tech>
On Wed, Jun 19, 2024 at 4:16 AM Juraj Linkeš <juraj.linkes@pantheon.tech> wrote:
>
>
> > +def stop_then_start_port_decorator(
>
> The name shouldn't contain "decorator". Just the docstring should
> mention it's a decorator.
Ack.
>
> > + func: Callable[["TestPmdShell", int, Any, bool], None]
>
> I'm thinking about this type. Sounds like there are too many conditions
> that need to be satisfied. The problem is with the verify parameter. Do
> we actually need it? If we're decorating a function, that may imply we
> always want to verify the port stop/start. In which circumstance we
> wouldn't want to verify that (the decorated function would need to not
> verify what it's doing, but what function would that be and would we
> actually want to not verify the port stop/start even then)?
I agree the parameter requirements are a little clunky and I played
with them for a while, but this one seemed the most "correct" to me.
We could create a policy that any method that is decorated with this
function must verify the port stopping and starting worked, but if we
did that I think you would have to also add to the policy that the
method being decorated must also always verify it was successful. I
don't think it makes sense to call a function and specify that you
don't want to verify success, and then still verify some component of
what the function is doing (starting and stopping ports in this case).
I think it would be fine to have this as a policy, but it's slightly
more limiting for users than other methods that testpmd shell offers.
I don't really know of an example when you wouldn't want to verify any
of the methods in TestpmdShell other than in case the developer is
expecting it to fail or it might not matter to the test if it was
successful or not for some reason. Considering we are already
following the path of optionally verifying all methods that can be
verified in the testpmd shell anyway, I didn't see the verify boolean
as anything extra for the methods to really have. We could instead
change to always verifying everything, but a change like that probably
doesn't fit the scope of this patch.
>
> The requirement of port_id is fine, as this only work with ports (so
> port_id must be somewhere among the parameters) and it being the first
> is also fine, but we should document it. A good place seems to be the
> class docstring, somewhere around "If there isn't one that satisfies a
> need, it should be added.".
That's a good point, I'll add some more notes about it.
>
> > +) -> Callable[["TestPmdShell", int, Any, bool], None]:
> > + """Decorator that stops a port, runs decorated function, then starts the port.
> > +
> > + The function being decorated must be a method defined in :class:`TestPmdShell` that takes a
> > + port ID (as an int) as its first parameter and has a "verify" parameter (as a bool) as its last
> > + parameter. The port ID and verify parameters will be passed into
> > + :meth:`TestPmdShell._stop_port` so that the correct port is stopped/started and verification
> > + takes place if desired.
> > +
> > + Args:
> > + func: The function to run while the port is stopped.
>
> The description of required argument should probably be here (maybe just
> here, but could also be above).
Ack.
>
> > +
> > + Returns:
> > + Wrapper function that stops a port, runs the decorated function, then starts the port.
>
> This would be the function that's already been wrapped, right?
I was trying to convey that this returns the function that wraps the
decorated function so I called it the "wrapper function", but maybe my
wording was a little confusing.
>
>
> > + def _start_port(self, port_id: int, verify: bool = True) -> None:
> > + """Start port `port_id` in testpmd.
>
> with `port_id`
Ack.
>
> > +
> > + Because the port may need to be stopped to make some configuration changes, it naturally
> > + follows that it will need to be started again once those changes have been made.
> > +
> > + Args:
> > + port_id: ID of the port to start.
> > + verify: If :data:`True` the output will be scanned in an attempt to verify that the
> > + port came back up without error. Defaults to True.
>
> The second True is not marked as :data: (also in the other method).
> A note on docstrings of private members: we don't need to be as detailed
> as these are not rendered. We should still provide some docs if those
> would be helpful for developers (but don't need to document everything
> for people using the API).
Right, I noticed that in some places they were less formal than others
and figured it was because they were private. I was sticking with the
general API layout regardless just as I felt it would be better to
have more information than necessary rather than less, but I'll keep
this in mind and not include some of the more redundant things like
the args in this case.
>
next prev parent reply other threads:[~2024-06-20 19:24 UTC|newest]
Thread overview: 79+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-14 20:14 [PATCH v1 0/4] Add second scatter test case jspewock
2024-05-14 20:14 ` [PATCH v1 1/4] dts: improve starting and stopping interactive shells jspewock
2024-05-20 17:17 ` Luca Vizzarro
2024-05-22 13:43 ` Patrick Robb
2024-05-14 20:14 ` [PATCH v1 2/4] dts: add context manager for " jspewock
2024-05-20 17:30 ` Luca Vizzarro
2024-05-29 20:37 ` Jeremy Spewock
2024-05-22 13:53 ` Patrick Robb
2024-05-29 20:37 ` Jeremy Spewock
2024-05-14 20:14 ` [PATCH v1 3/4] dts: add methods for modifying MTU to testpmd shell jspewock
2024-05-20 17:35 ` Luca Vizzarro
2024-05-29 20:38 ` Jeremy Spewock
2024-05-22 16:10 ` Patrick Robb
2024-05-14 20:14 ` [PATCH v1 4/4] dts: add test case that utilizes offload to pmd_buffer_scatter jspewock
2024-05-20 17:56 ` Luca Vizzarro
2024-05-29 20:40 ` Jeremy Spewock
2024-05-30 9:47 ` Luca Vizzarro
2024-05-30 16:33 ` [PATCH v2 0/4] Add second scatter test case jspewock
2024-05-30 16:33 ` [PATCH v2 1/4] dts: improve starting and stopping interactive shells jspewock
2024-05-31 16:37 ` Luca Vizzarro
2024-05-31 21:07 ` Jeremy Spewock
2024-05-30 16:33 ` [PATCH v2 2/4] dts: add context manager for " jspewock
2024-05-31 16:38 ` Luca Vizzarro
2024-05-30 16:33 ` [PATCH v2 3/4] dts: add methods for modifying MTU to testpmd shell jspewock
2024-05-31 16:34 ` Luca Vizzarro
2024-05-31 21:08 ` Jeremy Spewock
2024-06-10 14:35 ` Juraj Linkeš
2024-05-30 16:33 ` [PATCH v2 4/4] dts: add test case that utilizes offload to pmd_buffer_scatter jspewock
2024-05-31 16:33 ` Luca Vizzarro
2024-05-31 21:08 ` Jeremy Spewock
2024-06-05 21:31 ` [PATCH v3 0/4] Add second scatter test case jspewock
2024-06-05 21:31 ` [PATCH v3 1/4] dts: improve starting and stopping interactive shells jspewock
2024-06-10 13:36 ` Juraj Linkeš
2024-06-10 19:27 ` Jeremy Spewock
2024-06-05 21:31 ` [PATCH v3 2/4] dts: add context manager for " jspewock
2024-06-10 14:31 ` Juraj Linkeš
2024-06-10 20:06 ` Jeremy Spewock
2024-06-11 9:17 ` Juraj Linkeš
2024-06-11 15:33 ` Jeremy Spewock
2024-06-12 8:37 ` Juraj Linkeš
2024-06-05 21:31 ` [PATCH v3 3/4] dts: add methods for modifying MTU to testpmd shell jspewock
2024-06-10 15:03 ` Juraj Linkeš
2024-06-10 20:07 ` Jeremy Spewock
2024-06-05 21:31 ` [PATCH v3 4/4] dts: add test case that utilizes offload to pmd_buffer_scatter jspewock
2024-06-10 15:22 ` Juraj Linkeš
2024-06-10 20:08 ` Jeremy Spewock
2024-06-11 9:22 ` Juraj Linkeš
2024-06-11 15:33 ` Jeremy Spewock
2024-06-13 18:15 ` [PATCH v4 0/4] Add second scatter test case jspewock
2024-06-13 18:15 ` [PATCH v4 1/4] dts: add context manager for interactive shells jspewock
2024-06-18 15:47 ` Juraj Linkeš
2024-06-13 18:15 ` [PATCH v4 2/4] dts: improve starting and stopping " jspewock
2024-06-18 15:54 ` Juraj Linkeš
2024-06-18 16:47 ` Jeremy Spewock
2024-06-13 18:15 ` [PATCH v4 3/4] dts: add methods for modifying MTU to testpmd shell jspewock
2024-06-19 8:16 ` Juraj Linkeš
2024-06-20 19:23 ` Jeremy Spewock [this message]
2024-06-21 8:08 ` Juraj Linkeš
2024-06-13 18:15 ` [PATCH v4 4/4] dts: add test case that utilizes offload to pmd_buffer_scatter jspewock
2024-06-19 8:51 ` Juraj Linkeš
2024-06-20 19:24 ` Jeremy Spewock
2024-06-21 8:32 ` Juraj Linkeš
2024-06-25 16:27 ` [PATCH v5 0/4] Add second scatter test case jspewock
2024-06-25 16:27 ` [PATCH v5 1/4] dts: add context manager for interactive shells jspewock
2024-06-25 16:27 ` [PATCH v5 2/4] dts: improve starting and stopping " jspewock
2024-06-25 16:27 ` [PATCH v5 3/4] dts: add methods for modifying MTU to testpmd shell jspewock
2024-06-25 16:27 ` [PATCH v5 4/4] dts: add test case that utilizes offload to pmd_buffer_scatter jspewock
2024-06-28 17:32 ` [PATCH v6 0/4] Add second scatter test case jspewock
2024-06-28 17:32 ` [PATCH v6 1/4] dts: add context manager for interactive shells jspewock
2024-06-28 17:32 ` [PATCH v6 2/4] dts: improve starting and stopping " jspewock
2024-06-28 17:32 ` [PATCH v6 3/4] dts: add methods for modifying MTU to testpmd shell jspewock
2024-06-28 17:32 ` [PATCH v6 4/4] dts: add test case that utilizes offload to pmd_buffer_scatter jspewock
2024-07-09 17:53 ` [PATCH v7 0/2] Add second scatter test case jspewock
2024-07-09 17:53 ` [PATCH v7 1/2] dts: add methods for modifying MTU to testpmd shell jspewock
2024-08-20 13:05 ` Juraj Linkeš
2024-08-20 14:38 ` Jeremy Spewock
2024-07-09 17:53 ` [PATCH v7 2/2] dts: add test case that utilizes offload to pmd_buffer_scatter jspewock
2024-08-27 17:22 ` [PATCH v8 0/1] dts: add second scatter test case jspewock
2024-08-27 17:22 ` [PATCH v8 1/1] dts: add test case that utilizes offload to pmd_buffer_scatter jspewock
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAAA20USv1hZaGy4tgTmCXJqhqP=onrWxqjhWgdL=QB-+mtxPug@mail.gmail.com' \
--to=jspewock@iol.unh.edu \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=Luca.Vizzarro@arm.com \
--cc=dev@dpdk.org \
--cc=juraj.linkes@pantheon.tech \
--cc=npratte@iol.unh.edu \
--cc=paul.szczepanek@arm.com \
--cc=probb@iol.unh.edu \
--cc=thomas@monjalon.net \
--cc=wathsala.vithanage@arm.com \
--cc=yoan.picchi@foss.arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).