cli
cli copied to clipboard
[local cache] Initial implementation of the local cache layer
Changes
- added
libs/cachelibrary with a proposed caching interface and a single implementation:libs/cache/file_cache.go - implemented basic caching method
GetOrCompute - implemented background cleanup of old cache files
- added
databricks cache clearcommand - added
DATABRICKS_CACHE_DISABLEDenvironment variable to disable the cache layer - modified
populate_current_user.goto use the new caching library - added telemetry for local.cache hits and misses
Why
This is the first attempt to speed up subsequent databricks bundle commands that a bundle developer runs while developing a bundle
Tests
- changed existing acceptance tests to use a dedicated cache folder
- added new acceptance test for overall caching functionality and telemetry
- added new acceptance test for clearing the cache
- added unit tests for
libs/cache
Commit: https://github.com/databricks/cli/pull/3678/commits/ecc4e9c88f6050a737042bbc9844504a856c84f4
| Env | π¨βKNOWN | πβflaky | πβRECOVERED | πβSKIP | β βpass | πβskip | Time | |
|---|---|---|---|---|---|---|---|---|
| π¨β | aws linux | 7 | 2 | 371 | 628 | 20:08 | ||
| π¨β | aws windows | 7 | 2 | 373 | 626 | 23:16 | ||
| πβ | aws-ucws linux | 7 | 2 | 514 | 513 | 35:56 | ||
| πβ | aws-ucws windows | 2 | 6 | 2 | 515 | 511 | 36:08 | |
| πβ | azure linux | 6 | 1 | 4 | 365 | 627 | 32:17 | |
| πβ | azure windows | 5 | 1 | 4 | 368 | 625 | 27:43 | |
| πβ | azure-ucws linux | 1 | 4 | 510 | 512 | 37:25 | ||
| πβ | azure-ucws windows | 1 | 4 | 512 | 510 | 41:07 | ||
| πβ | gcp linux | 1 | 4 | 364 | 631 | 25:15 | ||
| πβ | gcp windows | 1 | 4 | 366 | 629 | 25:44 |
21 failing tests:
| Test Name | aws linux | aws windows | aws-ucws linux | aws-ucws windows | azure linux | azure windows | azure-ucws linux | azure-ucws windows | gcp linux | gcp windows | |
|---|---|---|---|---|---|---|---|---|---|---|---|
| π¨β | TestAccept | π¨βK | π¨βK | πβR | πβf | πβR | πβR | πβR | πβR | πβR | πβR |
| πβ | TestAccept/bundle/resources/dashboards/nested-folders/DATABRICKS_BUNDLE_ENGINE=direct | β βp | β βp | β βp | β βp | β βp | πβf | β βp | β βp | β βp | β βp |
| πβ | TestAccept/bundle/resources/dashboards/nested-folders/DATABRICKS_BUNDLE_ENGINE=terraform | β βp | β βp | β βp | β βp | β βp | πβf | β βp | β βp | β βp | β βp |
| πβ | TestAccept/bundle/resources/permissions | πβS | πβS | πβS | πβS | πβS | πβS | πβS | πβS | πβS | πβS |
| π¨β | TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions | π¨βK | π¨βK | πβR | πβR | πβS | πβS | πβS | πβS | πβS | πβS |
| π¨β | TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=direct | π¨βK | π¨βK | πβR | πβR | ||||||
| π¨β | TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/with_permissions/DATABRICKS_BUNDLE_ENGINE=terraform | π¨βK | π¨βK | πβR | πβR | ||||||
| π¨β | TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions | π¨βK | π¨βK | πβR | πβR | πβS | πβS | πβS | πβS | πβS | πβS |
| π¨β | TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=direct | π¨βK | π¨βK | πβR | πβR | ||||||
| π¨β | TestAccept/bundle/resources/permissions/jobs/destroy_without_mgmtperms/without_permissions/DATABRICKS_BUNDLE_ENGINE=terraform | π¨βK | π¨βK | πβR | πβR | ||||||
| πβ | TestAccept/bundle/resources/pipelines/allow-duplicate-names | β βp | β βp | β βp | β βp | β βp | πβf | β βp | β βp | β βp | β βp |
| πβ | TestAccept/bundle/resources/pipelines/allow-duplicate-names/DATABRICKS_BUNDLE_ENGINE=terraform | β βp | β βp | β βp | β βp | β βp | πβf | β βp | β βp | β βp | β βp |
| πβ | TestAccept/bundle/run/app-with-job | πβS | πβS | πβS | πβS | πβS | πβS | πβS | πβS | πβS | πβS |
| πβ | TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=terraform/UV_PYTHON=3.11 | β βp | β βp | β βp | β βp | πβf | β βp | β βp | β βp | β βp | β βp |
| πβ | TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=terraform/UV_PYTHON=3.12 | β βp | β βp | β βp | β βp | πβf | β βp | β βp | β βp | β βp | β βp |
| πβ | TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=terraform/UV_PYTHON=3.13 | β βp | β βp | β βp | β βp | πβf | β βp | β βp | β βp | β βp | β βp |
| πβ | TestAccept/ssh/connection | β βp | β βp | β βp | πβf | β βp | β βp | β βp | β βp | β βp | β βp |
| πβ | TestExportDir | β βp | β βp | β βp | β βp | πβf | β βp | β βp | β βp | β βp | β βp |
| πβ | TestImportDirWithOverwriteFlag | β βp | β βp | β βp | β βp | β βp | πβf | β βp | β βp | β βp | β βp |
| πβ | TestWorkpaceExportPrintsContents | β βp | β βp | β βp | β βp | πβf | β βp | β βp | β βp | β βp | β βp |
| πβ | TestWorkspaceList | β βp | β βp | β βp | β βp | πβf | β βp | β βp | β βp | β βp | β βp |
Top 50 slowest tests (at least 2 minutes):
| duration | env | testname |
|---|---|---|
| 14:22 | azure-ucws windows | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform |
| 10:23 | azure-ucws windows | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct |
| 6:27 | gcp linux | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform |
| 5:58 | aws windows | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform |
| 5:46 | gcp windows | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform |
| 5:43 | aws-ucws windows | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct |
| 5:42 | gcp linux | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct |
| 5:39 | aws-ucws linux | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform |
| 5:39 | aws windows | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct |
| 5:27 | aws-ucws windows | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform |
| 5:16 | azure windows | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform |
| 4:33 | azure windows | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct |
| 4:12 | azure-ucws linux | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct |
| 4:10 | azure-ucws linux | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform |
| 3:53 | azure linux | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform |
| 3:42 | aws-ucws windows | TestAccept/bundle/templates/default-python/combinations/serverless/DATABRICKS_BUNDLE_ENGINE=terraform/DLT=yes/NBOOK=no/PY=yes |
| 3:31 | azure linux | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct |
| 3:08 | azure-ucws windows | TestAccept/bundle/resources/synced_database_tables/basic |
| 3:03 | azure linux | TestAccept/bundle/resources/experiments/basic/DATABRICKS_BUNDLE_ENGINE=direct |
| 2:59 | gcp windows | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct |
| 2:58 | gcp windows | TestAccept/bundle/resources/experiments/basic/DATABRICKS_BUNDLE_ENGINE=terraform |
| 2:54 | azure-ucws linux | TestAccept/bundle/resources/registered_models/basic/DATABRICKS_BUNDLE_ENGINE=terraform |
| 2:43 | aws linux | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct |
| 2:33 | azure windows | TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=terraform/UV_PYTHON=3.12 |
| 2:32 | azure-ucws linux | TestAccept/bundle/resources/synced_database_tables/basic |
| 2:32 | aws linux | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=terraform |
| 2:30 | azure-ucws linux | TestAccept/bundle/resources/registered_models/basic/DATABRICKS_BUNDLE_ENGINE=direct |
| 2:24 | aws-ucws linux | TestAccept/bundle/resources/registered_models/basic/DATABRICKS_BUNDLE_ENGINE=terraform |
| 2:23 | gcp windows | TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=direct/UV_PYTHON=3.9 |
| 2:22 | azure-ucws windows | TestAccept/bundle/templates/default-python/combinations/classic/DATABRICKS_BUNDLE_ENGINE=terraform/DLT=yes/NBOOK=yes/PY=yes |
| 2:22 | azure-ucws linux | TestAccept/bundle/resources/experiments/basic/DATABRICKS_BUNDLE_ENGINE=terraform |
| 2:20 | aws-ucws linux | TestAccept/bundle/resources/clusters/deploy/update-after-create/DATABRICKS_BUNDLE_ENGINE=direct |
| 2:20 | aws-ucws windows | TestAccept/bundle/templates/default-python/combinations/classic/DATABRICKS_BUNDLE_ENGINE=terraform/DLT=yes/NBOOK=yes/PY=yes |
| 2:17 | azure linux | TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=terraform/UV_PYTHON=3.10 |
| 2:17 | azure-ucws windows | TestAccept/bundle/resources/registered_models/basic/DATABRICKS_BUNDLE_ENGINE=terraform |
| 2:16 | aws linux | TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=terraform/UV_PYTHON=3.9 |
| 2:15 | azure linux | TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=direct/UV_PYTHON=3.11 |
| 2:15 | aws-ucws linux | TestAccept/bundle/resources/models/basic/DATABRICKS_BUNDLE_ENGINE=direct |
| 2:14 | azure linux | TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=direct/UV_PYTHON=3.10 |
| 2:13 | aws linux | TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=terraform/UV_PYTHON=3.12 |
| 2:11 | aws-ucws windows | TestAccept/bundle/resources/experiments/basic/DATABRICKS_BUNDLE_ENGINE=terraform |
| 2:11 | aws-ucws windows | TestAccept/bundle/templates/default-python/combinations/serverless/DATABRICKS_BUNDLE_ENGINE=terraform/DLT=no/NBOOK=no/PY=yes |
| 2:10 | azure-ucws linux | TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=terraform/UV_PYTHON=3.10 |
| 2:09 | azure-ucws windows | TestAccept/bundle/templates/default-python/combinations/classic/DATABRICKS_BUNDLE_ENGINE=terraform/DLT=yes/NBOOK=no/PY=yes |
| 2:08 | gcp linux | TestAccept/bundle/templates/default-python/combinations/classic/DATABRICKS_BUNDLE_ENGINE=direct/DLT=yes/NBOOK=yes/PY=yes |
| 2:08 | azure-ucws linux | TestAccept/bundle/templates/default-python/combinations/classic/DATABRICKS_BUNDLE_ENGINE=terraform/DLT=yes/NBOOK=yes/PY=yes |
| 2:07 | azure-ucws linux | TestAccept/bundle/resources/models/basic/DATABRICKS_BUNDLE_ENGINE=terraform |
| 2:07 | azure-ucws linux | TestAccept/bundle/templates/default-python/combinations/classic/DATABRICKS_BUNDLE_ENGINE=terraform/DLT=yes/NBOOK=no/PY=no |
| 2:07 | gcp linux | TestAccept/bundle/resources/models/basic/DATABRICKS_BUNDLE_ENGINE=direct |
| 2:06 | azure linux | TestAccept/bundle/templates/default-python/integration_classic/DATABRICKS_BUNDLE_ENGINE=direct/UV_PYTHON=3.9 |
Do we have a benchmark that shows the cases where this helps and what's the impact? It's quite some code to maintain, should have a clear benefit.
@denik no benchmark yet, but the plan was to release this and add metrics on cache hit and ho much it would have saved