From: Eli Uriegas Date: Wed, 1 Sep 2021 00:38:42 +0000 (-0700) Subject: .github: Consolidate linux setup / teardown (#64229) X-Git-Tag: accepted/tizen/8.0/unified/20231005.095509~538 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=23da90ab84d4fa6006e8f65e6d795d2016d37f3b;p=platform%2Fupstream%2Fpytorch.git .github: Consolidate linux setup / teardown (#64229) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/64229 Consolidates linux setup / teardown into easy to use jinja2 macros Signed-off-by: Eli Uriegas cc ezyang seemethere malfet walterddr lg20987 pytorch/pytorch-dev-infra Test Plan: Imported from OSS Reviewed By: zhouzhuojie, driazati Differential Revision: D30683810 Pulled By: seemethere fbshipit-source-id: 2578630df3e212fb79392a699090553baef44cc2 --- diff --git a/.github/scripts/display_ec2_information.sh b/.github/scripts/display_ec2_information.sh deleted file mode 100755 index be47418..0000000 --- a/.github/scripts/display_ec2_information.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -function get_ec2_metadata() { - # Pulled from instance metadata endpoint for EC2 - # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html - category=$1 - curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" -} - -echo "ami-id: $(get_ec2_metadata ami-id)" -echo "instance-id: $(get_ec2_metadata instance-id)" -echo "instance-type: $(get_ec2_metadata instance-type)" diff --git a/.github/templates/bazel_ci_workflow.yml.j2 b/.github/templates/bazel_ci_workflow.yml.j2 index e9907ed..7f9d523 100644 --- a/.github/templates/bazel_ci_workflow.yml.j2 +++ b/.github/templates/bazel_ci_workflow.yml.j2 @@ -31,21 +31,8 @@ on: NUM_TEST_SHARDS: !{{ num_test_shards }} CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }} steps: - - name: Log in to ECR - run: | - aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh - bash /tmp/ecr-login.sh - rm /tmp/ecr-login.sh - - name: Chown workspace - run: | - # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . - - name: Checkout PyTorch - uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 - with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list - submodules: recursive - !{{ common.display_ec2_information() }} + !{{ common.setup_ec2_linux() }} + !{{ common.checkout_pytorch("recursive") }} - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" @@ -158,9 +145,5 @@ on: path: test-reports-*.zip !{{ common.upload_test_statistics(build_environment) }} - - name: Clean up docker images - if: always() - run: | - # Prune all of the docker images - docker system prune -af + !{{ common.teardown_ec2_linux() }} {%- endblock %} diff --git a/.github/templates/common.yml.j2 b/.github/templates/common.yml.j2 index bf72898..f9296e0 100644 --- a/.github/templates/common.yml.j2 +++ b/.github/templates/common.yml.j2 @@ -2,7 +2,16 @@ - name: Display EC2 information shell: bash run: | - .github/scripts/display_ec2_information.sh + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" {%- endmacro -%} {%- macro parse_ref() -%} @@ -29,3 +38,59 @@ python3 -m pip install boto3==1.16.34 python3 -m tools.stats.print_test_stats --upload-to-s3 --compare-with-s3 test {%- endmacro -%} + +{%- macro setup_ec2_linux() -%} + !{{ display_ec2_information() }} + - name: Log in to ECR + run: | + aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh + bash /tmp/ecr-login.sh + rm /tmp/ecr-login.sh + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + - name: Clean workspace + run: | + rm -rf "${GITHUB_WORKSPACE:?}/*" + rm -f ~/.ssh/authorized_keys + - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" + uses: seemethere/add-github-ssh-key@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" +{%- endmacro -%} + +{%- macro teardown_ec2_linux() -%} + - name: Hold runner for 2 hours or until ssh sessions have drained + # Always hold for active ssh sessions + if: always() + run: .github/scripts/wait_for_ssh_to_drain.sh + - name: Kill containers, clean up images + if: always() + run: | + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true + # Prune all of the docker images + docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . +{%- endmacro -%} + +{%- macro checkout_pytorch(submodules) -%} + - name: Checkout PyTorch + uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 + with: + # deep clone, to allow use of git merge-base + fetch-depth: 0 + submodules: !{{ submodules }} +{%- endmacro -%} diff --git a/.github/templates/linux_ci_workflow.yml.j2 b/.github/templates/linux_ci_workflow.yml.j2 index d5de86b..49b6d7d 100644 --- a/.github/templates/linux_ci_workflow.yml.j2 +++ b/.github/templates/linux_ci_workflow.yml.j2 @@ -72,25 +72,8 @@ jobs: outputs: docker_image: ${{ steps.calculate-tag.outputs.docker_image }} steps: - - name: Log in to ECR - run: | - aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh - bash /tmp/ecr-login.sh - rm /tmp/ecr-login.sh - - name: Chown workspace - run: | - # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . - - name: Clean workspace - run: | - rm -rf "${GITHUB_WORKSPACE:?}/*" - rm -f ~/.ssh/authorized_keys - - name: Checkout PyTorch - uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 - with: - # deep clone, to allow use of git merge-base - fetch-depth: 0 - !{{ common.display_ec2_information() }} + !{{ common.setup_ec2_linux() }} + !{{ common.checkout_pytorch("false") }} - name: Calculate docker image tag id: calculate-tag run: | @@ -145,35 +128,11 @@ jobs: DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }} JOB_BASE_NAME: !{{ build_environment }}-build steps: - - name: Log in to ECR - run: | - aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh - bash /tmp/ecr-login.sh - rm /tmp/ecr-login.sh - - name: Chown workspace - run: | - # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . - - name: Clean workspace - run: | - rm -rf "${GITHUB_WORKSPACE:?}/*" - rm -f ~/.ssh/authorized_keys - - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" - uses: seemethere/add-github-ssh-key@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout PyTorch - uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 - with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list - submodules: recursive - !{{ common.display_ec2_information() }} + !{{ common.setup_ec2_linux() }} + !{{ common.checkout_pytorch("recursive") }} - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Build PyTorch run: | docker run \ @@ -228,6 +187,7 @@ jobs: path: artifacts.zip {%- endif %} + !{{ common.teardown_ec2_linux() }} - name: Hold runner for 2 hours or until ssh sessions have drained # Always hold for active ssh sessions if: always() @@ -290,29 +250,8 @@ jobs: PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }} CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }} steps: - - name: Log in to ECR - run: | - aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh - bash /tmp/ecr-login.sh - rm /tmp/ecr-login.sh - - name: Chown workspace - run: | - # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)/../":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . - - name: Clean workspace - run: | - rm -rf "${GITHUB_WORKSPACE:?}/*" - rm -f ~/.ssh/authorized_keys - - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" - uses: seemethere/add-github-ssh-key@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout PyTorch - uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 - with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list - submodules: recursive - !{{ common.display_ec2_information() }} + !{{ common.setup_ec2_linux() }} + !{{ common.checkout_pytorch("recursive") }} - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" @@ -343,9 +282,6 @@ jobs: - name: Output disk space left run: | sudo df -H - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Test PyTorch env: PR_NUMBER: ${{ github.event.pull_request.number }} @@ -428,17 +364,7 @@ jobs: test-reports-*.zip !{{ common.parse_ref() }} !{{ common.upload_test_statistics(build_environment) }} - - name: Hold runner for 2 hours or until ssh sessions have drained - # Always hold for active ssh sessions - if: always() - run: .github/scripts/wait_for_ssh_to_drain.sh - - name: Clean up docker images - if: always() - run: | - # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . - # Prune all of the docker images - docker system prune -af + !{{ common.teardown_ec2_linux() }} {% endblock %} {%- endif -%} {%- if enable_doc_jobs %} @@ -452,35 +378,11 @@ jobs: DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }} DOCS_TYPE: ${{ matrix.docs_type }} steps: - - name: Log in to ECR - run: | - aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh - bash /tmp/ecr-login.sh - rm /tmp/ecr-login.sh - - name: Chown workspace - run: | - # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . - - name: Clean workspace - run: | - rm -rf "${GITHUB_WORKSPACE:?}/*" - rm -f ~/.ssh/authorized_keys - - name: "[FB EMPLOYEES] Enables SSH (Click me for login details)" - uses: seemethere/add-github-ssh-key@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Checkout PyTorch - uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 - with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list - submodules: recursive - !{{ common.display_ec2_information() }} + !{{ common.setup_ec2_linux() }} + !{{ common.checkout_pytorch("recursive") }} - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - uses: seemethere/download-artifact-s3@0504774707cbc8603d7dca922e8026eb8bf3b47b name: Download PyTorch Build Artifacts with: @@ -542,13 +444,5 @@ jobs: name: docs_${{ matrix.docs_type }} path: docs_${{ matrix.docs_type }}.zip if-no-files-found: error - - name: Hold runner for 2 hours or until ssh sessions have drained - # Always hold for active ssh sessions - if: always() - run: .github/scripts/wait_for_ssh_to_drain.sh - - name: Clean up docker images - if: always() - run: | - # Prune all of the docker images - docker system prune -af + !{{ common.teardown_ec2_linux() }} {%- endif -%} diff --git a/.github/workflows/generated-libtorch-linux-xenial-cuda10.2-py3.6-gcc7.yml b/.github/workflows/generated-libtorch-linux-xenial-cuda10.2-py3.6-gcc7.yml index 27b21bc..e621bee 100644 --- a/.github/workflows/generated-libtorch-linux-xenial-cuda10.2-py3.6-gcc7.yml +++ b/.github/workflows/generated-libtorch-linux-xenial-cuda10.2-py3.6-gcc7.yml @@ -46,12 +46,27 @@ jobs: outputs: docker_image: ${{ steps.calculate-tag.outputs.docker_image }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -59,15 +74,19 @@ jobs: run: | rm -rf "${GITHUB_WORKSPACE:?}/*" rm -f ~/.ssh/authorized_keys + - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" + uses: seemethere/add-github-ssh-key@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: # deep clone, to allow use of git merge-base fetch-depth: 0 - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh + submodules: false - name: Calculate docker image tag id: calculate-tag run: | @@ -122,12 +141,27 @@ jobs: DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }} JOB_BASE_NAME: libtorch-linux-xenial-cuda10.2-py3.6-gcc7-build steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -139,21 +173,18 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Build PyTorch run: | docker run \ @@ -201,6 +232,24 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh + - name: Kill containers, clean up images + if: always() + run: | + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true + # Prune all of the docker images + docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + - name: Hold runner for 2 hours or until ssh sessions have drained + # Always hold for active ssh sessions + if: always() + run: .github/scripts/wait_for_ssh_to_drain.sh - name: Clean up docker images if: always() run: | diff --git a/.github/workflows/generated-libtorch-linux-xenial-cuda11.3-py3.6-gcc7.yml b/.github/workflows/generated-libtorch-linux-xenial-cuda11.3-py3.6-gcc7.yml index b90a497..9daf916 100644 --- a/.github/workflows/generated-libtorch-linux-xenial-cuda11.3-py3.6-gcc7.yml +++ b/.github/workflows/generated-libtorch-linux-xenial-cuda11.3-py3.6-gcc7.yml @@ -46,12 +46,27 @@ jobs: outputs: docker_image: ${{ steps.calculate-tag.outputs.docker_image }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -59,15 +74,19 @@ jobs: run: | rm -rf "${GITHUB_WORKSPACE:?}/*" rm -f ~/.ssh/authorized_keys + - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" + uses: seemethere/add-github-ssh-key@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: # deep clone, to allow use of git merge-base fetch-depth: 0 - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh + submodules: false - name: Calculate docker image tag id: calculate-tag run: | @@ -122,12 +141,27 @@ jobs: DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }} JOB_BASE_NAME: libtorch-linux-xenial-cuda11.3-py3.6-gcc7-build steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -139,21 +173,18 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Build PyTorch run: | docker run \ @@ -201,6 +232,24 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh + - name: Kill containers, clean up images + if: always() + run: | + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true + # Prune all of the docker images + docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + - name: Hold runner for 2 hours or until ssh sessions have drained + # Always hold for active ssh sessions + if: always() + run: .github/scripts/wait_for_ssh_to_drain.sh - name: Clean up docker images if: always() run: | diff --git a/.github/workflows/generated-linux-bionic-cuda10.2-py3.9-gcc7.yml b/.github/workflows/generated-linux-bionic-cuda10.2-py3.9-gcc7.yml index 274e68e..4821c1e 100644 --- a/.github/workflows/generated-linux-bionic-cuda10.2-py3.9-gcc7.yml +++ b/.github/workflows/generated-linux-bionic-cuda10.2-py3.9-gcc7.yml @@ -46,12 +46,27 @@ jobs: outputs: docker_image: ${{ steps.calculate-tag.outputs.docker_image }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -59,15 +74,19 @@ jobs: run: | rm -rf "${GITHUB_WORKSPACE:?}/*" rm -f ~/.ssh/authorized_keys + - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" + uses: seemethere/add-github-ssh-key@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: # deep clone, to allow use of git merge-base fetch-depth: 0 - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh + submodules: false - name: Calculate docker image tag id: calculate-tag run: | @@ -122,12 +141,27 @@ jobs: DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }} JOB_BASE_NAME: linux-bionic-cuda10.2-py3.9-gcc7-build steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -139,21 +173,18 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Build PyTorch run: | docker run \ @@ -212,6 +243,24 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh + - name: Kill containers, clean up images + if: always() + run: | + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true + # Prune all of the docker images + docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + - name: Hold runner for 2 hours or until ssh sessions have drained + # Always hold for active ssh sessions + if: always() + run: .github/scripts/wait_for_ssh_to_drain.sh - name: Clean up docker images if: always() run: | @@ -266,15 +315,30 @@ jobs: PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }} CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)/../":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . - name: Clean workspace run: | rm -rf "${GITHUB_WORKSPACE:?}/*" @@ -283,15 +347,15 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" @@ -322,9 +386,6 @@ jobs: - name: Output disk space left run: | sudo df -H - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Test PyTorch env: PR_NUMBER: ${{ github.event.pull_request.number }} @@ -422,10 +483,17 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh - - name: Clean up docker images + - name: Kill containers, clean up images if: always() run: | - # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true # Prune all of the docker images docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . diff --git a/.github/workflows/generated-linux-bionic-py3.8-gcc9-coverage.yml b/.github/workflows/generated-linux-bionic-py3.8-gcc9-coverage.yml index e03a019..79edf0d 100644 --- a/.github/workflows/generated-linux-bionic-py3.8-gcc9-coverage.yml +++ b/.github/workflows/generated-linux-bionic-py3.8-gcc9-coverage.yml @@ -46,12 +46,27 @@ jobs: outputs: docker_image: ${{ steps.calculate-tag.outputs.docker_image }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -59,15 +74,19 @@ jobs: run: | rm -rf "${GITHUB_WORKSPACE:?}/*" rm -f ~/.ssh/authorized_keys + - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" + uses: seemethere/add-github-ssh-key@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: # deep clone, to allow use of git merge-base fetch-depth: 0 - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh + submodules: false - name: Calculate docker image tag id: calculate-tag run: | @@ -122,12 +141,27 @@ jobs: DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }} JOB_BASE_NAME: linux-bionic-py3.8-gcc9-coverage-build steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -139,21 +173,18 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Build PyTorch run: | docker run \ @@ -212,6 +243,24 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh + - name: Kill containers, clean up images + if: always() + run: | + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true + # Prune all of the docker images + docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + - name: Hold runner for 2 hours or until ssh sessions have drained + # Always hold for active ssh sessions + if: always() + run: .github/scripts/wait_for_ssh_to_drain.sh - name: Clean up docker images if: always() run: | @@ -266,15 +315,30 @@ jobs: PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }} CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)/../":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . - name: Clean workspace run: | rm -rf "${GITHUB_WORKSPACE:?}/*" @@ -283,15 +347,15 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" @@ -322,9 +386,6 @@ jobs: - name: Output disk space left run: | sudo df -H - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Test PyTorch env: PR_NUMBER: ${{ github.event.pull_request.number }} @@ -426,10 +487,17 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh - - name: Clean up docker images + - name: Kill containers, clean up images if: always() run: | - # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true # Prune all of the docker images docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . diff --git a/.github/workflows/generated-linux-xenial-cuda10.2-py3.6-gcc7.yml b/.github/workflows/generated-linux-xenial-cuda10.2-py3.6-gcc7.yml index 6aea843..316da36 100644 --- a/.github/workflows/generated-linux-xenial-cuda10.2-py3.6-gcc7.yml +++ b/.github/workflows/generated-linux-xenial-cuda10.2-py3.6-gcc7.yml @@ -46,12 +46,27 @@ jobs: outputs: docker_image: ${{ steps.calculate-tag.outputs.docker_image }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -59,15 +74,19 @@ jobs: run: | rm -rf "${GITHUB_WORKSPACE:?}/*" rm -f ~/.ssh/authorized_keys + - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" + uses: seemethere/add-github-ssh-key@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: # deep clone, to allow use of git merge-base fetch-depth: 0 - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh + submodules: false - name: Calculate docker image tag id: calculate-tag run: | @@ -122,12 +141,27 @@ jobs: DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }} JOB_BASE_NAME: linux-xenial-cuda10.2-py3.6-gcc7-build steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -139,21 +173,18 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Build PyTorch run: | docker run \ @@ -212,6 +243,24 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh + - name: Kill containers, clean up images + if: always() + run: | + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true + # Prune all of the docker images + docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + - name: Hold runner for 2 hours or until ssh sessions have drained + # Always hold for active ssh sessions + if: always() + run: .github/scripts/wait_for_ssh_to_drain.sh - name: Clean up docker images if: always() run: | @@ -266,15 +315,30 @@ jobs: PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }} CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)/../":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . - name: Clean workspace run: | rm -rf "${GITHUB_WORKSPACE:?}/*" @@ -283,15 +347,15 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" @@ -322,9 +386,6 @@ jobs: - name: Output disk space left run: | sudo df -H - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Test PyTorch env: PR_NUMBER: ${{ github.event.pull_request.number }} @@ -422,10 +483,17 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh - - name: Clean up docker images + - name: Kill containers, clean up images if: always() run: | - # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true # Prune all of the docker images docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . diff --git a/.github/workflows/generated-linux-xenial-cuda11.3-py3.6-gcc7.yml b/.github/workflows/generated-linux-xenial-cuda11.3-py3.6-gcc7.yml index 1fdae9d..6c9e67d 100644 --- a/.github/workflows/generated-linux-xenial-cuda11.3-py3.6-gcc7.yml +++ b/.github/workflows/generated-linux-xenial-cuda11.3-py3.6-gcc7.yml @@ -46,12 +46,27 @@ jobs: outputs: docker_image: ${{ steps.calculate-tag.outputs.docker_image }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -59,15 +74,19 @@ jobs: run: | rm -rf "${GITHUB_WORKSPACE:?}/*" rm -f ~/.ssh/authorized_keys + - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" + uses: seemethere/add-github-ssh-key@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: # deep clone, to allow use of git merge-base fetch-depth: 0 - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh + submodules: false - name: Calculate docker image tag id: calculate-tag run: | @@ -122,12 +141,27 @@ jobs: DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }} JOB_BASE_NAME: linux-xenial-cuda11.3-py3.6-gcc7-build steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -139,21 +173,18 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Build PyTorch run: | docker run \ @@ -212,6 +243,24 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh + - name: Kill containers, clean up images + if: always() + run: | + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true + # Prune all of the docker images + docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + - name: Hold runner for 2 hours or until ssh sessions have drained + # Always hold for active ssh sessions + if: always() + run: .github/scripts/wait_for_ssh_to_drain.sh - name: Clean up docker images if: always() run: | @@ -266,15 +315,30 @@ jobs: PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }} CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)/../":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . - name: Clean workspace run: | rm -rf "${GITHUB_WORKSPACE:?}/*" @@ -283,15 +347,15 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" @@ -322,9 +386,6 @@ jobs: - name: Output disk space left run: | sudo df -H - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Test PyTorch env: PR_NUMBER: ${{ github.event.pull_request.number }} @@ -422,10 +483,17 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh - - name: Clean up docker images + - name: Kill containers, clean up images if: always() run: | - # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true # Prune all of the docker images docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . diff --git a/.github/workflows/generated-linux-xenial-py3.6-gcc5.4.yml b/.github/workflows/generated-linux-xenial-py3.6-gcc5.4.yml index e932b48..2337b4f 100644 --- a/.github/workflows/generated-linux-xenial-py3.6-gcc5.4.yml +++ b/.github/workflows/generated-linux-xenial-py3.6-gcc5.4.yml @@ -46,12 +46,27 @@ jobs: outputs: docker_image: ${{ steps.calculate-tag.outputs.docker_image }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -59,15 +74,19 @@ jobs: run: | rm -rf "${GITHUB_WORKSPACE:?}/*" rm -f ~/.ssh/authorized_keys + - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" + uses: seemethere/add-github-ssh-key@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: # deep clone, to allow use of git merge-base fetch-depth: 0 - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh + submodules: false - name: Calculate docker image tag id: calculate-tag run: | @@ -122,12 +141,27 @@ jobs: DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }} JOB_BASE_NAME: linux-xenial-py3.6-gcc5.4-build steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -139,21 +173,18 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Build PyTorch run: | docker run \ @@ -212,6 +243,24 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh + - name: Kill containers, clean up images + if: always() + run: | + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true + # Prune all of the docker images + docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + - name: Hold runner for 2 hours or until ssh sessions have drained + # Always hold for active ssh sessions + if: always() + run: .github/scripts/wait_for_ssh_to_drain.sh - name: Clean up docker images if: always() run: | @@ -266,15 +315,30 @@ jobs: PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }} CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)/../":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . - name: Clean workspace run: | rm -rf "${GITHUB_WORKSPACE:?}/*" @@ -283,15 +347,15 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" @@ -322,9 +386,6 @@ jobs: - name: Output disk space left run: | sudo df -H - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Test PyTorch env: PR_NUMBER: ${{ github.event.pull_request.number }} @@ -422,13 +483,20 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh - - name: Clean up docker images + - name: Kill containers, clean up images if: always() run: | - # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true # Prune all of the docker images docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . pytorch_doc_build: runs-on: linux.2xlarge @@ -440,12 +508,27 @@ jobs: DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }} DOCS_TYPE: ${{ matrix.docs_type }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -453,25 +536,22 @@ jobs: run: | rm -rf "${GITHUB_WORKSPACE:?}/*" rm -f ~/.ssh/authorized_keys - - name: "[FB EMPLOYEES] Enables SSH (Click me for login details)" + - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - uses: seemethere/download-artifact-s3@0504774707cbc8603d7dca922e8026eb8bf3b47b name: Download PyTorch Build Artifacts with: @@ -537,8 +617,17 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh - - name: Clean up docker images + - name: Kill containers, clean up images if: always() run: | + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true # Prune all of the docker images docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . diff --git a/.github/workflows/generated-linux-xenial-py3.6-gcc7-bazel-test.yml b/.github/workflows/generated-linux-xenial-py3.6-gcc7-bazel-test.yml index 89deda0..17dc3a6 100644 --- a/.github/workflows/generated-linux-xenial-py3.6-gcc7-bazel-test.yml +++ b/.github/workflows/generated-linux-xenial-py3.6-gcc7-bazel-test.yml @@ -46,12 +46,27 @@ jobs: outputs: docker_image: ${{ steps.calculate-tag.outputs.docker_image }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -59,15 +74,19 @@ jobs: run: | rm -rf "${GITHUB_WORKSPACE:?}/*" rm -f ~/.ssh/authorized_keys + - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" + uses: seemethere/add-github-ssh-key@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: # deep clone, to allow use of git merge-base fetch-depth: 0 - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh + submodules: false - name: Calculate docker image tag id: calculate-tag run: | @@ -125,24 +144,47 @@ jobs: NUM_TEST_SHARDS: 1 CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + - name: Clean workspace + run: | + rm -rf "${GITHUB_WORKSPACE:?}/*" + rm -f ~/.ssh/authorized_keys + - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" + uses: seemethere/add-github-ssh-key@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" @@ -272,8 +314,21 @@ jobs: python3 -m pip install -r requirements.txt python3 -m pip install boto3==1.16.34 python3 -m tools.stats.print_test_stats --upload-to-s3 --compare-with-s3 test - - name: Clean up docker images + - name: Hold runner for 2 hours or until ssh sessions have drained + # Always hold for active ssh sessions + if: always() + run: .github/scripts/wait_for_ssh_to_drain.sh + - name: Kill containers, clean up images if: always() run: | + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true # Prune all of the docker images docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . diff --git a/.github/workflows/generated-periodic-libtorch-linux-xenial-cuda11.1-py3.6-gcc7.yml b/.github/workflows/generated-periodic-libtorch-linux-xenial-cuda11.1-py3.6-gcc7.yml index 63b462a..2f5cab7 100644 --- a/.github/workflows/generated-periodic-libtorch-linux-xenial-cuda11.1-py3.6-gcc7.yml +++ b/.github/workflows/generated-periodic-libtorch-linux-xenial-cuda11.1-py3.6-gcc7.yml @@ -44,12 +44,27 @@ jobs: outputs: docker_image: ${{ steps.calculate-tag.outputs.docker_image }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -57,15 +72,19 @@ jobs: run: | rm -rf "${GITHUB_WORKSPACE:?}/*" rm -f ~/.ssh/authorized_keys + - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" + uses: seemethere/add-github-ssh-key@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: # deep clone, to allow use of git merge-base fetch-depth: 0 - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh + submodules: false - name: Calculate docker image tag id: calculate-tag run: | @@ -120,12 +139,27 @@ jobs: DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }} JOB_BASE_NAME: periodic-libtorch-linux-xenial-cuda11.1-py3.6-gcc7-build steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -137,21 +171,18 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Build PyTorch run: | docker run \ @@ -199,6 +230,24 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh + - name: Kill containers, clean up images + if: always() + run: | + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true + # Prune all of the docker images + docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + - name: Hold runner for 2 hours or until ssh sessions have drained + # Always hold for active ssh sessions + if: always() + run: .github/scripts/wait_for_ssh_to_drain.sh - name: Clean up docker images if: always() run: | diff --git a/.github/workflows/generated-periodic-linux-xenial-cuda11.1-py3.6-gcc7.yml b/.github/workflows/generated-periodic-linux-xenial-cuda11.1-py3.6-gcc7.yml index 768146e..8c81ab1 100644 --- a/.github/workflows/generated-periodic-linux-xenial-cuda11.1-py3.6-gcc7.yml +++ b/.github/workflows/generated-periodic-linux-xenial-cuda11.1-py3.6-gcc7.yml @@ -44,12 +44,27 @@ jobs: outputs: docker_image: ${{ steps.calculate-tag.outputs.docker_image }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -57,15 +72,19 @@ jobs: run: | rm -rf "${GITHUB_WORKSPACE:?}/*" rm -f ~/.ssh/authorized_keys + - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" + uses: seemethere/add-github-ssh-key@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: # deep clone, to allow use of git merge-base fetch-depth: 0 - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh + submodules: false - name: Calculate docker image tag id: calculate-tag run: | @@ -120,12 +139,27 @@ jobs: DOCKER_IMAGE: ${{ needs.calculate-docker-image.outputs.docker_image }} JOB_BASE_NAME: periodic-linux-xenial-cuda11.1-py3.6-gcc7-build steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . @@ -137,21 +171,18 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Build PyTorch run: | docker run \ @@ -210,6 +241,24 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh + - name: Kill containers, clean up images + if: always() + run: | + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true + # Prune all of the docker images + docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + - name: Hold runner for 2 hours or until ssh sessions have drained + # Always hold for active ssh sessions + if: always() + run: .github/scripts/wait_for_ssh_to_drain.sh - name: Clean up docker images if: always() run: | @@ -264,15 +313,30 @@ jobs: PYTORCH_IGNORE_DISABLED_ISSUES: ${{ needs.generate-test-matrix.outputs.ignore-disabled-issues }} CONTINUE_THROUGH_ERROR: ${{ github.repository_owner == 'pytorch' && (github.event_name == 'push' || github.event_name == 'schedule') }} steps: + - name: Display EC2 information + shell: bash + run: | + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Log in to ECR run: | aws ecr get-login --no-include-email --region us-east-1 > /tmp/ecr-login.sh bash /tmp/ecr-login.sh rm /tmp/ecr-login.sh - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" run: | # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)/../":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . - name: Clean workspace run: | rm -rf "${GITHUB_WORKSPACE:?}/*" @@ -281,15 +345,15 @@ jobs: uses: seemethere/add-github-ssh-key@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Preserve github env variables for use in docker + run: | + env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Checkout PyTorch uses: zhouzhuojie/checkout@05b13c9a0d21f08f6d5e64a1d5042246d13619d9 with: - fetch-depth: 0 # deep clone, to allow sharding to use git rev-list + # deep clone, to allow use of git merge-base + fetch-depth: 0 submodules: recursive - - name: Display EC2 information - shell: bash - run: | - .github/scripts/display_ec2_information.sh - name: Pull docker image run: | docker pull "${DOCKER_IMAGE}" @@ -320,9 +384,6 @@ jobs: - name: Output disk space left run: | sudo df -H - - name: Preserve github env variables for use in docker - run: | - env | grep '^GITHUB' > "/tmp/github_env_${GITHUB_RUN_ID}" - name: Test PyTorch env: PR_NUMBER: ${{ github.event.pull_request.number }} @@ -420,10 +481,17 @@ jobs: # Always hold for active ssh sessions if: always() run: .github/scripts/wait_for_ssh_to_drain.sh - - name: Clean up docker images + - name: Kill containers, clean up images if: always() run: | - # Ensure the working directory gets chowned back to the current user - docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . + # ignore expansion of "docker ps -q" since it could be empty + # shellcheck disable=SC2046 + docker stop $(docker ps -q) || true # Prune all of the docker images docker system prune -af + - name: Chown workspace + env: + ALPINE_IMAGE: "308535385114.dkr.ecr.us-east-1.amazonaws.com/tool/alpine" + run: | + # Ensure the working directory gets chowned back to the current user + docker run --rm -v "$(pwd)":/v -w /v "${ALPINE_IMAGE}" chown -R "$(id -u):$(id -g)" . diff --git a/.github/workflows/generated-periodic-win-vs2019-cuda11.1-py3.yml b/.github/workflows/generated-periodic-win-vs2019-cuda11.1-py3.yml index aaf2d26..306e93a 100644 --- a/.github/workflows/generated-periodic-win-vs2019-cuda11.1-py3.yml +++ b/.github/workflows/generated-periodic-win-vs2019-cuda11.1-py3.yml @@ -65,7 +65,16 @@ jobs: - name: Display EC2 information shell: bash run: | - .github/scripts/display_ec2_information.sh + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Install Visual Studio 2019 toolchain shell: powershell run: | @@ -178,7 +187,16 @@ jobs: - name: Display EC2 information shell: bash run: | - .github/scripts/display_ec2_information.sh + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" uses: seemethere/add-github-ssh-key@v1 with: diff --git a/.github/workflows/generated-win-vs2019-cpu-py3.yml b/.github/workflows/generated-win-vs2019-cpu-py3.yml index 08656c9..f79cad7 100644 --- a/.github/workflows/generated-win-vs2019-cpu-py3.yml +++ b/.github/workflows/generated-win-vs2019-cpu-py3.yml @@ -65,7 +65,16 @@ jobs: - name: Display EC2 information shell: bash run: | - .github/scripts/display_ec2_information.sh + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Install Visual Studio 2019 toolchain shell: powershell run: | @@ -170,7 +179,16 @@ jobs: - name: Display EC2 information shell: bash run: | - .github/scripts/display_ec2_information.sh + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" uses: seemethere/add-github-ssh-key@v1 with: diff --git a/.github/workflows/generated-win-vs2019-cuda10.1-py3.yml b/.github/workflows/generated-win-vs2019-cuda10.1-py3.yml index 2a8570d..35c6ced 100644 --- a/.github/workflows/generated-win-vs2019-cuda10.1-py3.yml +++ b/.github/workflows/generated-win-vs2019-cuda10.1-py3.yml @@ -67,7 +67,16 @@ jobs: - name: Display EC2 information shell: bash run: | - .github/scripts/display_ec2_information.sh + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Install Visual Studio 2019 toolchain shell: powershell run: | @@ -180,7 +189,16 @@ jobs: - name: Display EC2 information shell: bash run: | - .github/scripts/display_ec2_information.sh + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" uses: seemethere/add-github-ssh-key@v1 with: diff --git a/.github/workflows/generated-win-vs2019-cuda11.3-py3.yml b/.github/workflows/generated-win-vs2019-cuda11.3-py3.yml index 7235db7..4bfc565 100644 --- a/.github/workflows/generated-win-vs2019-cuda11.3-py3.yml +++ b/.github/workflows/generated-win-vs2019-cuda11.3-py3.yml @@ -67,7 +67,16 @@ jobs: - name: Display EC2 information shell: bash run: | - .github/scripts/display_ec2_information.sh + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: Install Visual Studio 2019 toolchain shell: powershell run: | @@ -180,7 +189,16 @@ jobs: - name: Display EC2 information shell: bash run: | - .github/scripts/display_ec2_information.sh + set -euo pipefail + function get_ec2_metadata() { + # Pulled from instance metadata endpoint for EC2 + # see https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instancedata-data-retrieval.html + category=$1 + curl -fsSL "http://169.254.169.254/latest/meta-data/${category}" + } + echo "ami-id: $(get_ec2_metadata ami-id)" + echo "instance-id: $(get_ec2_metadata instance-id)" + echo "instance-type: $(get_ec2_metadata instance-type)" - name: "[FB EMPLOYEES] Enable SSH (Click me for login details)" uses: seemethere/add-github-ssh-key@v1 with: