You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "uranusjr (via GitHub)" <gi...@apache.org> on 2023/07/14 16:57:01 UTC
[GitHub] [airflow] uranusjr commented on a diff in pull request #32612: Add a test to catch regressions in cli run time
uranusjr commented on code in PR #32612:
URL: https://github.com/apache/airflow/pull/32612#discussion_r1263945074
##########
tests/cli/test_cli_parser.py:
##########
@@ -268,3 +269,13 @@ def test_invalid_choice_raises_for_export_format_in_db_export_archived_command(
f"--export-format: invalid choice: '{export_format}' "
"(choose from 'csv'), see help above.\n"
)
+
+ def test_cli_run_time(self):
+ setup_code = "import subprocess"
+ timing_code = 'subprocess.run(["airflow", "--help"])'
+ # Limit the number of samples otherwise the test will take a very long time
+ num_samples = 3
+ threshold = 3.5
+ timing_result = timeit.timeit(stmt=timing_code, number=num_samples, setup=setup_code) / num_samples
+ # Average run time of Airflow CLI should at least be within 3.5s
+ assert timing_result < threshold
Review Comment:
Each `airflow --help` currently takes more than three seconds? That’s bad.
##########
tests/cli/test_cli_parser.py:
##########
@@ -268,3 +269,13 @@ def test_invalid_choice_raises_for_export_format_in_db_export_archived_command(
f"--export-format: invalid choice: '{export_format}' "
"(choose from 'csv'), see help above.\n"
)
+
+ def test_cli_run_time(self):
+ setup_code = "import subprocess"
+ timing_code = 'subprocess.run(["airflow", "--help"])'
+ # Limit the number of samples otherwise the test will take a very long time
+ num_samples = 3
+ threshold = 3.5
+ timing_result = timeit.timeit(stmt=timing_code, number=num_samples, setup=setup_code) / num_samples
+ # Average run time of Airflow CLI should at least be within 3.5s
+ assert timing_result < threshold
Review Comment:
Each `airflow --help` currently takes more than three seconds? That’s bad.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org