cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Databricks Asset Bundles: issue with python_file path in spark_python_task

ext07_rvoort
Visitor

Hi,

I am trying to run a python file which is stored in src folder. However, I am getting the following error: Error: cannot update job: Invalid python file reference: src/get_git_credentials.py. Please visit the Databricks user guide for supported python references

Here is my task definition:

resources:
  jobs:
    clicksend_elt:
      name: clicksend_elt
      schedule:
        quartz_cron_expression: 0 0 9-18 ? * MON-FRI *
        timezone_id: Europe/Luxembourg
        pause_status: ${var.clicksend_schedule_status}
      tasks:
        - task_key: get_git_credentials
          job_cluster_key: clicksend_job_cluster
          email_notifications: {}
          run_if: ALL_SUCCESS
          spark_python_task:
            python_file: src/get_git_credentials.py

And the absolute path of the file I am trying to run is (my DAB project being data_lakehouse):

ext07_rvoort_2-1759997838194.png

In the databricks.yml file I include resources with:

include:
  - resources/*.yml

How should I input the path of the file? Somehow the only was that it works is by providing the absolute path:

python_file: "${workspace.root_path}/files/src/get_git_credentials.py"

 

1 REPLY 1

szymon_dybczak
Esteemed Contributor III

Hi @ext07_rvoort ,

Could you try specify it in relative way:

python_file: ../src/get_git_credentials.py

So, in my setup I have following directory structure:

root folder:
  - databricks.yml file
  - src/
  - resources/job.yml

And then to refer in job.yml to source files that reside in src in need to provide path in following way:

../src/ingestion/extraction.py

Join Us as a Local Community Builder!

Passionate about hosting events and connecting people? Help us grow a vibrant local community—sign up today to get started!

Sign Up Now