ShahriyarR / MySQL-AutoXtraBackup

MySQL-AutoXtraBackup commandline tool written in Python 3 based on Percona XtraBackup
https://autoxtrabackup.azepug.az/
MIT License
139 stars 79 forks source link

Added new --run-server argument; it will fire up the API server #437

Closed ShahriyarR closed 3 years ago

ShahriyarR commented 3 years ago

Fixed #436

autoxtrabackup --run-server
INFO:     Started server process [30238]
INFO:     Waiting for application startup.
app started
INFO:     Application startup complete.
INFO:     Uvicorn running on http://127.0.0.1:5555 (Press CTRL+C to quit)

The doc api is already there: doc_api

You can then curl with sample bash files:

$ curl -X POST http://127.0.0.1:5555/backup
{"result":"Successfully finished the backup process"}
sourcery-ai[bot] commented 3 years ago

Sourcery Code Quality Report

✅  Merging this PR will increase code quality in the affected files by 0.15%.

Quality metrics Before After Change
Complexity 6.49 ⭐ 6.52 ⭐ 0.03 👎
Method Length 66.80 🙂 65.67 🙂 -1.13 👍
Working memory 12.80 😞 12.94 😞 0.14 👎
Quality 62.42% 🙂 62.57% 🙂 0.15% 👍
Other metrics Before After Change
Lines 2598 2622 24
Changed files Quality Before Quality After Quality Change
docs/conf.py 74.02% 🙂 74.02% 🙂 0.00%
mysql_autoxtrabackup/autoxtrabackup.py 43.93% 😞 43.24% 😞 -0.69% 👎
mysql_autoxtrabackup/api/main.py 93.03% ⭐ 93.01% ⭐ -0.02% 👎
mysql_autoxtrabackup/api/controller/controller.py 83.57% ⭐ 83.88% ⭐ 0.31% 👍
mysql_autoxtrabackup/backup_backup/init.py % % %
mysql_autoxtrabackup/backup_backup/backup_archive.py 34.33% 😞 34.27% 😞 -0.06% 👎
mysql_autoxtrabackup/backup_backup/backup_builder.py 59.35% 🙂 59.35% 🙂 0.00%
mysql_autoxtrabackup/backup_backup/backuper.py 63.03% 🙂 63.03% 🙂 0.00%
mysql_autoxtrabackup/backup_prepare/copy_back.py 79.16% ⭐ 79.16% ⭐ 0.00%
mysql_autoxtrabackup/backup_prepare/prepare.py 48.36% 😞 48.36% 😞 0.00%
mysql_autoxtrabackup/backup_prepare/prepare_builder.py 68.96% 🙂 68.96% 🙂 0.00%
mysql_autoxtrabackup/general_conf/init.py % % %
mysql_autoxtrabackup/general_conf/check_env.py 78.20% ⭐ 78.20% ⭐ 0.00%
mysql_autoxtrabackup/general_conf/generalops.py 70.25% 🙂 70.25% 🙂 0.00%
mysql_autoxtrabackup/general_conf/generate_default_conf.py 55.05% 🙂 55.05% 🙂 0.00%
mysql_autoxtrabackup/general_conf/path_config.py 94.35% ⭐ 94.51% ⭐ 0.16% 👍
mysql_autoxtrabackup/process_runner/process_runner.py 66.25% 🙂 66.25% 🙂 0.00%
mysql_autoxtrabackup/utils/helpers.py 81.99% ⭐ 81.95% ⭐ -0.04% 👎
tests/conftest.py 100.00% ⭐ 100.00% ⭐ 0.00%

Here are some functions in these files that still need a tune-up:

File Function Complexity Length Working Memory Quality Recommendation
mysql_autoxtrabackup/autoxtrabackup.py all_procedure 26 😞 587 ⛔ 66 ⛔ 11.79% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
mysql_autoxtrabackup/backup_backup/backup_archive.py BackupArchive.create_backup_archives 30 😞 256 ⛔ 18 ⛔ 20.25% ⛔ Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
mysql_autoxtrabackup/backup_prepare/prepare.py Prepare.prepare_with_tags 20 😞 228 ⛔ 21 ⛔ 25.75% 😞 Refactor to reduce nesting. Try splitting into smaller methods. Extract out complex expressions
mysql_autoxtrabackup/backup_backup/backup_archive.py BackupArchive.clean_old_archives 13 🙂 146 😞 18 ⛔ 40.12% 😞 Try splitting into smaller methods. Extract out complex expressions
mysql_autoxtrabackup/backup_prepare/prepare.py Prepare.prepare_inc_full_backups 12 🙂 159 😞 16 ⛔ 41.49% 😞 Try splitting into smaller methods. Extract out complex expressions

Legend and Explanation

The emojis denote the absolute quality of the code:

The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request.


Please see our documentation here for details on how these metrics are calculated.

We are actively working on this report - lots more documentation and extra metrics to come!

Let us know what you think of it by mentioning @sourcery-ai in a comment.