Skip to content

Commit 27a04ff

Browse files
authored
Revert "[BE] Split up download.pytorch.org index update job (#7185)"
This reverts commit c0cada7.
1 parent c6c5359 commit 27a04ff

File tree

3 files changed

+12
-26
lines changed

3 files changed

+12
-26
lines changed

.github/workflows/update-s3-html.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ jobs:
1717
strategy:
1818
matrix:
1919
prefix: ["whl", "whl/test", "whl/nightly", "libtorch", "libtorch/nightly"]
20-
subdir-pattern: ['cu[0-9]+', 'rocm[0-9]+\.[0-9]+', 'cpu', 'xpu']
2120
fail-fast: False
2221
container:
2322
image: continuumio/miniconda3:23.10.0-1
@@ -43,4 +42,4 @@ jobs:
4342
4443
# Install requirements
4544
pip install -r s3_management/requirements.txt
46-
python s3_management/manage.py --subdir-pattern '${{ matrix.subdir-pattern }}' ${{ matrix.prefix }}
45+
python s3_management/manage.py ${{ matrix.prefix }}

s3_management/assume-role-output.txt

Whitespace-only changes.

s3_management/manage.py

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import time
99
from collections import defaultdict
1010
from os import makedirs, path
11-
from re import compile, match, sub
11+
from re import match, sub
1212
from typing import Dict, Iterable, List, Optional, Set, TypeVar
1313

1414
import boto3 # type: ignore[import]
@@ -630,12 +630,15 @@ def grant_public_read(cls, key: str) -> None:
630630
CLIENT.put_object_acl(Bucket=BUCKET.name, Key=key, ACL="public-read")
631631

632632
@classmethod
633-
def fetch_object_names(cls, prefix: str, pattern: str) -> List[str]:
633+
def fetch_object_names(cls, prefix: str) -> List[str]:
634634
obj_names = []
635635
for obj in BUCKET.objects.filter(Prefix=prefix):
636636
is_acceptable = any(
637637
[path.dirname(obj.key) == prefix]
638-
+ [match(compile(f"{prefix}/{pattern}"), path.dirname(obj.key))]
638+
+ [
639+
match(f"{prefix}/{pattern}", path.dirname(obj.key))
640+
for pattern in ACCEPTED_SUBDIR_PATTERNS
641+
]
639642
) and obj.key.endswith(ACCEPTED_FILE_EXTENSIONS)
640643
if not is_acceptable:
641644
continue
@@ -703,11 +706,9 @@ def _fetch_metadata(key: str) -> str:
703706
self.objects[idx].pep658 = response
704707

705708
@classmethod
706-
def from_S3(
707-
cls, prefix: str, pattern: str, with_metadata: bool = True
708-
) -> "S3Index":
709+
def from_S3(cls, prefix: str, with_metadata: bool = True) -> "S3Index":
709710
prefix = prefix.rstrip("/")
710-
obj_names = cls.fetch_object_names(prefix, pattern)
711+
obj_names = cls.fetch_object_names(prefix)
711712

712713
def sanitize_key(key: str) -> str:
713714
return key.replace("+", "%2B")
@@ -748,12 +749,6 @@ def undelete_prefix(cls, prefix: str) -> None:
748749
def create_parser() -> argparse.ArgumentParser:
749750
parser = argparse.ArgumentParser("Manage S3 HTML indices for PyTorch")
750751
parser.add_argument("prefix", type=str, choices=PREFIXES + ["all"])
751-
parser.add_argument(
752-
"--subdir-pattern",
753-
type=str,
754-
choices=ACCEPTED_SUBDIR_PATTERNS + ["all"],
755-
default="all",
756-
)
757752
parser.add_argument("--do-not-upload", action="store_true")
758753
parser.add_argument("--compute-sha256", action="store_true")
759754
return parser
@@ -766,22 +761,14 @@ def main() -> None:
766761
if args.compute_sha256:
767762
action = "Computing checksums"
768763

769-
patterns = (
770-
ACCEPTED_SUBDIR_PATTERNS
771-
if args.subdir_pattern == "all"
772-
else [args.subdir_pattern]
773-
)
774764
prefixes = PREFIXES if args.prefix == "all" else [args.prefix]
775765
for prefix in prefixes:
776766
generate_pep503 = prefix.startswith("whl")
777767
print(f"INFO: {action} for '{prefix}'")
778768
stime = time.time()
779-
for pattern in patterns:
780-
idx = S3Index.from_S3(
781-
prefix=prefix,
782-
pattern=pattern,
783-
with_metadata=generate_pep503 or args.compute_sha256,
784-
)
769+
idx = S3Index.from_S3(
770+
prefix=prefix, with_metadata=generate_pep503 or args.compute_sha256
771+
)
785772
etime = time.time()
786773
print(
787774
f"DEBUG: Fetched {len(idx.objects)} objects for '{prefix}' in {etime-stime:.2f} seconds"

0 commit comments

Comments
 (0)