pytorch/.github/scripts/generate_pytorch_test_matrix.py
Jane Xu 462448f07a Enable GHA sharding on linux (#60124)
Summary:
This is branch off of https://github.com/pytorch/pytorch/issues/59970 to only shard on linux so far (we're running in issues with windows gflags).

This would enable sharding of tests on a few Linux jobs on GHA, allowing tts to be essentially halved.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/60124

Reviewed By: zou3519

Differential Revision: D29204211

Pulled By: janeyx99

fbshipit-source-id: 1cc31d1eccd564d96e2aef14c0acae96a3f0fcd0
2021-06-17 13:00:23 -07:00

32 lines
583 B
Python
Executable File

#!/usr/bin/env python3
"""Generates a matrix to be utilized through github actions
Will output a matrix to represent our testing configurations, which is currently
dictated by just sharding.
"""
import json
import os
from typing import List
NUM_TEST_SHARDS = int(os.getenv('NUM_TEST_SHARDS', '1'))
def generate_sharding_list() -> List[int]:
return list(range(1, NUM_TEST_SHARDS + 1))
def main() -> None:
print(json.dumps(
{
'test_config': generate_sharding_list()
},
sort_keys=True,
))
if __name__ == "__main__":
main()