feat: release 2.3.0 with workspace plugin extensions
This commit is contained in:
1 parent
8380057548
commit
bb873ec0e0
44 files changed
+1497
-48
No files matched your search
@@ -15,7 +15,7 @@ def archive_path(batch_id: str):
|
||||
|
||||
def cached(batch_id: str, batch: dict) -> bool:
|
||||
return bool(batch.get("report_ready")) and report_export.reusable(
|
||||
archive_path(batch_id), report_export.BATCH_ARCHIVE_SIGNATURE, "completed"
|
||||
archive_path(batch_id), report_export.batch_archive_signature(batch_id), "completed"
|
||||
)
|
||||
|
||||
|
||||
@@ -41,8 +41,14 @@ def _snapshot(state: dict) -> dict:
|
||||
def status(batch_id: str, batch: dict) -> dict:
|
||||
with _lock:
|
||||
state = _states.get(batch_id)
|
||||
if state:
|
||||
if state and state["status"] != "ready":
|
||||
return _snapshot(state)
|
||||
if (
|
||||
state
|
||||
and state.get("signature") == report_export.batch_archive_signature(batch_id)
|
||||
and archive_path(batch_id).is_file()
|
||||
):
|
||||
return _snapshot(state)
|
||||
if cached(batch_id, batch):
|
||||
return {
|
||||
"status": "ready",
|
||||
@@ -65,11 +71,12 @@ def status(batch_id: str, batch: dict) -> dict:
|
||||
|
||||
|
||||
def prepare(batch_id: str, batch: dict) -> dict:
|
||||
cache_ready = cached(batch_id, batch)
|
||||
with _lock:
|
||||
current = _states.get(batch_id)
|
||||
if current and current["status"] == "preparing":
|
||||
return _snapshot(current)
|
||||
if cached(batch_id, batch):
|
||||
if cache_ready:
|
||||
_states.pop(batch_id, None)
|
||||
return status_from_cache()
|
||||
state = {
|
||||
@@ -88,11 +95,17 @@ def prepare(batch_id: str, batch: dict) -> dict:
|
||||
def run() -> None:
|
||||
try:
|
||||
with report_export.export_lock("batch:" + batch_id):
|
||||
signature = report_export.batch_archive_signature(batch_id)
|
||||
latest = report_export.store.get("batch", batch_id)
|
||||
if not (latest and cached(batch_id, latest)):
|
||||
report_export.export_batch(batch_id, progress=update)
|
||||
with _lock:
|
||||
state.update(status="ready", stage="报告包已就绪", finished_at=time.monotonic())
|
||||
state.update(
|
||||
status="ready",
|
||||
stage="报告包已就绪",
|
||||
finished_at=time.monotonic(),
|
||||
signature=signature,
|
||||
)
|
||||
except Exception as exc:
|
||||
with _lock:
|
||||
state.update(
|
||||
|
||||
Reference in new issue
Block a user