Skip to content

Commit 8aa85bb

Browse files
denikIsaac
andcommitted
acc: make read_lineage.py and extract_command_exec_id.py silent
Both are only used to register a replacement; no caller needs the value. Co-authored-by: Isaac <no-reply@databricks.com>
1 parent 8bc95b7 commit 8aa85bb

20 files changed

Lines changed: 24 additions & 28 deletions

File tree

‎acceptance/bin/extract_command_exec_id.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
"""
3-
Print the cmd-exec-id from the first recorded request that has one in its User-Agent, and update
4-
ACC_REPLS to replace it with [CMD_EXEC_ID_HASH]. The telemetry cmd_exec_id field is then only
3+
Update ACC_REPLS to replace the cmd-exec-id from the first recorded request that has one in its
4+
User-Agent with [CMD_EXEC_ID_HASH]. The telemetry cmd_exec_id field is then only
55
replaced if it matches the id the CLI actually sent.
66
77
Requires IncludeRequestHeaders = ["User-Agent"].
@@ -48,6 +48,4 @@ def extract_cmd_exec_id():
4848

4949

5050
if __name__ == "__main__":
51-
exec_id = extract_cmd_exec_id()
52-
add_repl(exec_id, "CMD_EXEC_ID_HASH")
53-
print(exec_id)
51+
add_repl(extract_cmd_exec_id(), "CMD_EXEC_ID_HASH")

‎acceptance/bin/read_lineage.py‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env python3
22
"""
3-
Print the lineage hash of the state, as the CLI reports it in the user agent (lineage/...)
4-
and telemetry (state_lineage). Update ACC_REPLS to replace it with [LINEAGE_HASH].
3+
Update ACC_REPLS to replace the lineage hash of the state, as the CLI reports it in the user
4+
agent (lineage/...) and telemetry (state_lineage), with [LINEAGE_HASH].
55
66
Use it after the deploy that mints a fresh lineage; fixture lineages hash to stable values
77
and need no replacement.
@@ -39,9 +39,7 @@ def main():
3939

4040
filename = get_state_file(args.target, backup=False)
4141
lineage = json.loads(open(filename).read())["lineage"]
42-
value = shortid_hash(lineage)
43-
add_repl(value, "LINEAGE_HASH")
44-
print(value)
42+
add_repl(shortid_hash(lineage), "LINEAGE_HASH")
4543

4644

4745
if __name__ == "__main__":

‎acceptance/bundle/config-remote-sync/job_fields/script‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ trap cleanup EXIT
1313

1414
touch dummy.whl
1515
$CLI bundle deploy
16-
read_lineage.py > /dev/null
16+
read_lineage.py
1717
job_id="$(read_id.py my_job)"
1818

1919

‎acceptance/bundle/config-remote-sync/resolve_variables/script‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cleanup() {
1010
trap cleanup EXIT
1111

1212
$CLI bundle deploy
13-
read_lineage.py > /dev/null
13+
read_lineage.py
1414
job_id="$(read_id.py my_job)"
1515
pipeline_id="$(read_id.py my_pipeline)"
1616

‎acceptance/bundle/config-remote-sync/variable_reference_parent/script‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cleanup() {
1010
trap cleanup EXIT
1111

1212
$CLI bundle deploy
13-
read_lineage.py > /dev/null
13+
read_lineage.py
1414
job_id="$(read_id.py my_job)"
1515

1616
title "Inject a spark_conf key under a field defined as a complex variable"

‎acceptance/bundle/state/state_present/script‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ rm "$OUT_REQUESTS"
4040
# resurrect. So this deploy starts fresh on the direct engine: there is nothing to migrate, it just
4141
# recreates the resource.
4242
trace DATABRICKS_BUNDLE_ENGINE=direct $CLI bundle deploy
43-
read_lineage.py > /dev/null
43+
read_lineage.py
4444
trace print_requests.py //api/2.1/unity-catalog/schemas | jq '.headers["User-Agent"][0]' | contains.py 'engine/direct' '!tf-provider'
4545
trace print_state.py | jq .serial | contains.py "1"
4646

‎acceptance/bundle/telemetry/config-remote-sync-recreate/script‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
trace $CLI bundle deploy
2-
read_lineage.py > /dev/null
2+
read_lineage.py
33

44
pipeline_id="$(read_id.py foo)"
55

‎acceptance/bundle/telemetry/config-remote-sync-save/script‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
trace $CLI bundle deploy
2-
read_lineage.py > /dev/null
2+
read_lineage.py
33

44
# Edit the job name locally (not deployed) so the local config diverges from the
55
# deployed state. config-remote-sync --save then overwrites that pending edit,

‎acceptance/bundle/telemetry/config-remote-sync/script‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
trace $CLI bundle deploy
2-
read_lineage.py > /dev/null
2+
read_lineage.py
33

44
job_id="$(read_id.py foo)"
55
edit_resource.py jobs $job_id <<EOF

‎acceptance/bundle/telemetry/deploy-error/script‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ errcode trace $CLI bundle deploy
22

33
trace cat "$OUT_REQUESTS" | jq 'select(has("path") and .path == "/telemetry-ext") | .body.protoLogs[] | fromjson | .entry.databricks_cli_log | {execution_context}' > out.telemetry.txt
44

5-
extract_command_exec_id.py > /dev/null
5+
extract_command_exec_id.py
66
rm "$OUT_REQUESTS"

0 commit comments

Comments
 (0)