Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

List tool improvements #255

Merged
merged 11 commits into from
Jan 19, 2024
Merged

Conversation

andlaus
Copy link
Member

@andlaus andlaus commented Jan 19, 2024

This pull request contains various improvements for the CLI tools, in particular for list. The motivation for this is that, albeit the new output is pretty, list did not work for some of my real-world datasets anymore and -- after I fixed these issues (cf 8b75587 and a008df6) -- it was about an order of magnitude slower than it used to be. Since this is a problem for my smoke testing script (which used to take about 60 seconds to complete and now took about 10 minutes), I added the --dump-database option to list. This prints everything that gets internalized in an as performant way as possible instead of the printing objects that are handled by the printing helper function in an as intuitive way as possible. (NB that these changes motivated #253 .)

Andreas Lauser <[email protected]>, on behalf of MBition GmbH.
Provider Information

... instead of just the names of the items.

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
for `list` the new `--dump-database` argument fills the gap (more or
less), for the other commands it is IMO not necessary because in their
present form, I cannot see their usefulness for non-interactive
scripts.

the `list` command's new `--dump-database` option is useful for
debugging purposes: it is about an order of magnitude faster than
`odxtools list -a $PDX_FILE`, and -- as a bonus -- it prints all
information that is internalized by the database object.

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
the reason is that `rich.print` is pretty slow...

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
it is `indent`, not `ident`!

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
also, print the identifying prefix of a service instead of trying to
encode a full request. (which can and does fail for other reasons than
not having all required parameters specified.)

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
... instead of trying to encode a complete request. (this can fail for
different reasons than not having specified all required parameters.)

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
This code was hard to maintain, located in the wrong place, did not
work for quite a few edge cases, and finally a simple table of the
parameters is far more useful from a user's point of view IMO.

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
once all possible DOPs are implemented, this hack should become
unnecessary.

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
this tool suffered from a bit of bitrot...

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
@andlaus andlaus requested a review from kayoub5 January 19, 2024 10:44
@@ -172,7 +172,7 @@ def __str__(self) -> str:
return f"[{', '.join( [self._get_item_key(x) for x in self])}]"

def __repr__(self) -> str:
return self.__str__()
return f"[{', '.join([repr(x) for x in self])}]"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure to include class name
f"NamedItemList[{', '.join([repr(x) for x in self])}]"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed: 36d0fff

thanks to [at]kayoub5 for the suggestion!

Signed-off-by: Andreas Lauser <[email protected]>
Signed-off-by: Gerrit Ecke <[email protected]>
@andlaus andlaus merged commit 5b45927 into mercedes-benz:main Jan 19, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants