mirror of
https://github.com/zama-ai/concrete.git
synced 2026-04-17 03:00:54 -04:00
chore: set notebook timeout to 3 hours
This commit is contained in:
16
Makefile
16
Makefile
@@ -27,9 +27,9 @@ check_python_format:
|
||||
--dir $(SRC_DIR) --dir tests --dir benchmarks --dir script --check
|
||||
.PHONY: check_python_format
|
||||
|
||||
check_strip_nb:
|
||||
poetry run python ./script/nbmake_utils/notebook_sanitize.py $(NOTEBOOKS_DIR) --check
|
||||
.PHONY: check_strip_nb
|
||||
check_finalize_nb:
|
||||
poetry run python ./script/nbmake_utils/notebook_finalize.py $(NOTEBOOKS_DIR) --check
|
||||
.PHONY: check_finalize_nb
|
||||
|
||||
pylint:
|
||||
$(MAKE) --keep-going pylint_src pylint_tests pylint_benchmarks pylint_script
|
||||
@@ -62,7 +62,7 @@ flake8:
|
||||
python_linting: pylint flake8
|
||||
.PHONY: python_linting
|
||||
|
||||
conformance: strip_nb python_format
|
||||
conformance: finalize_nb python_format
|
||||
.PHONY: conformance
|
||||
|
||||
pcc:
|
||||
@@ -70,7 +70,7 @@ pcc:
|
||||
--no-print-directory pcc_internal
|
||||
.PHONY: pcc
|
||||
|
||||
pcc_internal: check_python_format check_strip_nb python_linting mypy_ci pydocstyle
|
||||
pcc_internal: check_python_format check_finalize_nb python_linting mypy_ci pydocstyle
|
||||
.PHONY: pcc_internal
|
||||
|
||||
pytest:
|
||||
@@ -172,9 +172,9 @@ pydocstyle:
|
||||
poetry run pydocstyle $(SRC_DIR) --convention google --add-ignore=D1,D202 --add-select=D401
|
||||
.PHONY: pydocstyle
|
||||
|
||||
strip_nb:
|
||||
poetry run python ./script/nbmake_utils/notebook_sanitize.py $(NOTEBOOKS_DIR)
|
||||
.PHONY: strip_nb
|
||||
finalize_nb:
|
||||
poetry run python ./script/nbmake_utils/notebook_finalize.py $(NOTEBOOKS_DIR)
|
||||
.PHONY: finalize_nb
|
||||
|
||||
pytest_nb:
|
||||
poetry run pytest --nbmake $(NOTEBOOKS_DIR)/*.ipynb
|
||||
|
||||
@@ -735,7 +735,11 @@
|
||||
"metadata": {}
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"timeout": 10800
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
|
||||
@@ -879,7 +879,11 @@
|
||||
"metadata": {}
|
||||
}
|
||||
],
|
||||
"metadata": {},
|
||||
"metadata": {
|
||||
"execution": {
|
||||
"timeout": 10800
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
"""Sanitizer for Jupyter notebooks."""
|
||||
"""Finalizer for Jupyter notebooks."""
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def main():
|
||||
"""Sanitize"""
|
||||
"""Finalize"""
|
||||
|
||||
parser = argparse.ArgumentParser(description="Sanitizer for Jupyter Notebooks")
|
||||
|
||||
parser.add_argument("base", type=str, help="directory which contains the notebooks")
|
||||
@@ -21,11 +22,26 @@ def main():
|
||||
content = json.load(f)
|
||||
|
||||
if args.check:
|
||||
if len(content["metadata"]) != 0:
|
||||
try:
|
||||
metadata = content["metadata"]
|
||||
assert len(metadata) == 1
|
||||
assert "execution" in metadata
|
||||
|
||||
execution = metadata["execution"]
|
||||
assert len(execution) == 1
|
||||
assert "timeout" in execution
|
||||
|
||||
timeout = execution["timeout"]
|
||||
assert timeout == 10800 # 3 hours
|
||||
except Exception:
|
||||
print("Notebooks are not sanitized. Please run `make conformance`.")
|
||||
raise ValueError
|
||||
raise
|
||||
else:
|
||||
content["metadata"] = {}
|
||||
content["metadata"] = {
|
||||
"execution": {
|
||||
"timeout": 10800, # 3 hours
|
||||
}
|
||||
}
|
||||
with open(notebook, "w", newline="\n", encoding="utf-8") as f:
|
||||
json.dump(content, f, indent=1, ensure_ascii=False)
|
||||
f.write("\n")
|
||||
Reference in New Issue
Block a user