Skip to content

Commit 22c52a0

Browse files
authored
s3_management: Some BE cleanup for s3 index (#6901)
1 parent b6b2a25 commit 22c52a0

File tree

1 file changed

+1
-28
lines changed

1 file changed

+1
-28
lines changed

s3_management/manage.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -206,18 +206,10 @@
206206
"wheel",
207207
]}
208208

209-
# Should match torch-2.0.0.dev20221221+cu118-cp310-cp310-linux_x86_64.whl as:
210-
# Group 1: torch-2.0.0.dev
211-
# Group 2: 20221221
212-
PACKAGE_DATE_REGEX = r"([a-zA-z]*-[0-9.]*.dev)([0-9]*)"
213209

214210
# How many packages should we keep of a specific package?
215211
KEEP_THRESHOLD = 60
216212

217-
# TODO (huydhn): Clean this up afte https://github.com/pytorch/pytorch/pull/152238
218-
# is in the release branch, be it via cherry picking to the next release branch
219-
# cut
220-
KEEP_NIGHTLY_PACKAGES_FOR_EXECUTORCH = {datetime(2025, 3, 10, 0, 0)}
221213

222214
S3IndexType = TypeVar('S3IndexType', bound='S3Index')
223215

@@ -244,21 +236,6 @@ def __lt__(self, other):
244236
return self.key < other.key
245237

246238

247-
def extract_package_build_time(full_package_name: str) -> datetime:
248-
result = search(PACKAGE_DATE_REGEX, full_package_name)
249-
if result is not None:
250-
with suppress(ValueError):
251-
# Ignore any value errors since they probably shouldn't be hidden anyways
252-
return datetime.strptime(result.group(2), "%Y%m%d")
253-
return datetime.now()
254-
255-
256-
def between_bad_dates(package_build_time: datetime):
257-
start_bad = datetime(year=2022, month=8, day=17)
258-
end_bad = datetime(year=2022, month=12, day=30)
259-
return start_bad <= package_build_time <= end_bad
260-
261-
262239
def safe_parse_version(ver_str: str) -> Version:
263240
try:
264241
return _parse_version(ver_str)
@@ -301,15 +278,11 @@ def nightly_packages_to_show(self: S3IndexType) -> List[S3Object]:
301278
for obj in all_sorted_packages:
302279
full_package_name = path.basename(obj)
303280
package_name = full_package_name.split('-')[0]
304-
package_build_time = extract_package_build_time(full_package_name)
305281
# Hard pass on packages that are included in our allow list
306282
if package_name.lower() not in PACKAGE_ALLOW_LIST:
307283
to_hide.add(obj)
308284
continue
309-
if package_build_time not in KEEP_NIGHTLY_PACKAGES_FOR_EXECUTORCH and (
310-
packages[package_name] >= KEEP_THRESHOLD
311-
or between_bad_dates(package_build_time)
312-
):
285+
if packages[package_name] >= KEEP_THRESHOLD:
313286
to_hide.add(obj)
314287
else:
315288
packages[package_name] += 1

0 commit comments

Comments
 (0)