Skip to content

Unable to run pytorch unit test because CI environment variables are not available #82492

@xwang233

Description

@xwang233

🐛 Describe the bug

Unable to run pytorch unit test because CI environment variables are not available

PR #79898 introduced BUILD_ENVIRONMENT which open source build doesn't have

"cuda" in os.environ["BUILD_ENVIRONMENT"] and "linux" in os.environ["BUILD_ENVIRONMENT"]

thus KeyError is raised

Running test_ops ... [2022-07-28 03:25:21.888236]
Executing ['/opt/conda/bin/python', '-bb', 'test_ops.py', '-v', '--save-xml', '--import-slow-tests', '--import-disabled-tests'] ... [2022-07-28 03:25:21.888297]
Traceback (most recent call last):
  File "test_ops.py", line 1736, in <module>
    run_tests()
  File "/opt/pytorch/pytorch/torch/testing/_internal/common_utils.py", line 716, in run_tests
    "cuda" in os.environ["BUILD_ENVIRONMENT"] and "linux" in os.environ["BUILD_ENVIRONMENT"]
  File "/opt/conda/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'BUILD_ENVIRONMENT'
test_ops failed!

PR #81915 introduced TEST_CONFIG which open source build doesn't have

if os.environ["TEST_CONFIG"] not in test_file_times:

thus KeyError is raised

Traceback (most recent call last):
  File "test/run_test.py", line 1000, in <module>
    main()
  File "test/run_test.py", line 949, in main
    selected_tests = get_selected_tests(options)
  File "test/run_test.py", line 898, in get_selected_tests
    if os.environ["TEST_CONFIG"] not in test_file_times:
  File "/opt/conda/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'TEST_CONFIG'

Are those environment variables necessary for open source build to run pytorch unit tests? How should I setup those variables?

Versions

4f2a475

cc @seemethere @malfet @pytorch/pytorch-dev-infra @mruberry @janeyx99 @clee2000 @ptrblck

Metadata

Metadata

Assignees

Labels

module: ciRelated to continuous integrationmodule: testsIssues related to tests (not the torch.testing module)triagedThis issue has been looked at a team member, and triaged and prioritized into an appropriate module

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions