Dropdown for parameters in a job

cmilligan
Contributor II

I want to be able to denote the type of run from a predetermined list of values that a user can choose from when kicking off a run using different parameters. Our team does standardized job runs on a weekly cadence but can have timeframes that changed depending on the month or if it is a one off run to test. I am wanting to change the behavior of the run depending on the type of run it is and want to have users choose from a list to reduce errors like misspellings. Is there a good option to do this inside of the job itself, rather than a notebook?

UmaMahesh1
Honored Contributor III

Hi @Coleman Milligan​ 

Checking the old unanswered questions and stumbled across this.

You can do that using the databricks widgets.

dbutils.widgets.dropdown("state", "CA", ["CA", "IL", "MI", "NY", "OR", "VA"])

If this widget is not helping you in passing parameters, you can do a try catch in all the notebooks to check if the parameter value you are passing is actually in the list of strings you have.

Hope this helps.

Cheers.

Uma Mahesh D

Hi @Uma Maheswara Rao Desula​ , thank you for the reply.

I'm actually wondering if there is a way to do this within the job ui using the 'run with different parameters' functionality.

It would be the environment key that I'm wanting to restrict user inputs into a predetermined list.

Screenshot_20221207_113039

dev56
New Contributor II

Hi @cmilligan , I have a similar requirement and would really be grateful if you could provide me with any information on how to fix this issue. Thanks a lot!

Leon_K
New Contributor II

I'm looking to this too. Wonder if there a way to make as a drop down for a job parameter