databricks-cli
databricks-cli copied to clipboard
Add --json-file for --notebook-params under jobs run-now
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?
Sounds reasonable assuming parameters.json
includes notebook_params
as a top level key.
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.
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.
OK. I've made small changes and submitted PRs but I have zero faith that I did this correctly. Sorry about that.
Hi any progress on this having a seperate json file?
Curious to know what happened with this
Very interested in any progress as well
Looking for this feature to rolled out.
Could use this if you need a workaround:
databricks jobs run-now --job-id 1234567891011121 --notebook-params "$(cat path/to/params.json)"