From ffffa7d19e6eb829e75a26f04357757419f08fec Mon Sep 17 00:00:00 2001 From: Chester Curme Date: Fri, 27 Sep 2024 14:35:50 -0400 Subject: [PATCH 1/3] python version as input --- .github/workflows/run_notebooks.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_notebooks.yml b/.github/workflows/run_notebooks.yml index 6750612b4850c..f681b024d7bb0 100644 --- a/.github/workflows/run_notebooks.yml +++ b/.github/workflows/run_notebooks.yml @@ -2,11 +2,15 @@ name: Run notebooks on: workflow_dispatch: + inputs: + python_version: + description: 'Python version' + required: false + default: '3.11' schedule: - cron: '0 13 * * *' env: - PYTHON_VERSION: "3.11" POETRY_VERSION: "1.7.1" jobs: @@ -20,7 +24,7 @@ jobs: - name: Set up Python + Poetry ${{ env.POETRY_VERSION }} uses: "./.github/actions/poetry_setup" with: - python-version: ${{ env.PYTHON_VERSION }} + python-version: ${{ github.event.inputs.python_version || '3.11' }} poetry-version: ${{ env.POETRY_VERSION }} working-directory: ${{ inputs.working-directory }} cache-key: run-notebooks @@ -43,7 +47,6 @@ jobs: - name: Prepare notebooks run: | - python docs/scripts/prepare_notebooks_for_ci.py --comment-install-cells - name: Run notebooks From 65f439dd93c68606ecd22cf80e787aa350a612fe Mon Sep 17 00:00:00 2001 From: Chester Curme Date: Fri, 27 Sep 2024 15:22:50 -0400 Subject: [PATCH 2/3] add working-directory parameter --- .github/workflows/run_notebooks.yml | 6 +++++- docs/scripts/execute_notebooks.sh | 11 +++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run_notebooks.yml b/.github/workflows/run_notebooks.yml index f681b024d7bb0..fa8fe40039629 100644 --- a/.github/workflows/run_notebooks.yml +++ b/.github/workflows/run_notebooks.yml @@ -7,6 +7,10 @@ on: description: 'Python version' required: false default: '3.11' + working-directory: + description: 'Working directory or specific notebook file' + required: false + default: 'all' schedule: - cron: '0 13 * * *' @@ -56,4 +60,4 @@ jobs: OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} TAVILY_API_KEY: ${{ secrets.TAVILY_API_KEY }} run: | - ./docs/scripts/execute_notebooks.sh + ./docs/scripts/execute_notebooks.sh ${{ github.event.inputs.working-directory || 'all' }} diff --git a/docs/scripts/execute_notebooks.sh b/docs/scripts/execute_notebooks.sh index a2442ac7ff9bd..8ac1cdb918281 100755 --- a/docs/scripts/execute_notebooks.sh +++ b/docs/scripts/execute_notebooks.sh @@ -3,6 +3,9 @@ # Read the list of notebooks to skip from the JSON file SKIP_NOTEBOOKS=$(python -c "import json; print('\n'.join(json.load(open('docs/notebooks_no_execution.json'))))") +# Get the working directory or specific notebook file from the input parameter +WORKING_DIRECTORY=$1 + # Function to execute a single notebook execute_notebook() { file="$1" @@ -22,8 +25,12 @@ execute_notebook() { export -f execute_notebook -# Find all notebooks and filter out those in the skip list -notebooks=$(find docs/docs/tutorials -name "*.ipynb" | grep -v ".ipynb_checkpoints" | grep -vFf <(echo "$SKIP_NOTEBOOKS")) +# Determine the list of notebooks to execute +if [ "$WORKING_DIRECTORY" == "all" ]; then + notebooks=$(find docs/docs/tutorials -name "*.ipynb" | grep -v ".ipynb_checkpoints" | grep -vFf <(echo "$SKIP_NOTEBOOKS")) +else + notebooks=$(find "$WORKING_DIRECTORY" -name "*.ipynb" | grep -v ".ipynb_checkpoints" | grep -vFf <(echo "$SKIP_NOTEBOOKS")) +fi # Execute notebooks sequentially for file in $notebooks; do From 1f5d9d5af3d521e02aa86c01ecbf45a4fe5fa143 Mon Sep 17 00:00:00 2001 From: Chester Curme Date: Fri, 27 Sep 2024 15:29:03 -0400 Subject: [PATCH 3/3] update description --- .github/workflows/run_notebooks.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_notebooks.yml b/.github/workflows/run_notebooks.yml index fa8fe40039629..14c70f779bf63 100644 --- a/.github/workflows/run_notebooks.yml +++ b/.github/workflows/run_notebooks.yml @@ -8,7 +8,7 @@ on: required: false default: '3.11' working-directory: - description: 'Working directory or specific notebook file' + description: 'Working directory or subset (e.g., docs/docs/tutorials/llm_chain.ipynb)' required: false default: 'all' schedule: