- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-24-2023 09:00 PM
@Sulfikkar Basheer Shylaja :
It looks like you are trying to use an init script with a Databricks cluster that has a custom Docker container. However, the ClusterInitScriptFileArgs method is only used for file-based init scripts that can be executed on a Databricks cluster without a custom Docker container.
If your Databricks cluster has a custom Docker container, you need to use
ClusterInitScript method instead. You can pass a list of commands or a path to the script file in the command parameter of the ClusterInitScript method.
Here's an example of how you can use the ClusterInitScript method with a custom Docker container:
init_scripts = [
db.ClusterInitScriptArgs(
script=db.ClusterInitScript(
command=[
"bash",
"/path/to/your/script.sh",
"--param1=value1",
"--param2=value2"
]
)
)
]
cluster = db.Cluster(
"example-cluster",
# ... other parameters ...
init_scripts=init_scripts,
custom_tags=custom_tags
)Make sure to replace /path/to/your/script.sh with the actual path to your init script, and provide any necessary parameters or environment variables in the
command parameter.
Regarding the secret scope, you can pass the value of DEVOPS_GIT_PAT as an environment variable to your init script using the spark_env_vars parameter:
spark_env_vars = {
"DEVOPS_GIT_PAT": db.Secret("azureScope/devopsGitPat")
}
cluster = db.Cluster(
"example-cluster",
# ... other parameters ...
init_scripts=init_scripts,
spark_env_vars=spark_env_vars
)In this example, azureScope/devopsGitPat is the name of the Databricks secret scope that contains the DEVOPS_GIT_PAT secret.