Pass the notebook parameter values from the spark job

Pass the notebook parameter values from the spark job

Pass the notebook parameter values from the spark job is a databricks notebook solution about how the values of the databricks notebook parameters passed from the databricks JOB.

Databricks :
Microsoft Azure databricks is an analytics service. Provides the users a spark-based platform on Azure for big data processing. Azure databricks offering as Platform as a Service(PaaS) model on cloud.

Notebooks:
Databricks Notebooks provide the users to a UI kind used to interact with different services using multi-language support i.e. Python, Scala, R, and SQL.

Databricks Job:
Databricks Job is used to run the notebook or JAR libraries on schedules. In databricks workspace, we can create a Job by attaching the notebook and defining some required parameters.

steps to pass the parameter values from the data bricks job to the notebook

Step 1:
Create parameters in the notebook using the widgets.
What is a widget? how to use widget to create parameters in the notebook?  to know more, please refer to the below post.

Step 2:  
Create a databricks JOB, or schedule the notebook using the same parameters created in step 1.

What is a spark job? how to create a spark job? how to schedule the notebook with spark job? to know more, please refer to the below post.
Click here 👉 Schedule the notebook in databrick 

Step 3: 
Navigate to the Job you created, and select the parameters either in {key, value} pairs or in JSON format.
For example:
Create one 'day' parameter with value 12 as a key-value pair {"day", "12"}, means you're passing the day parameter value as 12 to the notebook.

Step 4: 
Once the parameters are confirmed, click on run now option to run the job for the first time.

Step 5: 
Check the current job status. The job status is like changing from pending, running, and successful, in case of no errors found.

Referral links:  

The above two links are the additional links provided for reference.
To know how to access the parameter values in the notebook? please go through the referral links itself.

Conclusion

If the job status is 'failed', click on the specific run link to know more details about the error. When we click on the link, it redirects to the notebook and shows the cell wise execution details. Once the errors are fixed run the job again.
All the parameter values are considered to be in strings only.


No comments:

Post a Comment