(Legacy) Global init scripts

Warning

Legacy global init scripts and cluster-named init scripts are deprecated and cannot be used in new workspaces starting February 21, 2023. On December 1st, 2023, Databricks will disable legacy global init scripts for all workspaces.

Legacy global init scripts run on every cluster. They are less secure than the new global init script framework, silently ignore failures, and cannot reference environment variables.

Databricks recommends migrating all existing legacy global init scripts to the new global init script framework.

Migrate from legacy to new global init scripts

If your Databricks workspace was launched before August 2020, you might still have legacy global init scripts. Legacy global init scripts have been deprecated and are no longer available on new workspaces. They should not be used.

Note

On September 1st, 2023, Databricks will disable legacy global init scripts for all workspaces. Databricks recommends that you migrate your legacy global init scripts to the current global init script framework as soon as possible.

Automated migration notebook

Databricks Engineering has created a notebook to help automate the migration process from legacy global init scripts. For instructions and a link to the notebook download, see Legacy global init script migration notebook.

Manual migration instructions

To migrate from legacy global init scripts to the new global init scripts:

  1. Copy your existing legacy global init scripts from their reserved DBFS location (/databricks/init) and add them to the new global init script framework using either the UI or the REST API. See Use global init scripts.

    Keep them disabled until you have completed the next step.

  2. Disable all legacy global init scripts.

    In the admin settings, go to the Global Init Scripts tab and toggle off the Legacy Global Init Scripts switch.

    Disable legacy global init scripts

    Note

    If you don’t have access to the UI, remove all files from the /databricks/init location to stop the execution of legacy init scripts.

  3. Enable your new global init scripts.

    On the Global Init Scripts tab, toggle on the Enabled switch for each init script you want to enable.

  4. Restart all clusters.

Important

Once legacy global init scripts are disabled, legacy scripts stop running immediately. This has two important impacts:

  • Legacy scripts and new global init scripts are not run on nodes added when a running cluster autoscales. To ensure that new scripts run on all clusters and new nodes on existing clusters, you must restart all clusters.

  • Non-idempotent scripts may need to be modified when you migrate to the new global init script framework and disable legacy scripts.