You are creating a Lakeflow Job with two tasks: a notebook task named prepare and a Python script task named load. Both code files are stored on the release branch of an Azure Repos Git repository.
Requirements:
- Both tasks must run code from the
releasebranch of the Git repository, and each run must execute against the specific commit that exists when the run starts. - The
loadtask is given a parameter whose value is{{job.trigger.time.iso_date}}, and the script must read this value.
How should you configure the job?
The Git provider source meets the versioning requirement. All tasks in the job share the same Git reference, and Azure Databricks snapshots the code at run time so that each run uses a specific commit. Python script tasks receive their parameters, including dynamic values such as {{job.trigger.time.iso_date}}, as command-line arguments. Notebooks are the task type that reads parameters with dbutils.widgets.get().
- Not correct: Set the source of both tasks to Workspace, and have the script read the date from its command-line arguments. A Workspace source runs code stored directly in the workspace. Only the Git provider source captures a snapshot so that the job executes against a specific commit.
- Not correct: Set the source of both tasks to DBFS/ADLS, and have the script read the date from its command-line arguments. The DBFS/ADLS source option applies to Python scripts stored in volumes or cloud storage, not to the notebook task. It also does not pin the run to a Git commit.
- Correct: Set the source of both tasks to Git provider on the
releasebranch, and have the script read the date from its command-line arguments. A Git provider source gives all tasks the same Git reference and runs against a code snapshot taken at run time. Python scripts receive parameters as command-line arguments. - Not correct: Set the source of both tasks to Git provider on the
releasebranch, and have the script read the date withdbutils.widgets.get(). The Git configuration is correct, butdbutils.widgets.get()is how notebooks retrieve parameter values. Python script tasks receive parameters as command-line arguments.