From e20894fce5592b87170da678019bb798893a42e2 Mon Sep 17 00:00:00 2001 From: Edward Yang Date: Fri, 22 Mar 2019 14:58:35 -0700 Subject: [PATCH] Make it possible to trigger XLA/slow tests via commit message. (#18345) Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/18345 ghimport-source-id: 9649d76bb194866859d62e6ba2a3a265c96ebba5 Stack from [ghstack](https://github.com/ezyang/ghstack): * **#18345 Make it possible to trigger XLA/slow tests via commit message.** Four variants are supported: `[xla ci] [ci xla] [xla test] [test xla]`; substitute xla with slow for slow tests. Signed-off-by: Edward Z. Yang Differential Revision: D14584557 fbshipit-source-id: fcbfdfb28246823135bb3d3910baae073d16e81d --- .circleci/cimodel/pytorch_build_definitions.py | 6 +--- .circleci/config.yml | 41 +++++++++++++++++--------- .circleci/verbatim-sources/header-section.yml | 27 ++++++++++++++++- 3 files changed, 54 insertions(+), 20 deletions(-) diff --git a/.circleci/cimodel/pytorch_build_definitions.py b/.circleci/cimodel/pytorch_build_definitions.py index 102dc33..4e94b5b 100644 --- a/.circleci/cimodel/pytorch_build_definitions.py +++ b/.circleci/cimodel/pytorch_build_definitions.py @@ -105,12 +105,8 @@ class Conf(object): def gen_workflow_yaml_item(self, phase): - if self.is_xla or phase == "test": + if phase == "test": val = OrderedDict() - if self.is_xla or "slow" in self.parms: - # this makes the job run on merges rather than new PRs - # TODO Many of the binary build jobs on PRs could be moved to this mode as well - val["filters"] = {"branches": {"only": ["master"]}} # TODO When merging the caffe2 and pytorch jobs, it might be convenient for a while to make a # caffe2 test job dependent on a pytorch build job. This way we could quickly dedup the repeated diff --git a/.circleci/config.yml b/.circleci/config.yml index 515ff9f..748ed4e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -150,7 +150,32 @@ setup_ci_environment: &setup_ci_environment name: Set Up CI Environment After Checkout no_output_timeout: "1h" command: | - set -e + set -ex + + # Check if we should actually run + echo "BUILD_ENVIRONMENT: ${BUILD_ENVIRONMENT}" + echo "CIRCLE_PULL_REQUEST: ${CIRCLE_PULL_REQUEST}" + if [[ "${BUILD_ENVIRONMENT}" == *-slow-* ]]; then + if ! [ -z "${CIRCLE_PULL_REQUEST}" ]; then + # It's a PR; test for [slow ci] tag on the TOPMOST commit + if !(git log --format='%B' -n 1 HEAD | grep -q -e '\[slow ci\]' -e '\[ci slow\]' -e '\[test slow\]' -e '\[slow test\]'); then + circleci step halt + exit + fi + fi + fi + if [[ "${BUILD_ENVIRONMENT}" == *xla* ]]; then + if ! [ -z "${CIRCLE_PULL_REQUEST}" ]; then + # It's a PR; test for [xla ci] tag on the TOPMOST commit + if !(git log --format='%B' -n 1 HEAD | grep -q -e '\[xla ci\]' -e '\[ci xla\]' -e '\[test xla\]' -e '\[xla test\]'); then + # NB: This doesn't halt everything, just this job. So + # the rest of the workflow will keep going and you need + # to make sure you halt there too. Blegh. + circleci step halt + exit + fi + fi + fi # Set up NVIDIA docker repo curl -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - @@ -3048,16 +3073,8 @@ workflows: - pytorch_linux_trusty_py3_6_gcc5_4_test: requires: - pytorch_linux_trusty_py3_6_gcc5_4_build - - pytorch_xla_linux_trusty_py3_6_gcc5_4_build: - filters: - branches: - only: - - master + - pytorch_xla_linux_trusty_py3_6_gcc5_4_build - pytorch_xla_linux_trusty_py3_6_gcc5_4_test: - filters: - branches: - only: - - master requires: - pytorch_xla_linux_trusty_py3_6_gcc5_4_build - pytorch_linux_trusty_py3_6_gcc7_build @@ -3086,10 +3103,6 @@ workflows: requires: - pytorch_linux_xenial_cuda8_cudnn7_py3_build - pytorch_linux_xenial_cuda8_cudnn7_py3_slow_test: - filters: - branches: - only: - - master requires: - pytorch_linux_xenial_cuda8_cudnn7_py3_build - pytorch_short_perf_test_gpu: diff --git a/.circleci/verbatim-sources/header-section.yml b/.circleci/verbatim-sources/header-section.yml index 294d2a6..a178109 100644 --- a/.circleci/verbatim-sources/header-section.yml +++ b/.circleci/verbatim-sources/header-section.yml @@ -150,7 +150,32 @@ setup_ci_environment: &setup_ci_environment name: Set Up CI Environment After Checkout no_output_timeout: "1h" command: | - set -e + set -ex + + # Check if we should actually run + echo "BUILD_ENVIRONMENT: ${BUILD_ENVIRONMENT}" + echo "CIRCLE_PULL_REQUEST: ${CIRCLE_PULL_REQUEST}" + if [[ "${BUILD_ENVIRONMENT}" == *-slow-* ]]; then + if ! [ -z "${CIRCLE_PULL_REQUEST}" ]; then + # It's a PR; test for [slow ci] tag on the TOPMOST commit + if !(git log --format='%B' -n 1 HEAD | grep -q -e '\[slow ci\]' -e '\[ci slow\]' -e '\[test slow\]' -e '\[slow test\]'); then + circleci step halt + exit + fi + fi + fi + if [[ "${BUILD_ENVIRONMENT}" == *xla* ]]; then + if ! [ -z "${CIRCLE_PULL_REQUEST}" ]; then + # It's a PR; test for [xla ci] tag on the TOPMOST commit + if !(git log --format='%B' -n 1 HEAD | grep -q -e '\[xla ci\]' -e '\[ci xla\]' -e '\[test xla\]' -e '\[xla test\]'); then + # NB: This doesn't halt everything, just this job. So + # the rest of the workflow will keep going and you need + # to make sure you halt there too. Blegh. + circleci step halt + exit + fi + fi + fi # Set up NVIDIA docker repo curl -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - -- 2.7.4