mirror of
https://github.com/microsoft/FLAML.git
synced 2026-02-09 02:09:16 +08:00
* Sync Fabric till 2cd1c3da * Remove synapseml from tag names * Fix 'NoneType' object has no attribute 'DataFrame' * Deprecated 3.8 support * Fix 'NoneType' object has no attribute 'DataFrame' * Still use python 3.8 for pydoc * Don't run tests in parallel * Remove autofe and lowcode
41 lines
1.2 KiB
Python
41 lines
1.2 KiB
Python
import os
|
|
|
|
import nbformat
|
|
import pytest
|
|
from nbconvert.preprocessors import CellExecutionError, ExecutePreprocessor
|
|
|
|
from flaml.tune.spark.utils import check_spark
|
|
|
|
spark_available, _ = check_spark()
|
|
skip_spark = not spark_available
|
|
|
|
pytestmark = [pytest.mark.skipif(skip_spark, reason="Spark is not installed. Skip all spark tests."), pytest.mark.spark]
|
|
|
|
here = os.path.abspath(os.path.dirname(__file__))
|
|
os.environ["FLAML_MAX_CONCURRENT"] = "2"
|
|
|
|
|
|
def run_notebook(input_nb, output_nb="executed_notebook.ipynb", save=False):
|
|
try:
|
|
file_path = os.path.join(here, os.pardir, os.pardir, "notebook", input_nb)
|
|
with open(file_path) as f:
|
|
nb = nbformat.read(f, as_version=4)
|
|
ep = ExecutePreprocessor(timeout=600, kernel_name="python3")
|
|
ep.preprocess(nb, {"metadata": {"path": here}})
|
|
except CellExecutionError:
|
|
raise
|
|
# except Exception as e:
|
|
# print("\nIgnoring below error:\n", e, "\n\n")
|
|
finally:
|
|
if save:
|
|
with open(os.path.join(here, output_nb), "w", encoding="utf-8") as f:
|
|
nbformat.write(nb, f)
|
|
|
|
|
|
def test_automl_lightgbm_test():
|
|
run_notebook("integrate_spark.ipynb")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
test_automl_lightgbm_test()
|