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

PMM Framework #37

Merged
merged 19 commits into from
Apr 3, 2024
Merged

PMM Framework #37

merged 19 commits into from
Apr 3, 2024

Conversation

saikumar-vs
Copy link

@saikumar-vs saikumar-vs commented Mar 5, 2024

  1. Moved pmm-framework related(required) files to qa-integration branch
  2. Added new pmm-framework python script wrapper
    Usage a) sudo -E ./pmm-framework.py --database "mysql=5.7,QUERY_SOURCE=perfschema,CLIENT_VERSION=3-dev-latest" --database "pdpgsql=16,USE_SOCKET=1,CLIENT_VERSION=3.0.0"
    b) sudo -E ./pmm-framework.py --v --database pgsql --database pdmysql

2) Add new pmm-framework python script wrapper
pmm_qa/pmm-framework.py Outdated Show resolved Hide resolved
pmm_qa/pmm-framework.py Outdated Show resolved Hide resolved
@yurkovychv yurkovychv changed the base branch from main to v3 March 7, 2024 12:54
@saikumar-vs saikumar-vs marked this pull request as ready for review March 11, 2024 07:00
pmm_qa/haproxy_setup.sh Show resolved Hide resolved
# Check if the container is in the list of running containers
# and establish N/W connection with it.
if container_name in running_containers:
subprocess.run(['docker', 'network', 'create', 'pmm-qa'])
Copy link
Member

Choose a reason for hiding this comment

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

I see we are still calling bash scripts from python, so a good question to ask is:

If python is only used to call bash scripts, is it even needed here? What is the value added?

Copy link
Collaborator

Choose a reason for hiding this comment

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

thanks Alex, it is a valid point but we are first aiming to port the main script to Python, it is a huge work to migrate everything to Python, so we have broken it down a bit, the base pmm-framework first and slowly setup's over time.

Copy link
Author

Choose a reason for hiding this comment

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

Alex thanks for your questions, below are some good reasons for considering Python,

Note: Most of our setups are Ansible based, and one main thing to keep in mind during our evaluation.

  1. Python comes with a comprehensive standard library that includes modules for working with files, subprocesses, JSON, YAML, and more

  2. Python's simple syntax and readability make it easy to learn and use, even for beginners. This makes Python a popular choice for automation tasks, including writing wrapper scripts for tools like Ansible.

  3. Python has a vast ecosystem of third-party libraries and frameworks that can be leveraged to enhance your Ansible wrapper script. For example, you can use libraries like click or argparse for command-line argument parsing, logging for advanced logging capabilities, multiprocessing to achieve parallelism.

Copy link
Member

@ademidoff ademidoff Apr 5, 2024

Choose a reason for hiding this comment

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

Hey, I'm getting the same output from the search engines :)

But seriously, why would I give parallelism as an argument, if this is the exact opposite of stable? I don't see us leverage parallelism anytime soon unless we want to make the code unmaintainable.

What did we miss from the bash scripts in the first place? And why do we need wrappers for Ansible? Can't we just run ansible like we always did, i.e. ansible-playbook book.yml? What do those wrappers bring?

If the ansible tasks I see in the code are simple shell calls with ignore_errors all over the place, then it's even a bigger issue, because 1) we don't follow ansible's best practices, and 2) we don't even need ansible to make such calls. If this is the only thing that ansible does, than it's definitely the wrong tool. It would take one line to do the same with a bash script.

Don't get me wrong, I'm also a big fan of python, but I truly believe that we used a cannon where a pistol would be good enough. IMO, it already smells a higher maintenance tax.

Copy link
Collaborator

@yurkovychv yurkovychv left a comment

Choose a reason for hiding this comment

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

Looks good
Just few minor comments

pmm_qa/pmm-framework.py Outdated Show resolved Hide resolved
pmm_qa/pmm-framework.py Outdated Show resolved Hide resolved
@saikumar-vs saikumar-vs merged commit d1704f6 into v3 Apr 3, 2024
2 of 3 checks passed
@saikumar-vs saikumar-vs deleted the PMM7-Framework branch April 3, 2024 05:55
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.

5 participants