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:ย 

Using run_job_task in Databricks Asset Bundles

TimReddick
Contributor

Do Databrick Asset Bundles support run_job_task tasks?

I've made various attempts to add a run_job_task with a specified job_id. See my the code_snippet below. I tried substituting the job_id using ${...} syntax, as well as three other ways which I've commented out. I've tried to pass the id as both a string and an int.

When I pass a string, it returns: "error unmarshaling JSON: json: cannot unmarshal string into Go struct field RunJobTask.resources.jobs.tasks.run_job_task.job_id of type int."

When I pass an int, it returns "Error: cannot create job: Job 0 does not exist." However, the when I pass the int bundle validate does succeed.

 

resources:
  jobs:
    product_dimension_template:
      name: "Product Dimension Template"
      tasks:
        - task_key: product_dimension
          notebook_task:
            notebook_path: ./app/product_dim.py
          existing_cluster_id: 0723-185453-mypxim3x # tr_compute_autoscale
      tags:
        product: FCOE_measure_prototype

    product_dimension_ACDS_product_div:
      name: "Product Dimension - ACDS Product Div"
      tasks:
        - task_key: product_dimension_ACDS_product_div
          run_job_task:
            job_id: ${resources.jobs.product_dimension_template.id}
            # job_id: "${resources.jobs.product_dimension_template.id}"
            # job_id: "1032011550656546"
            # job_id: 1032011550656546
            notebook_params:
              product_dim_source": ACDS_product_div
              product_dim_source_path": ${var.ACDS_product_div_path}
              product_dim_checkpoint_path": ${var.ACDS_product_div_checkpoint_path}
              product_dim_table_path": ${var.product_dim_table_path}
      tags:
        product: FCOE_measure_prototype

 

6 REPLIES 6

Hi, thanks for the response! I've tried your suggestions, but I'm still having issues. The job for product_dimension_template definitely exists. It was deployed via the same DAB in which I'm trying to define the `run_job_task`.

TimReddick_0-1695035480879.png

I tried two different things for testing:

  1. Provide the job_id explicitly as an int (not using string substitution).
  2. Provide the job_id via `${resources.jobs.product_dimension_template.job_id}` as you suggested.

 

product_dimension_ACDS_product_div:
      name: "Product Dimension - ACDS Product Div"
      tasks:
        - task_key: product_dimension_ACDS_product_div
          run_job_task:
            job_id: 892367837319872

 

 

product_dimension_ACDS_product_div:
      name: "Product Dimension - ACDS Product Div"
      tasks:
        - task_key: product_dimension_ACDS_product_div
          run_job_task:
            job_id: ${resources.jobs.product_dimension_template.job_id}

 

 

  • In case (1), I get the following error:

 

Starting resource deployment
Error: terraform apply: exit status 1

Error: cannot create job: Job 0 does not exist.

  with databricks_job.product_dimension_ACDS_product_div,
  on bundle.tf.json line 79, in resource.databricks_job.product_dimension_ACDS_product_div:
  79:       },

 

  • In case (2), I get the following error:

 

Error: failed to load /Users/t574461/code_saas/fcoe_measure_prototype/conf/bundle.product_dim.yml: error unmarshaling JSON: json: cannot unmarshal string into Go struct field RunJobTask.resources.jobs.tasks.run_job_task.job_id of type int

 

In one case, it's inferring the job_id as 0 for some reason, and in the other it seems `${resources.jobs.product_dimension_template.job_id}` returns a string when it expects an int.

Vaisakh_Anil
New Contributor II

Have you been able to resolve this issue? I'm facing the same issue.

Hi, no I haven't resolved yet. I was hoping to hear back from @Retired_mod. This will be a great feature for us if we can get passed this obstacle with the DAB.

kyle_r
New Contributor II

We are having the exact same issue and this is a blocker for us deploying using asset bundles. 

kyle_r
New Contributor II

Ah, I see it is a known bug in the Databricks CLI: Asset bundle run_job_task fails ยท Issue #812 ยท databricks/cli (github.com). Anyone facing this issue should comment on and keep an eye on that ticket for resolution. 

Thanks for point me to this @kyle_r! Good to know they're aware of it and working on a solution.

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