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 Bundle artifacts with module out of the bundle root (sync path)

Jorge3
New Contributor III

Hello everyone!
Iā€™m currently working on a project with shared functionalities across different Databricks bundles. I have separate folders for each bundle, along with a common libs/ folder that holds some Python modules intended to be shared across bundles. My directory structure looks like this:

 

backend/
ā”œā”€ā”€ libs/
ā”‚   ā”œā”€ā”€ new_package/
ā”‚   ā”‚   ā”œā”€ā”€ src/
ā”‚   ā”‚   ā”‚   ā””ā”€ā”€ new_package/
ā”‚   ā”‚   ā”‚       ā”œā”€ā”€ __init__.py
ā”‚   ā”‚   ā”‚       ā””ā”€ā”€ functions.py
ā”‚   ā”‚   ā”œā”€ā”€ tests/
ā”‚   ā”‚   ā”œā”€ā”€ README.md 
ā”‚   ā”‚   ā”œā”€ā”€ requirements.txt    
ā”‚   ā”‚   ā””ā”€ā”€ pyproject.toml
ā”‚   ā”‚
ā”‚   ā””ā”€ā”€ second_package/
ā”‚       ā”œā”€ā”€ src/
ā”‚       ā”‚   ā””ā”€ā”€ second_package/
ā”‚       ā”‚       ā”œā”€ā”€ __init__.py
ā”‚       ā”‚       ā””ā”€ā”€ functions.py
ā”‚       ā”œā”€ā”€ tests/
ā”‚       ā”œā”€ā”€ README.md 
ā”‚       ā”œā”€ā”€ requirements.txt    
ā”‚       ā””ā”€ā”€ pyproject.toml
ā”‚
ā”œā”€ā”€ bundle_1/
ā”‚   ā”œā”€ā”€ jobs/
ā”‚   ā”œā”€ā”€ tests/
ā”‚   ā”œā”€ā”€ README.md
ā”‚   ā”œā”€ā”€ requirements.txt
ā”‚   ā””ā”€ā”€ databricks.yml
ā”‚
ā””ā”€ā”€ bundle_2/
    ā”œā”€ā”€ jobs/
    ā”œā”€ā”€ tests/
    ā”œā”€ā”€ README.md
    ā”œā”€ā”€ requirements.txt
    ā””ā”€ā”€ databricks.yml

 

Iā€™m using Databricks artifacts to build the wheel as per the documentation. Since my modules reside outside of the bundle root, I use the sync paths mapping to include files located outside the bundle root. However, when I try deploying from the CLI, I encounter this error:

Error: build failed default, error: chdir C:\Users\***\python_monorepo\bundle_1\libs\new_package: The system cannot find the path specified., output:

It seems that the bundle is unable to access the external module. Hereā€™s my databricks.yml configuration:

 

 

bundle:
  name: deploy-package-job
resources:
  jobs:
    deploy-package-job: 
      name: deploy-package-job
      job_clusters:
        - job_cluster_key: common-cluster
          new_cluster:
            spark_version: 13.3.x-scala2.12
            node_type_id: Standard_DS3_v2
            num_workers: 1
      tasks:
        - task_key: notebook-task
          job_cluster_key: common-cluster
          notebook_task:
            notebook_path: ./jobs/notebook.ipynb
          libraries:
            - whl: ../libs/dist/*.whl
sync:
  paths:
    - ../libs
artifacts:
  default:
    type: whl
    build: python -m build
    path: ../libs/new_package

targets:
  dev:
    mode: development
    default: true
    workspace:
      host: https://***

  prod:
    mode: production
    workspace:
      host: https://***

 

Does anyone have suggestions or insights on why the bundle canā€™t locate the external module? Any advice would be greatly appreciated!

Thank you!

0 REPLIES 0

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you wonā€™t want to miss the chance to attend and share knowledge.

If there isnā€™t a group near you, start one and help create a community that brings people together.

Request a New Group