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

Added python and system packages listing #430

Merged
merged 4 commits into from
Sep 1, 2023
Merged

Conversation

ArneTR
Copy link
Member

@ArneTR ArneTR commented Aug 16, 2023

@ribalba Can you please check if this works on Fedora.

I was not sure if I should do dnf list installed or rpm -qa.

Also I hacked it into a bash query, which I think is nicer than doing it in python. Or did you plan already for a mechanism to make that if/else smoother in Python?

Demo Run with data: https://metrics.green-coding.berlin/stats.html?id=7b635c8e-5dbc-4bc2-b2c5-99d373cce558

@ArneTR ArneTR requested a review from ribalba August 16, 2023 08:56
@github-actions

This comment was marked as outdated.

@github-actions

This comment was marked as off-topic.

@github-actions
Copy link

Eco-CI Output:

Label 🖥 avg. CPU utilization [%] 🔋 Total Energy [Joules] 🔌 avg. Power [Watts] Duration [Seconds]
Total Run 19.7275 2169.94 3.0823 712
Measurement #1 19.804 2169.94 3.0823 706

📈 Energy graph:

 
 6.84 ┤        ╭───╮                    ╭╮                                                  ╭╮            ╭──╮            ╭╮╭─╮    ╭──╮ ╭─╮
 6.35 ┤        │   │                    ││                                                 ╭╯│ ╭╮         │  ╰╮   ╭╮ ╭╮   │╰╯ ╰─╮  │  ╰╮│ │
 5.86 ┤        │   │                    ││               ╭╮  ╭─╮                          ╭╯ │ ││         │   │  ╭╯╰─╯│   │     ╰╮ │   ╰╯ │            ╭╮
 5.37 ┤      ╭─╯   │ ╭╮                ╭╯│              ╭╯╰╮ │ │                          │  │ │╰╮       ╭╯   │ ╭╯    │   │      │╭╯      │        ╭╮╭╮││                                                                                        ╭╮                                              ╭╮                                                            ╭╮                         ╭╮                                                                              ╭╮                                                                                                                                                       ╭╮                                                                                                ╭
 4.88 ┤      │     ╰╮│╰──╮╭────╮  ╭╮╭╮╭╯ ╰──────────╮╭──╯  ╰─╯ │ ╭──╮╭╮╭─╮ ╭─╮     ╭──╮ ╭─╯  ╰─╯ │ ╭╮╭╮  │    │ │     │   │      ││       │        │││││╰─╮                          ╭╮                     ╭╮                                   ││                                              ││                                              ╭╮          ╭╮││                         ││                        ╭╮                                                    ││                         ╭╮                          ╭╮                                                ╭╮                                 ╭╮           ││                          ╭╮                                         ╭╮                         │
 4.39 ┤     ╭╯      ╰╯   ╰╯    ╰──╯╰╯╰╯             ╰╯         │╭╯  ╰╯╰╯ ╰─╯ ╰╮    │  ╰─╯        ╰╮││││╭╮│    ╰─╯     │  ╭╯      ╰╯       │        │││╰╯  │                         ╭╯│         ╭╮          ││          ╭─╮          ╭─╮         ││           ╭╮         ╭─╮         ╭─╮         ││                      ╭╮                      │╰╮         ││││                       ╭╮││                      ╭╮││                       ╭─╮         ╭╮             ╭─╯│         ╭╮              ││         ╭╮               ││                          ╭╮         ╭╮         ││                                 │╰╮          ││╭╮            ╭─╮         ││                                      ╭──╯│                        ╭╯
 3.90 ┤     │                                                  ││             │    │              ╰╯╰╯││╰╯            │╭╮│                │       ╭╯╰╯    ╰╮        ╭─╮         ╭╮ ╭╯ │         │╰╮         │╰╮         │ ╰╮         │ │         │╰╮         ╭╯│         │ │         │ │         │╰╮         ╭─╮         │╰╮         ╭─╮         │ │         │╰╯╰╮                  ╭╮ ╭╯╰╯│                   ╭╮ │╰╯│                  ╭╮ ╭─╯ │        ╭╯│╭╮        ╭╮ │  │        ╭╯│         ╭╮ ╭─╯╰╮        ││╭╮        ╭╮ ╭─╯╰╮        ╭╮╭╮        ╭╮ ╭─╯│         ││         │╰╮          ╭╮         ╭╮         │ ╰╮        ╭╯╰╯│╭╮          │ │        ╭╯│            ╭─╮        ╭─╮           ╭╯   │        ╭─╮         ╭╮ ╭╯
 3.41 ┤    ╭╯                                                  ╰╯             │    │                  ││              ││││                ╰╮      │        │       ╭╯ ╰─╮       │╰╮│  │         │ │         │ │         │  │        ╭╯ │         │ ╰╮        │ │         │ │         │ │         │ ╰╮        │ │   ╭╮    │ │         │ │        ╭╯ │         │   │        ╭─╮       │╰╮│   │         ╭╮       ╭╯│╭╯  │         ╭╮       │╰╮│   │        │ │││       ╭╯│ │  │        │ │╭╮       │╰╮│   │       ╭╯╰╯│        │╰╮│   │       ╭╯╰╯╰╮       │╰╮│  │         ││         │ ╰╮        ╭╯│         ││         │  │        │   ╰╯│       ╭╮ │ │        │ │╭╮         ╭╯ │       ╭╯ ╰╮        ╭╮│    │        │ ╰╮        │╰╮│
 2.92 ┤    │                                                                  │    │                  ╰╯              ╰╯││                 │      │        │       │    │       │ ││  │         │ │        ╭╯ ╰╮        │  │        │  │         │  │        │ │         │ │         │ │         │  │     ╭╮ │ ╰╮  ││    │ │         │ │        │  │         │   │        │ │       │ ││   │         ││       │ ││   │        ╭╯│       │ ││   │       ╭╯ ╰╯│       │ │╭╯  │        │ ╰╯│       │ ││   │       │   ╰╮       │ ││   │       │    │       │ ││  │        ╭╯╰╮        │  │        │ │        ╭╯│         │  │       ╭╯     │       ││ │ ╰╮       │ │││       ╭╮│  │       │   ╰─╮      │││    │       ╭╯  ╰╮ ╭╮    │ ││
 2.43 ┼╮   │                                                                  │    │                                    ││                 │      │        │ ╭╮╭─╮ │    │       │ ││  ╰╮  ╭╮   ╭╯ │  ╭╮   ╭╯   │        │  ╰╮       │  │        ╭╯  │       ╭╯ │         │ │       ╭─╯ ╰─╮       │  │     ││╭╯  │ ╭╯│   ╭╯ │       ╭─╯ │        │  ╰╮       ╭╯   │   ╭╮  ╭╯ │       │ ││   │         ││       │ ││   │        │ │╭╮     │ ││   │ ╭╮    │    │   ╭╮  │ ╰╯   ╰╮╭╮     │   │    ╭╮ │ ││   │       │    │       │ ││   │       │    │       │ ││  │       ╭╯  │       ╭╯  │       ╭╯ │     ╭╮ │ │       ╭─╯  │     ╭╮│      │       │╰╮│  │       │ │││       │││  │ ╭╮    │     │      │││    │       │    │ ││    │ ││
 1.94 ┤╰───╯                                                                  ╰────╯                                    ╰╯                 ╰──────╯        ╰─╯╰╯ ╰─╯    ╰───────╯ ╰╯   ╰──╯╰───╯  ╰──╯╰───╯    ╰────────╯   ╰───────╯  ╰────────╯   ╰───────╯  ╰─────────╯ ╰───────╯     ╰───────╯  ╰─────╯╰╯   ╰─╯ ╰───╯  ╰───────╯   ╰────────╯   ╰───────╯    ╰───╯╰──╯  ╰───────╯ ╰╯   ╰─────────╯╰───────╯ ╰╯   ╰────────╯ ╰╯╰─────╯ ╰╯   ╰─╯╰────╯    ╰───╯╰──╯       ╰╯╰─────╯   ╰────╯╰─╯ ╰╯   ╰───────╯    ╰───────╯ ╰╯   ╰───────╯    ╰───────╯ ╰╯  ╰───────╯   ╰───────╯   ╰───────╯  ╰─────╯╰─╯ ╰───────╯    ╰─────╯╰╯      ╰───────╯ ╰╯  ╰───────╯ ╰╯╰───────╯╰╯  ╰─╯╰────╯     ╰──────╯╰╯    ╰───────╯    ╰─╯╰────╯ ╰╯
                                                                                                                                                                                                                                                                                                                                                               Watts over time

Copy link
Member

@ribalba ribalba left a comment

Choose a reason for hiding this comment

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

Works on fedora. The only thing is why are you using the | cat ?

@@ -77,6 +78,9 @@ def read_directory_recursive(directory):
[rpwr, 'Hardware Model', '/usr/bin/hostnamectl', r'Hardware Model:\s*(?P<o>.*)'],
[rpwr, 'Docker Info', 'docker info', r'(?P<o>.*)', re.IGNORECASE | re.DOTALL],
[rpwr, 'Docker Version', 'docker version', r'(?P<o>.*)', re.IGNORECASE | re.DOTALL],
[rpwr, 'Docker Containers', 'docker ps -a', r'(?P<o>.*)'],
[rpwr, 'Installed System Packages', 'if [ -f /etc/lsb-release ]; then dpkg -l | cat ; elif [ -f /etc/redhat-release ]; then dnf list installed | cat; fi', r'(?P<o>.*)', re.IGNORECASE | re.DOTALL],
Copy link
Member

Choose a reason for hiding this comment

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

Why are you using | cat here?

Copy link
Member Author

Choose a reason for hiding this comment

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

happy to take recommendations here. dpkg -l gives me an ncurses window when I call it unpiped. This is why I feed it to cat just to get an output.

This test was only on the command line actually. I did not test if the implied pipe to Python is sufficient. Will post an update

Copy link
Member

Choose a reason for hiding this comment

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

I didn't check the ubuntu one only the fedora command. Here you don't need the cat

@ArneTR ArneTR merged commit c6b842e into main Sep 1, 2023
@ArneTR ArneTR deleted the hardware-info-list-packages branch September 1, 2023 10:20
ArneTR added a commit that referenced this pull request Sep 4, 2023
* main:
  Added missing network-intercepts migration
  Schema checker improvements (#395)
  Bump fastapi from 0.103.0 to 0.103.1 (#448)
  Bump pytest from 7.4.0 to 7.4.1 (#449)
  Added python and system packages listing (#430)
  added workflow for building and pushing containers from docker/auxili… (#394)
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