diff --git a/.github/scripts/file_io_utils.py b/.github/scripts/file_io_utils.py index f537d3674c3d..f2ab0499ee34 100644 --- a/.github/scripts/file_io_utils.py +++ b/.github/scripts/file_io_utils.py @@ -84,4 +84,7 @@ def download_s3_objects_with_prefix(bucket, prefix, download_folder): downloads.append(download_path) print("done") + if len(downloads) == 0: + print(f"There were no files matching the prefix `{prefix}` in bucket `{bucket.name}`") + return downloads diff --git a/.github/scripts/pytest_caching_utils.py b/.github/scripts/pytest_caching_utils.py index adf4f8efc91d..04f7f0e494c1 100644 --- a/.github/scripts/pytest_caching_utils.py +++ b/.github/scripts/pytest_caching_utils.py @@ -22,10 +22,11 @@ # create a custom string type to be used as pr identifiers to know we've gotten the right one class PRIdentifier(str): - def __init__(self, value): + def __new__(cls, value): # Since the pr identifier can be based on include user defined text (like a branch name) # we hash it to get a clean input and dodge corner cases - self.value = hashlib.md5(value.encode()).hexdigest() + md5 = hashlib.md5(value.encode('utf-8')).hexdigest() + return super().__new__(cls, md5) def get_s3_key_prefix( @@ -139,16 +140,6 @@ def download_pytest_cache( # shutil.rmtree(zip_download_dir) suppress deletes while testing pass -def unzip_cache_folder(zip_file_path, dest_dir): - # the file name of the zip is the shard id - shard_id = os.path.splitext(os.path.basename(zip_file_path))[0] - cache_dir_for_shard = os.path.join( - dest_dir, - get_s3_key_prefix(pr_identifier, workflow, job, shard_id), - PYTEST_CACHE_DIR_NAME, - ) - - unzip_folder(downloaded_zip, cache_dir_for_shard) def copy_file(source_file, dest_file): ensure_dir_exists(os.path.dirname(dest_file)) diff --git a/.github/workflows/_linux-test.yml b/.github/workflows/_linux-test.yml index 3e0313ff60d5..08951028ad6c 100644 --- a/.github/workflows/_linux-test.yml +++ b/.github/workflows/_linux-test.yml @@ -115,11 +115,11 @@ jobs: github-token: ${{ secrets.GITHUB_TOKEN }} test-matrix: ${{ inputs.test-matrix }} - # - name: Download pytest cache - # uses: ./.github/actions/pytest-cache-download - # with: - # github-token: ${{ secrets.GITHUB_TOKEN }} - # cache_dir: ${GITHUB_WORKSPACE}/.pytest_cache + - name: Download pytest cache + uses: ./.github/actions/pytest-cache-download + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + cache_dir: .pytest_cache - name: Set Test step time id: test-timeout