Skip to content

Commit 1ddbe1d

Browse files
authored
[ez][testing] file report: handle no sha found for date (#7305)
If no good sha found for date, don't do anything TODO handle what happens if all jobs are broken
1 parent fc0f566 commit 1ddbe1d

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tools/torchci/test_insights/file_report_generator.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from datetime import datetime, timezone
3434
from functools import lru_cache
3535
from pathlib import Path
36-
from typing import Any, Dict, List, Optional
36+
from typing import Any, cast, Dict, List, Optional
3737

3838
import boto3 # type: ignore[import]
3939
from torchci.clickhouse import query_clickhouse
@@ -607,7 +607,7 @@ def remove_key_from_s3(self, bucket: str, key: str) -> None:
607607
self.get_s3_resource().Object(bucket, key).delete()
608608

609609

610-
def main():
610+
def main() -> None:
611611
"""Main function to run the file report generator"""
612612
parser = argparse.ArgumentParser(
613613
description="Generate comprehensive file reports grouped by owner labels",
@@ -664,17 +664,20 @@ def main():
664664
existing_metadata.pop(i)
665665
break
666666

667-
shas = []
667+
shas: list[str] = []
668668
for date in args.add_dates or []:
669669
if date in _existing_dates:
670670
print(f"Date {date} already exists in metadata, skipping")
671671
continue
672672
sha = generator.find_suitable_sha(date)
673+
if sha is None:
674+
print(f"No suitable SHA found for date {date}, skipping")
675+
continue
673676
print(f"Found suitable SHA {sha} for date {date}")
674677
shas.append(sha)
675678

676679
for sha in args.add_shas or []:
677-
shas.append(sha)
680+
shas.append(cast(str, sha))
678681

679682
print(f"Adding SHAs: {shas}")
680683

0 commit comments

Comments
 (0)