Skip to content

Commit 1bee04d

Browse files
authored
Merge pull request #66 from brian-rose/timeout
Add option to change binder timeout
2 parents a9e3d2f + 462ac74 commit 1bee04d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

.github/workflows/build-book.yaml

+8-2
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ on:
3838
required: false
3939
default: '_build/html'
4040
type: string
41+
binder_nb_timeout:
42+
description: 'Maximum execution time (in seconds) for each notebook on the binder.'
43+
required: false
44+
default: 600
45+
type: number
4146

4247
secrets:
4348
ARM_USERNAME:
@@ -142,6 +147,7 @@ jobs:
142147
for path in notebooks:
143148
outfile.write(path + ' ')
144149
outfile.close() # Writing these out to a file because I can't figure out how to set an environment variable from a python script
150+
145151
- name: Execute notebooks via binderbot using existing image
146152
if: |
147153
( steps.parse_config.outputs.execute_notebooks == 'binder'
@@ -157,7 +163,7 @@ jobs:
157163
echo "using the existing binder image from the main branch"
158164
SECRET_VAR_LIST=$(echo $SECRET_VARS | jq -r 'with_entries(.key |= "--pass-env-var " + . + " ") | keys | [ .[] | tostring ] | @csv') # Extract the keys of the secret environment variables, and create a list of arguments separated by commas (CSV)
159165
SECRET_VARS_ARGS=$(echo "${SECRET_VAR_LIST//,}" | tr -d '"') # Remove the commas and merge the list of strings into a single cohesive string to be passed to the binder cli
160-
python -m binderbot.cli --binder-url ${{ steps.parse_config.outputs.binderhub_url }} --repo ${{ github.repository }} --ref main $NOTEBOOKS $SECRET_VARS_ARGS
166+
python -m binderbot.cli --binder-url ${{ steps.parse_config.outputs.binderhub_url }} --repo ${{ github.repository }} --ref main --nb-timeout ${{ inputs.binder_nb_timeout }} $NOTEBOOKS $SECRET_VARS_ARGS
161167
162168
- name: Execute notebooks via binderbot using new image with latest environment
163169
if: |
@@ -171,7 +177,7 @@ jobs:
171177
echo 'Retrieved binder_url: ${{ steps.parse_config.outputs.binderhub_url }}'
172178
echo "We will now execute these notebooks: $NOTEBOOKS"
173179
echo "using the updated environment file in this branch to build a new image"
174-
python -m binderbot.cli --binder-url ${{ steps.parse_config.outputs.binderhub_url }} --repo ${{ github.repository }} --ref ${{ github.ref }} $NOTEBOOKS
180+
python -m binderbot.cli --binder-url ${{ steps.parse_config.outputs.binderhub_url }} --repo ${{ github.repository }} --ref ${{ github.ref }} --nb-timeout ${{ inputs.binder_nb_timeout }} $NOTEBOOKS
175181
176182
- name: Disable notebook execution during jupyterbook build
177183
if: |

0 commit comments

Comments
 (0)