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

Skip to content

Commit 9604476

Browse files
authored
Don't queue builds. (#168)
It was mandatory for the server to queue builds, but since 1a0ad2e it's no longer needed. Queuing builds has a downside: if the daily builds take more than 24h they starts to infinitly queue.
1 parent 38f1fd2 commit 9604476

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

build_docs.py

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1053,10 +1053,8 @@ def purge_path(www_root: Path, path: Path):
10531053
run(["curl", "-XPURGE", f"https://docs.python.org/{{{','.join(to_purge)}}}"])
10541054

10551055

1056-
def main() -> bool:
1057-
"""Script entry point."""
1058-
args = parse_args()
1059-
setup_logging(args.log_directory)
1056+
def build_docs(args) -> bool:
1057+
"""Build all docs (each languages and each versions)."""
10601058
languages_dict = {language.tag: language for language in LANGUAGES}
10611059
versions = Version.filter(VERSIONS, args.branch)
10621060
languages = [languages_dict[tag] for tag in args.languages]
@@ -1070,17 +1068,8 @@ def main() -> bool:
10701068
with sentry_sdk.configure_scope() as scope:
10711069
scope.set_tag("version", version.name)
10721070
scope.set_tag("language", language.tag)
1073-
try:
1074-
lock = zc.lockfile.LockFile(HERE / "build_docs.lock")
1075-
builder = DocBuilder(version, language, **vars(args))
1076-
all_built_successfully &= builder.run()
1077-
except zc.lockfile.LockError:
1078-
logging.info("Another builder is running... waiting...")
1079-
time.sleep(10)
1080-
todo.append((version, language))
1081-
else:
1082-
lock.close()
1083-
1071+
builder = DocBuilder(version, language, **vars(args))
1072+
all_built_successfully &= builder.run()
10841073
build_sitemap(args.www_root, args.group)
10851074
build_404(args.www_root, args.group)
10861075
build_robots_txt(args.www_root, args.group, args.skip_cache_invalidation)
@@ -1091,6 +1080,25 @@ def main() -> bool:
10911080
return all_built_successfully
10921081

10931082

1083+
def main():
1084+
"""Script entry point."""
1085+
args = parse_args()
1086+
setup_logging(args.log_directory)
1087+
1088+
try:
1089+
lock = zc.lockfile.LockFile(HERE / "build_docs.lock")
1090+
except zc.lockfile.LockError:
1091+
logging.info("Another builder is running... dying...")
1092+
return False
1093+
1094+
try:
1095+
build_docs(args)
1096+
finally:
1097+
lock.close()
1098+
1099+
1100+
1101+
10941102
if __name__ == "__main__":
10951103
all_built_successfully = main()
10961104
sys.exit(EX_OK if all_built_successfully else EX_FAILURE)

0 commit comments

Comments
 (0)