Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Don't queue builds. #168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,10 +1053,8 @@ def purge_path(www_root: Path, path: Path):
run(["curl", "-XPURGE", f"https://docs.python.org/{{{','.join(to_purge)}}}"])


def main() -> bool:
"""Script entry point."""
args = parse_args()
setup_logging(args.log_directory)
def build_docs(args) -> bool:
"""Build all docs (each languages and each versions)."""
languages_dict = {language.tag: language for language in LANGUAGES}
versions = Version.filter(VERSIONS, args.branch)
languages = [languages_dict[tag] for tag in args.languages]
Expand All @@ -1070,17 +1068,8 @@ def main() -> bool:
with sentry_sdk.configure_scope() as scope:
scope.set_tag("version", version.name)
scope.set_tag("language", language.tag)
try:
lock = zc.lockfile.LockFile(HERE / "build_docs.lock")
builder = DocBuilder(version, language, **vars(args))
all_built_successfully &= builder.run()
except zc.lockfile.LockError:
logging.info("Another builder is running... waiting...")
time.sleep(10)
todo.append((version, language))
else:
lock.close()

builder = DocBuilder(version, language, **vars(args))
all_built_successfully &= builder.run()
build_sitemap(args.www_root, args.group)
build_404(args.www_root, args.group)
build_robots_txt(args.www_root, args.group, args.skip_cache_invalidation)
Expand All @@ -1091,6 +1080,25 @@ def main() -> bool:
return all_built_successfully


def main():
"""Script entry point."""
args = parse_args()
setup_logging(args.log_directory)

try:
lock = zc.lockfile.LockFile(HERE / "build_docs.lock")
except zc.lockfile.LockError:
logging.info("Another builder is running... dying...")
return False

try:
build_docs(args)
finally:
lock.close()




if __name__ == "__main__":
all_built_successfully = main()
sys.exit(EX_OK if all_built_successfully else EX_FAILURE)