mirror of
https://github.com/jupyter/docker-stacks.git
synced 2025-10-17 15:02:57 +00:00
Improve logs during manifests handle
This commit is contained in:
@@ -22,7 +22,7 @@ def update_home_wiki_page(wiki_dir: Path, month: str) -> None:
|
||||
TABLE_BEGINNING, TABLE_BEGINNING + month_line
|
||||
)
|
||||
wiki_home_file.write_text(wiki_home_content)
|
||||
LOGGER.info(f"Wiki home file updated with month: {month}")
|
||||
LOGGER.info(f"Update wiki home page with month: {month}")
|
||||
|
||||
|
||||
def update_monthly_wiki_page(
|
||||
@@ -43,6 +43,7 @@ def update_monthly_wiki_page(
|
||||
MONTHLY_PAGE_HEADER, MONTHLY_PAGE_HEADER + build_history_line + "\n"
|
||||
)
|
||||
monthly_page.write_text(monthly_page_content)
|
||||
LOGGER.info(f"Updated monthly page: {month}")
|
||||
|
||||
|
||||
def get_manifest_timestamp(manifest_file: Path) -> str:
|
||||
@@ -58,24 +59,24 @@ def get_manifest_month(manifest_file: Path) -> str:
|
||||
def remove_old_manifests(wiki_dir: Path) -> None:
|
||||
MAX_NUMBER_OF_MANIFESTS = 4500
|
||||
|
||||
manifest_files = []
|
||||
manifest_files: list[tuple[str, Path]] = []
|
||||
for file in (wiki_dir / "manifests").rglob("*.md"):
|
||||
manifest_files.append((get_manifest_timestamp(file), file))
|
||||
|
||||
manifest_files.sort(reverse=True)
|
||||
for _, file in manifest_files[MAX_NUMBER_OF_MANIFESTS:]:
|
||||
LOGGER.info(f"Removing manifest: {file.name}")
|
||||
file.unlink()
|
||||
LOGGER.info(f"Removed manifest: {file.relative_to(wiki_dir)}")
|
||||
|
||||
|
||||
def update_wiki(wiki_dir: Path, hist_line_dir: Path, manifest_dir: Path) -> None:
|
||||
LOGGER.info("Updating wiki")
|
||||
|
||||
LOGGER.info("Copying manifest files")
|
||||
for manifest_file in manifest_dir.glob("*.md"):
|
||||
month = get_manifest_month(manifest_file)
|
||||
shutil.copy(manifest_file, wiki_dir / "manifests" / month / manifest_file.name)
|
||||
LOGGER.info(f"Manifest file added: {manifest_file.name}")
|
||||
copy_to = wiki_dir / "manifests" / month / manifest_file.name
|
||||
shutil.copy(manifest_file, copy_to)
|
||||
LOGGER.info(f"Added manifest file: {copy_to.relative_to(wiki_dir)}")
|
||||
|
||||
for build_history_line_file in sorted(hist_line_dir.glob("*.txt")):
|
||||
build_history_line = build_history_line_file.read_text()
|
||||
|
Reference in New Issue
Block a user