Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 09:14 PM
@Priya K :
Yes, there are some ways to mitigate the risks of options 2 and 3:
- To mitigate the risks of using option 2 (reloading the module), you can try to limit the scope of the module reload to a specific part of your code that doesn't have any running tasks that use the old version of the library. For example, you can use a try-except block to catch any exceptions that might be raised during the reload process, and then retry the operation later when the cluster is idle.
- To mitigate the risks of using option 3 (restarting the Python interpreter), you can try to schedule the restart during a maintenance window when there are no running tasks on the cluster. You can also use a similar try-except block as in option 2 to catch any exceptions that might be raised during the restart process, and then retry the operation later when the cluster is idle.
Regarding your second question, it is possible to check whether the existing tasks are completed and the cluster is idle before attempting to reload the module or restart the interpreter. One way to do this is by monitoring the active task count and cluster utilization using the Databricks REST API or the Databricks CLI. You can also use the Databricks Jobs API to schedule the module reload or interpreter restart during a specific time window when there are no running tasks on the cluster.