databricks-tellr 0.3.10.dev1__tar.gz → 0.3.10.dev2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: databricks-tellr
3
- Version: 0.3.10.dev1
3
+ Version: 0.3.10.dev2
4
4
  Summary: Tellr deployment tooling for Databricks Apps
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -1117,12 +1117,12 @@ def _delete_branch(
1117
1117
  raise
1118
1118
 
1119
1119
 
1120
- # Lakebase branch TTL: 1 day. Branches auto-expire and are garbage-collected
1121
- # after this window. The deploy flow relies on this for cleanup — we never
1122
- # explicitly delete old branches, because Lakebase's delete is async and its
1123
- # purge window is unpredictable (fixed-name reuse hits "branch id already
1124
- # exists" for many minutes after delete). Unique-per-deploy IDs + TTL sidesteps
1125
- # the whole issue.
1120
+ # Lakebase branch TTL: 1 day. This is now only an orphan backstop — if a deploy
1121
+ # crashes between create and cleanup, the TTL eventually garbage-collects the
1122
+ # stranded branch. The normal flow no longer relies on it: branches use fixed
1123
+ # names and are explicitly deleted and recreated (_recreate_ephemeral_branch,
1124
+ # delete_local) via _delete_branch, whose delete is idempotent and was verified
1125
+ # to leave the name immediately reusable.
1126
1126
  _BRANCH_TTL_SECONDS = 86400
1127
1127
 
1128
1128
 
@@ -1130,26 +1130,19 @@ def _create_branch_from(
1130
1130
  ws: WorkspaceClient,
1131
1131
  project_name: str,
1132
1132
  source_branch: str,
1133
- target_branch_prefix: str,
1133
+ branch_id: str,
1134
1134
  ) -> dict[str, Any]:
1135
- """Create a new Lakebase branch as a child of `source_branch`.
1135
+ """Create a new Lakebase branch named ``branch_id`` as a child of
1136
+ ``source_branch``.
1136
1137
 
1137
- The branch ID is `{target_branch_prefix}-{unix_timestamp}` so that every
1138
- deploy gets a fresh unique ID. This avoids the "branch id already exists"
1139
- collision we hit when trying to reuse a fixed ID right after a delete
1140
- Lakebase's delete is async and its purge window is unpredictable.
1141
-
1142
- Branch is created with a 1-day TTL so Lakebase garbage-collects it for us.
1143
- The staging app the branch backs will break after ~1 day; re-deploy to get
1144
- a fresh branch. This trade is intentional: no cleanup code, no stale state.
1138
+ The branch id is used verbatim (a fixed per-instance name). A 1-day TTL is
1139
+ attached purely as an orphan backstop so abandoned instances get
1140
+ garbage-collected; freshness comes from delete-then-create (see
1141
+ _recreate_ephemeral_branch), not from the TTL.
1145
1142
 
1146
1143
  Waits on the create operation, then polls list_endpoints on the new branch
1147
- until an endpoint with a populated host appears (up to
1148
- _BRANCH_ENDPOINT_TIMEOUT_S). Raises DeploymentError on timeout.
1149
-
1150
- Returns a lakebase_result-shaped dict pointing at the new branch, with an
1151
- added `branch_id` field so callers can reference the unique name (e.g.,
1152
- for SP role registration).
1144
+ until an endpoint with a populated host appears. Raises DeploymentError on
1145
+ timeout. Returns a lakebase_result-shaped dict with an added ``branch_id``.
1153
1146
  """
1154
1147
  if not HAS_AUTOSCALING_SDK:
1155
1148
  raise DeploymentError(
@@ -1157,7 +1150,6 @@ def _create_branch_from(
1157
1150
  "Upgrade databricks-sdk."
1158
1151
  )
1159
1152
 
1160
- branch_id = f"{target_branch_prefix}-{int(time.time())}"
1161
1153
  source_path = f"projects/{project_name}/branches/{source_branch}"
1162
1154
  target_parent = f"projects/{project_name}"
1163
1155
  target_path = f"projects/{project_name}/branches/{branch_id}"
@@ -1214,17 +1206,17 @@ def _recreate_ephemeral_branch(
1214
1206
  ws: WorkspaceClient,
1215
1207
  project_name: str,
1216
1208
  source_branch: str,
1217
- target_branch_prefix: str,
1209
+ branch_id: str,
1218
1210
  ) -> dict[str, Any]:
1219
- """Create a fresh ephemeral Lakebase branch for this deploy.
1211
+ """Refresh an ephemeral Lakebase branch to a fresh copy of source_branch.
1220
1212
 
1221
- Thin wrapper around _create_branch_from for call-site readability. Does
1222
- NOT delete any prior branch we rely on Lakebase's TTL-driven garbage
1223
- collection (see _BRANCH_TTL_SECONDS) to clean up old branches, because
1224
- explicit delete has an async purge window that causes fixed-ID reuse to
1225
- collide for many minutes.
1213
+ Deletes ``branch_id`` (idempotent no-op if absent) then recreates it from
1214
+ ``source_branch``. Delete-then-create on a fixed name was verified clean
1215
+ (~6s, no collision); the older "skip delete and rely on TTL" workaround is
1216
+ no longer needed.
1226
1217
  """
1227
- return _create_branch_from(ws, project_name, source_branch, target_branch_prefix)
1218
+ _delete_branch(ws, project_name, branch_id)
1219
+ return _create_branch_from(ws, project_name, source_branch, branch_id)
1228
1220
 
1229
1221
 
1230
1222
  def _write_requirements(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: databricks-tellr
3
- Version: 0.3.10.dev1
3
+ Version: 0.3.10.dev2
4
4
  Summary: Tellr deployment tooling for Databricks Apps
5
5
  Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "databricks-tellr"
7
- version = "0.3.10.dev1"
7
+ version = "0.3.10.dev2"
8
8
  description = "Tellr deployment tooling for Databricks Apps"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"