Make emit_metrics importable without having boto3 installed (#107070)

Make it so that scripts can import and run the `emit_metrics` function even if they don't have boto3 installed, in which case it will still validate the inputs but skip the actual metric emission part.

It's purely a refactor without any real logic changes

Motivation: So that run_test.py and the target determination code can use this library easily without worrying about if it was imported or if it's dependencies are installed.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/107070
Approved by: https://github.com/huydhn
This commit is contained in:
Zain Rizvi
2023-08-21 12:49:22 -05:00
committed by PyTorch MergeBot
parent 3920ce2f6e
commit 5ddb8ef827
6 changed files with 151 additions and 129 deletions

View File

@ -13,7 +13,7 @@ from tools.shared.logging_utils import duration_to_str, pluralize
from tools.stats.export_test_times import TEST_FILE_RATINGS_FILE
from tools.stats.import_test_stats import get_disabled_tests, get_slow_tests
from tools.stats.upload_stats_lib import emit_metric
from tools.stats.upload_metrics import emit_metric
REPO_ROOT = Path(__file__).resolve().parent.parent.parent