Skip to content

Commit

Permalink
feat: Added support for non-python notebooks via additional parameters (
Browse files Browse the repository at this point in the history
#13)

Support for R notebooks requires a different base container and a R kernel.

* Added parameters for both the base container and the kernel with the old values as the defaults
* Updated the docs and added an example of running a 'R' notebook
  • Loading branch information
bradegler authored Sep 15, 2022
1 parent fb3bb60 commit e372944
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,21 @@ This action requires Google Cloud credentials to execute gcloud commands. See [s
allowlist: '${{ needs.changes.outputs.notebooks_files }}'
```
### Running `R` notebooks

R requires a different base container and kernel

```yaml
- id: notebook-review
uses: google-github-actions/run-vertexai-notebook@v0
with:
gcs_source_bucket: '${{ env.GCS_SOURCE }}'
gcs_output_bucket: '${{ env.GCS_OUTPUT }}'
allowlist: '${{ needs.changes.outputs.notebooks_files }}'
vertex_container_name: 'gcr.io/deeplearning-platform-release/r-cpu.4-1:latest' # R base container
kernel: 'ir' # The stock R kernel
```

See a more complete example in [examples](examples/.github/workflows/notebook-review.yml).

# Inputs
Expand Down Expand Up @@ -112,6 +127,11 @@ See a more complete example in [examples](examples/.github/workflows/notebook-re
comment to the open PR or issue that triggered this action. This flag allows
workflows that are triggered on direct push to a branch to disable this behavior.

- `kernel` - (Optional) Kernel to use as the environment for the notebook
when it executes. Defaults to `python3`.

- `vertex_container_name` - (Optional) The base container to use for the notebook
execution job. Defaults to `gcr.io/deeplearning-platform-release/base-cu110:latest`

[bucket]: https://cloud.google.com/storage/docs/creating-buckets
[auth]: https://github.com/google-github-actions/auth
Expand Down
13 changes: 11 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ inputs:
description: 'Add a comment to an open PR as the final step - defaults to "true"'
default: 'true'
required: false
kernel_name:
description: 'Notebook kernel to use for the execution environment - defaults to python3'
default: 'python3'
required: false
vertex_container_name:
description: 'The base container image to use. Defaults to the basic Python container.'
default: 'gcr.io/deeplearning-platform-release/base-cu110:latest'
required: false

runs:
using: 'composite'
Expand Down Expand Up @@ -76,7 +84,8 @@ runs:
source_location: 'gs://${{ inputs.gcs_source_bucket }}'
machine_type: '${{ inputs.vertex_machine_type }}'
region: '${{ inputs.region }}'
container: 'gcr.io/deeplearning-platform-release/base-cu110:latest'
kernel: '${{ inputs.kernel }}'
container: '${{ inputs.vertex_container_name }}'
run: |-
set -x;
echo '{"jobs": []}' > jobs.json
Expand All @@ -94,7 +103,7 @@ runs:
--display-name="${job_name}" \
--labels=commit_sha=${commit_sha} \
--worker-pool-spec=machine-type="${machine_type}",replica-count="1",container-image-uri="${container}" \
--args=nbexecutor,--input-notebook="${source_file}",--output-notebook="${output_file}",--kernel-name=python3);
--args=nbexecutor,--input-notebook="${source_file}",--output-notebook="${output_file}",--kernel-name="${kernel}");
echo $output | jq -c > training.json
jq '.jobs[.jobs | length] |= . + '$(cat training.json) jobs.json > jobs_new.json
Expand Down

0 comments on commit e372944

Please sign in to comment.