perf(catalog): share verified cell cache across task execution and UI
This commit is contained in:
1 parent
d10356ee3d
commit
cf671a1d3f
3 files changed
+21
-3
No files matched your search
@@ -74,12 +74,19 @@ def snapshot_target_cell(path, *, required=True):
|
||||
return value
|
||||
|
||||
|
||||
def cell_catalog_evidence_root(snapshot):
|
||||
root = Path(snapshot).resolve().parent.parent
|
||||
if root.parent.name.casefold() == "tasks":
|
||||
root = root.parent.parent
|
||||
return root / "cell-catalog"
|
||||
|
||||
|
||||
def target_cell_catalog(app, snapshot, metadata, selected):
|
||||
raw_path = str(app.GetProjectData().CentralLibraryPath)
|
||||
library = Path(raw_path)
|
||||
if not raw_path.strip() or not library.is_absolute():
|
||||
raise ValueError("Active project has no absolute central library path for Cell validation")
|
||||
return cell_catalog_binding(library, metadata[3], selected, Path(snapshot).parent.parent / "cell-catalog")
|
||||
return cell_catalog_binding(library, metadata[3], selected, cell_catalog_evidence_root(snapshot))
|
||||
|
||||
|
||||
def cell_catalog_binding(library, part_number, selected, evidence_root):
|
||||
|
||||
@@ -12,7 +12,8 @@ import subprocess
|
||||
from uuid import uuid4
|
||||
|
||||
from .errors import TaskCenterError
|
||||
from .native_helper import read_snapshot, require_resumable_transaction, snapshot_target_cell, cell_catalog_binding
|
||||
from .native_helper import (read_snapshot, require_resumable_transaction, snapshot_target_cell,
|
||||
cell_catalog_binding, cell_catalog_evidence_root)
|
||||
from .quick_run import (
|
||||
TERMINAL_STATES, IDLE_PROGRESS_TIMEOUT_SECONDS, QuickRunStepResult,
|
||||
_native_helper_launch_arguments, _next_unfinished_command, _path_key,
|
||||
@@ -90,7 +91,7 @@ def require_current_cell_binding(snapshot, binding, project, metadata):
|
||||
raise ValueError('Recovery has no bound target Cell catalog')
|
||||
from .cell_catalog import project_library_path
|
||||
library = project_library_path(project)
|
||||
current = cell_catalog_binding(library, metadata[3], cell, snapshot.parent.parent / 'cell-catalog')
|
||||
current = cell_catalog_binding(library, metadata[3], cell, cell_catalog_evidence_root(snapshot))
|
||||
if current != binding['cell_catalog']:
|
||||
raise ValueError('Recovery target Cell catalog has changed')
|
||||
return current
|
||||
|
||||
@@ -138,3 +138,13 @@ WScript.Echo CStr(Failure<>0)
|
||||
If Failure=0 Then WScript.Echo QPTargetCell(Result("meta"))
|
||||
''')
|
||||
assert output.splitlines()==(['True'] if fault else ['False','CELL_A'])
|
||||
|
||||
|
||||
def test_cell_catalog_cache_is_shared_by_project_tasks_but_outside_queue(tmp_path):
|
||||
data=tmp_path/'data'
|
||||
for task in ('first','second'):
|
||||
snapshot=data/'tasks'/task/'quick-run'/'snapshot-job.tsv'
|
||||
snapshot.parent.mkdir(parents=True);snapshot.write_text('snapshot')
|
||||
assert native_helper.cell_catalog_evidence_root(snapshot)==data/'cell-catalog'
|
||||
plain=data/'quick-run'/'snapshot-job.tsv';plain.parent.mkdir();plain.write_text('snapshot')
|
||||
assert native_helper.cell_catalog_evidence_root(plain)==data/'cell-catalog'
|
||||
Reference in new issue
Block a user