databricks-cli icon indicating copy to clipboard operation
databricks-cli copied to clipboard

Add --json-file for --notebook-params under jobs run-now

Open ghost opened this issue 7 years ago • 9 comments

I'm trying to run a job from CLI and I'm able to use a command like this:

databricks jobs run-now --job-id 1 --notebook-params '{"widget1": "widget1value","widget2": "widget2value"}'

This gets to be very long and cumbersome, I'm using 1 data source that requires 5 parameters. As I continue making more complex notebooks, I'm expecting to use more and more notebook parameters.

However, I'd like to instead provide a JSON file, similar to how cluster creation works at the CLI. Something like this:

databricks jobs run-now --job-id 1 --json-file parameters.json

Is that possible?

ghost avatar Feb 13 '18 21:02 ghost

Sounds reasonable assuming parameters.json includes notebook_params as a top level key.

andrewmchen avatar Feb 16 '18 23:02 andrewmchen

That's not a problem. Having the values stored in an external file allows me to store things like access keys/secrets stored in the JSON file, separate from my shell script that calls the run-now command and then I can pass them into my job via widgets.

ghost avatar Feb 17 '18 00:02 ghost

Sounds good. If you would like, feel free to make a small PR adding this feature, you'd probably need to make a small change https://github.com/databricks/databricks-cli/blob/master/databricks_cli/jobs/api.py and here https://github.com/databricks/databricks-cli/blob/master/databricks_cli/jobs/cli.py.

andrewmchen avatar Feb 20 '18 19:02 andrewmchen

OK. I've made small changes and submitted PRs but I have zero faith that I did this correctly. Sorry about that.

ghost avatar Feb 20 '18 20:02 ghost

Hi any progress on this having a seperate json file?

kurtmaile avatar Mar 19 '18 03:03 kurtmaile

Curious to know what happened with this

thesqlpro avatar Jun 30 '20 15:06 thesqlpro

Very interested in any progress as well

Blackkadder avatar Feb 01 '22 14:02 Blackkadder

Looking for this feature to rolled out.

itsmenandess avatar Feb 02 '23 23:02 itsmenandess

Could use this if you need a workaround: databricks jobs run-now --job-id 1234567891011121 --notebook-params "$(cat path/to/params.json)"

arvkevi avatar Dec 08 '23 20:12 arvkevi