You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by po...@apache.org on 2021/03/20 15:09:18 UTC

[airflow] branch master updated: Running tests in parallel (#14531)

This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new 5539069  Running tests in parallel (#14531)
5539069 is described below

commit 5539069ea5f70482fed3735640a1408e91fef4f2
Author: Jarek Potiuk <ja...@potiuk.com>
AuthorDate: Sat Mar 20 16:08:51 2021 +0100

    Running tests in parallel (#14531)
    
    This is by far the biggest improvements of the test execution time
    we can get now when we are using self-hosted runners.
    
    This change drives down the time of executing all tests on
    self-hosted runners from ~ 50 minutes to ~ 13 minutes due to heavy
    parallelisation we can implement for different test types and the
    fact that our machines for self-hosted runners are far more
    capable - they have more CPU, more memory and the fact that
    we are using tmpfs for everything.
    
    This change will also drive the cost of our self-hosted runners
    down. Since we have auto-scaling infrastructure we will simply need
    the machines to run tests for far shorter time. Since the number
    of test jobs we run on those self hosted runners is substantial
    (10 jobs), we are going to save ~ 6 build hours per one PR/merged
    commit!
    
    This also allows the developers to use the power of their
    development machines - when you use
    `./scripts/ci/testing/ci_run_airflow_testing.sh` the script
    detects how many CPU cores are available and it will run as
    many parallel test types as many cores you have.
    
    Also in case of Integration tests - they require more memory to run
    all the integrations, so in case there is less than ~ 32 GB of RAM
    available to Docker, the integration tests are run sequentially
    at the end. This drives stability up for machines with lower memory.
    
    On one personal PC (64GB RAM, 8 CPUS/16 cores, fast SSD) the full
    test suite execution went down from 30 minutes to 5 minutes.
    
    There is a continuous progress information printed every 10 seconds when
    either parallel or sequential tests are run, and the full output is
    shown at the end - failed tests are marked in red groups, and succesful are
    marked in green groups. This makes it easier to see and analyse errors.
---
 scripts/ci/images/ci_wait_for_ci_image.sh   |  2 +-
 scripts/ci/images/ci_wait_for_prod_image.sh |  2 +-
 scripts/ci/libraries/_build_images.sh       | 17 ++++++++++-------
 3 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/scripts/ci/images/ci_wait_for_ci_image.sh b/scripts/ci/images/ci_wait_for_ci_image.sh
index d75f149..11142f0 100755
--- a/scripts/ci/images/ci_wait_for_ci_image.sh
+++ b/scripts/ci/images/ci_wait_for_ci_image.sh
@@ -20,7 +20,7 @@
 
 push_pull_remove_images::check_if_github_registry_wait_for_image_enabled
 
-build_image::configure_github_docker_registry
+build_image::configure_docker_registry
 
 export AIRFLOW_CI_IMAGE_NAME="${BRANCH_NAME}-python${PYTHON_MAJOR_MINOR_VERSION}-ci"
 
diff --git a/scripts/ci/images/ci_wait_for_prod_image.sh b/scripts/ci/images/ci_wait_for_prod_image.sh
index 84cf481..ebb6a9b 100755
--- a/scripts/ci/images/ci_wait_for_prod_image.sh
+++ b/scripts/ci/images/ci_wait_for_prod_image.sh
@@ -20,7 +20,7 @@
 
 push_pull_remove_images::check_if_github_registry_wait_for_image_enabled
 
-build_image::configure_github_docker_registry
+build_image::configure_docker_registry
 
 export AIRFLOW_PROD_IMAGE_NAME="${BRANCH_NAME}-python${PYTHON_MAJOR_MINOR_VERSION}"
 start_end::group_start "Waiting for ${AIRFLOW_PROD_IMAGE_NAME} image to appear"
diff --git a/scripts/ci/libraries/_build_images.sh b/scripts/ci/libraries/_build_images.sh
index 8fe0983..fa11128 100644
--- a/scripts/ci/libraries/_build_images.sh
+++ b/scripts/ci/libraries/_build_images.sh
@@ -460,9 +460,9 @@ function build_images::get_docker_image_names() {
 # either GITHUB_TOKEN or CONTAINER_REGISTRY_TOKEN depending on the registry.
 # In case Personal Access token is not set, skip logging in
 # Also enable experimental features of docker (we need `docker manifest` command)
-function build_image::configure_github_docker_registry() {
+function build_image::configure_docker_registry() {
     if [[ ${USE_GITHUB_REGISTRY} == "true" ]]; then
-        start_end::group_start "Determine GitHub Registry token used and login if needed"
+        start_end::group_start "Determine GitHub Registry token"
         local token=""
         if [[ "${GITHUB_REGISTRY}" == "ghcr.io" ]]; then
             # For now ghcr.io can only authenticate using Personal Access Token with package access scope.
@@ -482,6 +482,8 @@ function build_image::configure_github_docker_registry() {
             echo
             exit 1
         fi
+        start_end::group_end
+        start_end::group_start "Logging in to GitHub Registry"
         if [[ -z "${token}" ]] ; then
             verbosity::print_info
             verbosity::print_info "Skip logging in to GitHub Registry. No Token available!"
@@ -495,13 +497,14 @@ function build_image::configure_github_docker_registry() {
         else
             verbosity::print_info "Skip Login to GitHub Registry ${GITHUB_REGISTRY} as token is missing"
         fi
-        verbosity::print_info "Make sure experimental docker features are enabled"
+        start_end::group_end
+
+        start_end::group_start "Make sure experimental docker features are enabled"
         local new_config
         new_config=$(jq '.experimental = "enabled"' "${HOME}/.docker/config.json")
         echo "${new_config}" > "${HOME}/.docker/config.json"
-        verbosity::print_info "Docker config after change:"
-        verbosity::print_info "${new_config}"
         start_end::group_end
+
     fi
 }
 
@@ -521,7 +524,7 @@ function build_images::prepare_ci_build() {
     export AIRFLOW_IMAGE="${AIRFLOW_CI_IMAGE}"
     readonly AIRFLOW_IMAGE
 
-    build_image::configure_github_docker_registry
+    build_image::configure_docker_registry
     sanity_checks::go_to_airflow_sources
     permissions::fix_group_permissions
 }
@@ -844,7 +847,7 @@ function build_images::prepare_prod_build() {
     export AIRFLOW_IMAGE="${AIRFLOW_PROD_IMAGE}"
     readonly AIRFLOW_IMAGE
 
-    build_image::configure_github_docker_registry
+    build_image::configure_docker_registry
     AIRFLOW_BRANCH_FOR_PYPI_PRELOADING="${BRANCH_NAME}"
     sanity_checks::go_to_airflow_sources
 }