2929TAG_STEP = "step"
3030TAG_APP = "App"
3131NUM_USER_ATTEMPTS = 10 # number of attempts user gets at answering a question
32-
32+ EXTRA_TASK_PARAMS = {
33+ "job_id" : "{{job_id}}" ,
34+ "run_id" : "{{run_id}}" ,
35+ "parent_run_id" : "{{parent_run_id}}" ,
36+ }
3337DEBUG_NOTEBOOK = """
3438# Databricks notebook source
3539# MAGIC %md
6973
7074# COMMAND ----------
7175
72- import logging
73- import databricks.labs.ucx.runtime
74-
75- from pathlib import Path
76- from databricks.labs.ucx.__about__ import __version__
77- from databricks.labs.ucx.config import WorkspaceConfig
78- from databricks.labs.ucx.framework.tasks import _TASKS
79- from databricks.labs.ucx.framework.logger import _install
80- from databricks.sdk import WorkspaceClient
81-
82- task_name = dbutils.widgets.get('task')
83- current_task = _TASKS[task_name]
84-
85- _install()
86- print('UCX version: ' + __version__)
87- logging.getLogger("databricks").setLevel('DEBUG')
88-
89- cfg = WorkspaceConfig.from_file(Path("/Workspace{config_file}"))
76+ from databricks.labs.ucx.runtime import main
9077
91- current_task.fn(cfg)
78+ main(f'--config=/Workspace{config_file}',
79+ f'--task=' + dbutils.widgets.get('task'),
80+ f'--job_id=' + dbutils.widgets.get('job_id'),
81+ f'--run_id=' + dbutils.widgets.get('run_id'),
82+ f'--parent_run_id=' + dbutils.widgets.get('parent_run_id'))
9283"""
9384
9485logger = logging .getLogger (__name__ )
@@ -325,6 +316,7 @@ def _create_jobs(self):
325316 self ._deployed_steps = self ._deployed_steps ()
326317 desired_steps = {t .workflow for t in _TASKS .values ()}
327318 wheel_runner = None
319+
328320 if self ._override_clusters :
329321 wheel_runner = self ._upload_wheel_runner (remote_wheel )
330322 for step_name in desired_steps :
@@ -518,9 +510,8 @@ def _apply_cluster_overrides(settings: dict[str, any], overrides: dict[str, str]
518510 job_task .job_cluster_key = None
519511 if job_task .python_wheel_task is not None :
520512 job_task .python_wheel_task = None
521- job_task .notebook_task = jobs .NotebookTask (
522- notebook_path = wheel_runner , base_parameters = {"task" : job_task .task_key }
523- )
513+ params = {"task" : job_task .task_key } | EXTRA_TASK_PARAMS
514+ job_task .notebook_task = jobs .NotebookTask (notebook_path = wheel_runner , base_parameters = params )
524515 return settings
525516
526517 def _job_task (self , task : Task , dbfs_path : str ) -> jobs .Task :
@@ -555,7 +546,12 @@ def _job_notebook_task(self, jobs_task: jobs.Task, task: Task) -> jobs.Task:
555546 notebook_task = jobs .NotebookTask (
556547 notebook_path = remote_notebook ,
557548 # ES-872211: currently, we cannot read WSFS files from Scala context
558- base_parameters = {"inventory_database" : self ._current_config .inventory_database },
549+ base_parameters = {
550+ "inventory_database" : self ._current_config .inventory_database ,
551+ "task" : task .name ,
552+ "config" : f"/Workspace{ self ._config_file } " ,
553+ }
554+ | EXTRA_TASK_PARAMS ,
559555 ),
560556 )
561557
@@ -566,7 +562,7 @@ def _job_wheel_task(self, jobs_task: jobs.Task, task: Task, dbfs_path: str) -> j
566562 python_wheel_task = jobs .PythonWheelTask (
567563 package_name = "databricks_labs_ucx" ,
568564 entry_point = "runtime" , # [project.entry-points.databricks] in pyproject.toml
569- named_parameters = {"task" : task .name , "config" : f"/Workspace{ self ._config_file } " },
565+ named_parameters = {"task" : task .name , "config" : f"/Workspace{ self ._config_file } " } | EXTRA_TASK_PARAMS ,
570566 ),
571567 )
572568
0 commit comments