-
Notifications
You must be signed in to change notification settings - Fork 127
Initial implementation of the local cache layer #3678
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
75a0eab
e5c1b46
09d972a
71de033
c982a6e
ad7f41d
6565558
489cb3e
ea54f71
bdae5a5
dd6943d
6acaa44
de89c9b
e3a0239
6efc941
9db3ee5
0e47cf1
e48ca3d
a338c05
a37f176
e5669aa
e097a73
75d51be
8309318
f0849fd
06e9d56
ebefd43
c60339b
7dcca0f
4b3a48b
aea6b1f
1267194
45c8234
d8aab3b
7519530
11e8702
c6a1da7
4bbc589
bcc8dc9
d35727a
5e8fcb0
44fc845
8c0afb8
a374a46
f6d1807
e31f7fd
f8287ad
5f1b865
ef495c3
782c5b1
e4f03c2
ac8c361
5d78056
127853f
37bce6e
cf15cd0
f4af271
6aab004
0063164
4a1392b
48fd2d1
eddf974
ef26518
367a6bf
010b55e
ae89682
314852e
5c2b570
59b2d2a
828e416
60770f1
bcaf666
49da1e0
4cd6fd1
93d01a9
be0374c
88cd440
ecc4e9c
4fad903
1c7a2da
3e37776
72d43b4
55f5438
8239199
ae498cf
6ec5219
1624419
512433c
86dfd04
cfdcd5d
07c05b6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,17 @@ | ||
| RecordRequests = true | ||
| IncludeRequestHeaders = ["User-Agent"] | ||
|
|
||
| [Env] | ||
| DATABRICKS_CACHE_ENABLED = 'false' | ||
|
|
||
| [[Repls]] | ||
| Old = '"execution_time_ms": \d{1,5},' | ||
| New = '"execution_time_ms": SMALL_INT,' | ||
|
|
||
| [[Repls]] | ||
| Old = '(linux|darwin|windows)' | ||
| New = '[OS]' | ||
|
|
||
| [[Repls]] | ||
| Old = '"local_cache_measurements_ms": \[[^\]]*\]' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if cache is disabled, should this be non-empty?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We always measure if the cahce is disabled, with disabled cache we always compute values though anyway |
||
| New = '"local_cache_measurements_ms": [...redacted...]' | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,6 @@ | ||
| RecordRequests = true | ||
| Local = true | ||
| IncludeRequestHeaders = ["User-Agent"] | ||
|
|
||
| [Env] | ||
| DATABRICKS_CACHE_ENABLED = 'false' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| bundle: | ||
| name: cache-clear-test |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
|
|
||
| === First call in a session is expected to be a cache miss: | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] using cache key: [SHA256_HASH] | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] failed to stat cache file: (redacted) | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] cache miss, computing | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: should include function name that is being computed? This maybe more relevant in the future where is more than one function. |
||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] computed and stored result | ||
|
|
||
| === Second call in a session is expected to be a cache hit | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] using cache key: [SHA256_HASH] | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] cache hit | ||
|
|
||
| >>> [CLI] cache clear | ||
| Cache cleared successfully from [TEST_TMP_DIR]/.cache | ||
|
|
||
| === First call after a clear is expected to be a cache miss: | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] using cache key: [SHA256_HASH] | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] failed to stat cache file: (redacted) | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] cache miss, computing | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] computed and stored result | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| export DATABRICKS_CACHE_DIR=$(pwd)/.cache | ||
|
|
||
| $CLI cache clear &> /dev/null | ||
|
|
||
| title "First call in a session is expected to be a cache miss:\n" | ||
| trace $CLI bundle validate --debug 2>&1 | grep "Local Cache" | grep -v "cache path" | ||
|
|
||
| title "Second call in a session is expected to be a cache hit\n" | ||
| trace $CLI bundle validate --debug 2>&1 | grep "Local Cache" | grep -v "cache path" | ||
|
|
||
| trace $CLI cache clear | ||
|
|
||
| title "First call after a clear is expected to be a cache miss:\n" | ||
| trace $CLI bundle validate --debug 2>&1 | grep "Local Cache" | grep -v "cache path" | ||
|
|
||
| rm -rf "${DATABRICKS_CACHE_DIR}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| Cloud = false | ||
| Local = true | ||
|
|
||
| [Env] | ||
| DATABRICKS_CACHE_ENABLED = 'true' | ||
|
|
||
| # Redact structured logging fields from debug output | ||
| [[Repls]] | ||
| Old = ' pid=[0-9]+' | ||
| New = '' | ||
|
|
||
| [[Repls]] | ||
| Old = ' mutator=[A-Za-z]+' | ||
| New = '' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| bundle: | ||
| name: exploratory-cache-test |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
|
|
||
| === First call in a session is expected to be a cache miss: | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] using cache key: [SHA256_HASH] | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] failed to stat cache file: (redacted) | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] cache miss, computing | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] computed and stored result | ||
|
|
||
| === Second call in a session is expected to be a cache hit | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] using cache key: [SHA256_HASH] | ||
| [DEBUG_TIMESTAMP] Debug: [Local Cache] cache hit | ||
|
|
||
| === Bundle deploy should send telemetry values | ||
|
|
||
| >>> [CLI] bundle deploy -p dogfood | ||
| Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/exploratory-cache-test/default/files... | ||
| Deploying resources... | ||
| Deployment complete! | ||
|
|
||
| >>> print_telemetry_bool_values | ||
| local.cache.attempt true | ||
| local.cache.hit true |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| export DATABRICKS_CACHE_DIR=$(pwd)/.cache | ||
|
|
||
| $CLI cache clear &> /dev/null | ||
|
|
||
| title "First call in a session is expected to be a cache miss:\n" | ||
| trace $CLI bundle validate -p dogfood --debug 2>&1 | grep "Local Cache" | grep -v "cache path" | ||
|
|
||
| title "Second call in a session is expected to be a cache hit\n" | ||
| trace $CLI bundle validate -p dogfood --debug 2>&1 | grep "Local Cache" | grep -v "cache path" | ||
|
|
||
| title "Bundle deploy should send telemetry values\n" | ||
| trace $CLI bundle deploy -p dogfood | ||
|
|
||
| trace print_telemetry_bool_values | grep "local.cache" | ||
| rm out.requests.txt | ||
| rm -rf "${DATABRICKS_CACHE_DIR}" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| Cloud = false | ||
| Local = true | ||
|
|
||
| RecordRequests = true | ||
|
|
||
| [Env] | ||
| DATABRICKS_CACHE_ENABLED = 'true' | ||
|
|
||
| # Redact structured logging fields from debug output | ||
| [[Repls]] | ||
| Old = ' pid=[0-9]+' | ||
| New = '' | ||
|
|
||
| [[Repls]] | ||
| Old = ' mutator=[A-Za-z]+' | ||
| New = '' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| [[Repls]] | ||
| Old = '\d\d:\d\d:\d\d' | ||
| New = "[DEBUG_TIMESTAMP]" | ||
|
|
||
| [[Repls]] | ||
| Old = '[a-f0-9]{64}' | ||
| New = "[SHA256_HASH]" | ||
|
|
||
| [[Repls]] | ||
| Old = '[a-f0-9]{12}' | ||
| New = "[CACHE_KEY]" | ||
|
|
||
| [[Repls]] | ||
| Old = 'failed to stat cache file: .*' | ||
| New = "failed to stat cache file: (redacted)" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,6 +158,7 @@ Additional Commands: | |
| account Databricks Account Commands | ||
| api Perform Databricks API call | ||
| auth Authentication related commands | ||
| cache Local cache related commands | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the description it's not obvious that is user-level cache (and not whatever we have in .databricks). Perhaps make it explicit "user-level cache"? cc @juliacrawf-db |
||
| completion Generate the autocompletion script for the specified shell | ||
| configure Configure authentication | ||
| help Help about any command | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(optional) maybe worth recording the keys for the int map.