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

Small CLI fixes #526

Merged
merged 9 commits into from Nov 10, 2022
Merged

Small CLI fixes #526

merged 9 commits into from Nov 10, 2022

Conversation

Flix6x
Copy link
Contributor

@Flix6x Flix6x commented Nov 1, 2022

This PR combines a bug fix with several tiny improvements to CLI functions, and the introduction of a developer util decorator.

The bug is this (reporting a successful flexmeasures db-ops dump when in fact it failed):

Backing up 127.0.0.1/flexmeasures-db database
/bin/sh: line 1: pg_dump: command not found
db dump successful: saved to pgbackup_flexmeasures-db_2022-11-01-1510.dump

Likewise for flexmeasures db-ops restore.

The timeit decorator can be added to to CLI functions (or any function, really) to print out the run time of that function. Is this something you'd consider adding as a default for all CLI commands?

Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x Flix6x added the bug Something isn't working label Nov 1, 2022
@Flix6x Flix6x self-assigned this Nov 1, 2022
Signed-off-by: F.N. Claessen <felix@seita.nl>
Signed-off-by: F.N. Claessen <felix@seita.nl>
@Flix6x Flix6x marked this pull request as ready for review November 1, 2022 14:19
@Flix6x Flix6x requested a review from nhoening November 1, 2022 14:19
@coveralls
Copy link
Collaborator

coveralls commented Nov 1, 2022

Pull Request Test Coverage Report for Build 3436497061

  • 4 of 17 (23.53%) changed or added relevant lines in 4 files are covered.
  • 3 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.02%) to 65.095%

Changes Missing Coverage Covered Lines Changed/Added Lines %
flexmeasures/cli/db_ops.py 0 2 0.0%
flexmeasures/cli/data_delete.py 1 4 25.0%
flexmeasures/utils/coding_utils.py 2 10 20.0%
Files with Coverage Reduction New Missed Lines %
flexmeasures/cli/data_delete.py 1 28.07%
flexmeasures/cli/db_ops.py 2 41.46%
Totals Coverage Status
Change from base Build 3436490383: -0.02%
Covered Lines: 6559
Relevant Lines: 9463

💛 - Coveralls

Copy link
Contributor

@nhoening nhoening left a comment

Choose a reason for hiding this comment

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

Great.

I haven't decided if I want to add timeit to all commands. Actually, they take an embarrassingly long time (due to Flask's startup time, and maybe also timely beliefs). Not sure I want to know :)

@Flix6x Flix6x merged commit bfcdb98 into main Nov 10, 2022
@Flix6x Flix6x deleted the small-cli-fixes branch November 10, 2022 11:50
@Flix6x Flix6x added this to the 0.12.0 milestone Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CLI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants