run-notebook icon indicating copy to clipboard operation
run-notebook copied to clipboard

Notebook extension is stripped off in jobs spec

Open iandexter opened this issue 3 years ago • 3 comments

Consider the following action.yml:

- name: Run notebook
  uses: databricks/run-notebook@main
  with:
    local-notebook-path: notebooks/test.py
    ...
    git-provider: 'gitHubEnterprise'
    git-commit: ${{ github.sha }}
    ...

The jobs spec in Databricks is:

{
  name: "run tests"
  tasks {
    task_key: "notebook-task"
    task {
      notebook_task {
        notebook_path: "notebooks/test"
      }
    }
    cluster_spec {
      existing_cluster_id: "REDACTED"
    }
  }
  git_source {
    git_url: "REDACTED"
    git_provider: "gitHubEnterprise"
    git_commit: "REDACTED"
  }
}

This results in a job run failure: Notebook not found: notebooks/test

It may be because the extension is stripped from the local-notebook-path?

iandexter avatar Nov 18 '22 15:11 iandexter

Have you seen this known limitation:  

https://github.com/databricks/run-notebook/blob/main/action.yml#L143-L146

Your notebook must be a Databricks notebook exported as a source file. If you are writing a python file outside of Databricks and want to convert it to Databricks notebook format such that it can run as notebook on Databricks using this action follow these instructions https://docs.databricks.com/notebooks/notebooks-manage.html#convert-a-file-to-a-notebook

# Databricks notebook source be the first line in your python file notebooks/test.py

mohamad-arabi avatar Nov 18 '22 16:11 mohamad-arabi

The stripping of extension is expected behavior

https://github.com/databricks/run-notebook/blob/main/packages/common/src/utils.ts#L61-L63

mohamad-arabi avatar Nov 18 '22 16:11 mohamad-arabi

@mohamad-arabi -- I've raised the PR above to clarify this limitation.

iandexter avatar Nov 24 '22 14:11 iandexter