mirror of https://github.com/databricks/cli.git
142 lines
4.0 KiB
Plaintext
142 lines
4.0 KiB
Plaintext
|
|
=== variable file
|
|
>>> $CLI bundle validate -o json --var-file=var_files/normal.json
|
|
{
|
|
"job_cluster_key": "mlops_stacks-cluster",
|
|
"new_cluster": {
|
|
"node_type_id": "Standard_DS3_v2",
|
|
"num_workers": 2
|
|
}
|
|
}
|
|
|
|
=== default variable file (see .databricks/*)
|
|
>>> $CLI bundle validate -o json --target with-default-variable-file
|
|
{
|
|
"job_cluster_key": "mlops_stacks-cluster-2",
|
|
"new_cluster": {
|
|
"node_type_id": "Standard_DS3_v3",
|
|
"num_workers": 9
|
|
}
|
|
}
|
|
|
|
=== variable file and variable flag
|
|
>>> $CLI bundle validate -o json --var-file=var_files/normal.json --var=cluster_key=mlops_stacks-cluster-overriden
|
|
{
|
|
"job_cluster_key": "mlops_stacks-cluster-overriden",
|
|
"new_cluster": {
|
|
"node_type_id": "Standard_DS3_v2",
|
|
"num_workers": 2
|
|
}
|
|
}
|
|
|
|
=== variable file and environment variable
|
|
>>> BUNDLE_VAR_cluster_key=incorrectly-overriden $CLI bundle validate -o json --var-file=var_files/normal.json
|
|
{
|
|
"job_cluster_key": "mlops_stacks-cluster",
|
|
"new_cluster": {
|
|
"node_type_id": "Standard_DS3_v2",
|
|
"num_workers": 2
|
|
}
|
|
}
|
|
|
|
=== file not found
|
|
>>> errcode $CLI bundle validate -o json --var-file=var_files/not_found.json
|
|
Error: failed to read variables file: open var_files/not_found.json:<stripped>
|
|
|
|
|
|
Exit code: 1
|
|
{
|
|
"job_cluster_key": "${var.cluster_key}",
|
|
"new_cluster": {
|
|
"node_type_id": "${var.cluster.node_type_id}",
|
|
"num_workers": "${var.cluster_workers}"
|
|
}
|
|
}
|
|
|
|
=== file cannot be parsed
|
|
>>> errcode $CLI bundle validate -o json --var-file=var_files/invalid_json.json
|
|
Error: failed to parse variables file var_files/invalid_json.json: error decoding JSON at :0:0: invalid character 'o' in literal false (expecting 'a')
|
|
|
|
|
|
Exit code: 1
|
|
{
|
|
"job_cluster_key": "${var.cluster_key}",
|
|
"new_cluster": {
|
|
"node_type_id": "${var.cluster.node_type_id}",
|
|
"num_workers": "${var.cluster_workers}"
|
|
}
|
|
}
|
|
|
|
=== file has wrong structure
|
|
>>> errcode $CLI bundle validate -o json --var-file=var_files/wrong_file_structure.json
|
|
Error: failed to parse variables file: var_files/wrong_file_structure.json:1:1: expected a map, found a sequence
|
|
|
|
Variables file must be a JSON object with the following format:
|
|
{"var1": "value1", "var2": "value2"}
|
|
|
|
|
|
Exit code: 1
|
|
{
|
|
"job_cluster_key": "${var.cluster_key}",
|
|
"new_cluster": {
|
|
"node_type_id": "${var.cluster.node_type_id}",
|
|
"num_workers": "${var.cluster_workers}"
|
|
}
|
|
}
|
|
|
|
=== file has variable name that is not defined
|
|
>>> errcode $CLI bundle validate -o json --var-file=var_files/undeclared.json
|
|
Error: variable undeclared_var has not been defined
|
|
|
|
|
|
Exit code: 1
|
|
{
|
|
"job_cluster_key": "${var.cluster_key}",
|
|
"new_cluster": {
|
|
"node_type_id": "${var.cluster.node_type_id}",
|
|
"num_workers": "${var.cluster_workers}"
|
|
}
|
|
}
|
|
|
|
=== file has variable name that is complex but default is string
|
|
>>> errcode $CLI bundle validate -o json --var-file=var_files/complex_to_string.json
|
|
Error: expected a map to index "variables.cluster.value.node_type_id", found string
|
|
|
|
|
|
Exit code: 1
|
|
{
|
|
"job_cluster_key": "${var.cluster_key}",
|
|
"new_cluster": {
|
|
"node_type_id": "${var.cluster.node_type_id}",
|
|
"num_workers": "${var.cluster_workers}"
|
|
}
|
|
}
|
|
|
|
=== file has variable name that is string but default is complex
|
|
>>> errcode $CLI bundle validate -o json --var-file=var_files/string_to_complex.json
|
|
Error: failed to assign map[node_type_id:Standard_DS3_v2] to cluster_key: variable type is not complex
|
|
|
|
|
|
Exit code: 1
|
|
{
|
|
"job_cluster_key": "${var.cluster_key}",
|
|
"new_cluster": {
|
|
"node_type_id": "${var.cluster.node_type_id}",
|
|
"num_workers": "${var.cluster_workers}"
|
|
}
|
|
}
|
|
|
|
=== variable is required but it's not provided in the file
|
|
>>> errcode $CLI bundle validate -o json --target without-defaults --var-file=var_files/without_required.json
|
|
Error: no value assigned to required variable cluster. Assignment can be done using "--var" or "--var-file", by setting the BUNDLE_VAR_cluster environment variable, or in .databricks/bundle/<target>/variable-overrides.json file
|
|
|
|
|
|
Exit code: 1
|
|
{
|
|
"job_cluster_key": "${var.cluster_key}",
|
|
"new_cluster": {
|
|
"node_type_id": "${var.cluster.node_type_id}",
|
|
"num_workers": "${var.cluster_workers}"
|
|
}
|
|
}
|