diff --git a/README.md b/README.md
index afa6416..388e4a4 100644
--- a/README.md
+++ b/README.md
@@ -23,7 +23,11 @@
按 Ctrl+C 请求停止,等待工具收尾;不要直接关闭窗口。下次使用 --retry 指定批次,可恢复未完成项。成功产物只有在输入、工具和输出摘要仍匹配时才复用;源工程变化会完整重新导出该工程。
-退出码:0 全部请求项成功;1 含扫描问题/部分成功/失败;2 环境或输入配置错误;130 已取消。
+默认尽力导出并持续完成批次。单项异常、缺工具/缺库、超时、格式检查提示或进程收尾提示,都记录下来并继续后续工具和工程;报告文件被占用也不阻塞导出。只有用户主动按 Ctrl+C 才停止批次。
+
+生成了非空文件便保留在正常分类目录,并显示「已导出」或「已导出(有提示)」。没有生成文件的工程显示「已跳过(无导出文件)」,单项显示「未导出」或「已跳过」。格式检查、非零退出和源文件变化保留为提示;带提示的产物不会作为已验证成功结果复用。收尾不确定时保留临时副本及自有进程句柄,继续使用独立副本运行其余任务。
+
+退出码:0 批次已跑完(允许存在跳过项和提示);2 启动环境或输入配置错误,未能开始;130 用户主动取消。判断具体取得了哪些文件,应查看 HTML/JSON 中的逐项结果。
## 输出内容
@@ -38,7 +42,7 @@
工具、模式、快照、输入/输出摘要分别保存。同名字段不互相覆盖;分层属性、平铺有效值、网表身份表和当前中央库是不同来源。先看「导出汇总.html」,再进入工程的逐项说明。
-“成功”表示请求的导出项生成并通过产物检查,不代表换料正确、ERC 通过或全部制造几何已核验。缺工具、COM 不匹配、缺库或不支持的内容均明确列出,不使用空文件冒充成功。
+「已导出」表示文件已取得,不代表换料正确、ERC 通过或全部制造几何已核验。有检查提示时会注明具体原因;缺工具、COM 不匹配、缺库或不支持的内容均列出并跳过。
## 兼容与边界
diff --git a/docs/releases/v0.1.1.md b/docs/releases/v0.1.1.md
new file mode 100644
index 0000000..c172202
--- /dev/null
+++ b/docs/releases/v0.1.1.md
@@ -0,0 +1,12 @@
+# MentorExport 0.1.1
+
+2026-11-09。根据工单 #1 后用户确认的新规则,默认以取得文件和跑完批次为目标。工单只有程序附件,没有导出批次日志,因此本版调整运行策略,不声称已复现现场未知故障。
+
+- 格式检查不通过、工具非零退出或超时但生成了文件:保留到正常分类目录,显示「已导出(有提示)」;原始退出码、格式检查及输入摘要继续记录。
+- 只取得部分导出内容,也不把整个工程判为失败;无产物时显示「已跳过(无导出文件)」。
+- 收尾不确定、缺库、缺工具、预检帮助不匹配及单工程异常均不停止后续导出;收尾不确定仍保留临时副本与句柄证据。
+- HTML 或记录文件写入异常改为提示;单个输出复制异常不会阻止其他文件保留。
+- 正常结束批次统一退出 0,用户取消为 130,无法启动的配置错误为 2。退出 0 表示批次跑完,不代表所有内容完整。
+- 带提示的产物不参与「已验证成功」重试复用。源工程和中央库仍只读,工具运行在隔离副本上。
+
+本次不修改网表解析和比对功能,也不自动改动工程或重试换料。
diff --git a/docs/superpowers/specs/2026-11-06-batch-export.md b/docs/superpowers/specs/2026-11-06-batch-export.md
index 12e350e..a598a9e 100644
--- a/docs/superpowers/specs/2026-11-06-batch-export.md
+++ b/docs/superpowers/specs/2026-11-06-batch-export.md
@@ -2,6 +2,8 @@
日期:2026-11-06。状态:已获用户确认并实施;最终验收见 ../../validation-2026-11-06.md。
+2026-11-09 更新:用户明确要求尽力导出、单项问题不阻塞批次。下文原始设计中的严格全成功判定和收尾不确定时停止批次,已被 0.1.1 的持续导出策略取代,现行规则见 ../../releases/v0.1.1.md。
+
## 已确认要求
- 独立、可复制的工具文件夹,以命令行启动,中文问答式交互。
diff --git a/docs/validation-2026-11-09.md b/docs/validation-2026-11-09.md
new file mode 100644
index 0000000..e505fa9
--- /dev/null
+++ b/docs/validation-2026-11-09.md
@@ -0,0 +1,28 @@
+# 0.1.1 持续导出验收
+
+2026-11-09。按用户明确要求调整:取得文件即保留,单项问题不阻塞后续工具和工程,完整跑完批次退出 0;仅主动取消为 130,无法启动为 2。
+
+## 自动回归
+
+`python -X utf8 -m pytest -q`:**55 passed in 69.90s**。
+
+覆盖非零退出仍有文件、未识别格式、文件复制/摘要异常、伴随文件保留、日志被占用、预检返回异常及抛异常、中央库不可读、原文件导出中变化、进程收尾不确定后继续、临时副本删除失败、普通工程异常后继续、用户主动取消以及带提示的 ASCII 仍可提供库件引用。带提示产物不会作为已验证成功结果复用。
+
+独立审查发现的遗漏均已修正并加入先失败后通过的回归;最后两项针对 ASCII 主文件选择与逐文件元数据错误的复查无待处理发现。
+
+## 最终便携包实际批次
+
+将最终 ZIP 对应工具复制到中文和空格目录,从 `C:\Windows\Temp` 使用真实 CMD 入口。PATH 仅保留 System32,PYTHONHOME/PYTHONPATH 指向无效路径;仍使用预置 Python 并自动发现本机 Mentor EE7.9.5。
+
+- 真实工程 A:只在验收副本中清空中央库路径,10 项生成,库件读取跳过,工程标记「已导出(有提示)」。
+- 真实工程 B:A 之后继续执行,全部 11 项生成。
+- 第三个扫描条目缺数据库:记录为扫描问题,不阻止另外两个工程。
+- 首轮实际导出 159.828 秒,退出码 0;随后重试 11.219 秒,退出码 0。
+- 15 个验收输入文件摘要前后完全一致;两个工程的 source_unchanged 均为 true。
+- 664 个发行文件及 ZIP 内文件与完整性清单一致。
+
+机器可读证据:`build/best-effort-acceptance-20261109-110803/acceptance.json`。
+
+最终发布 ZIP SHA256:`01ab5b5eec7f32f43d6670d9f4bfd893c505e7c73336587a25fbe1afd911e69b`。
+
+工单 #1 原附件只有程序与配置,没有实际导出批次日志,本次未复现其未知现场根因;本版验证的是用户指定的新判定和继续执行策略。也未将导出文件标记为电气正确性校验通过。
diff --git a/mentorexport/__init__.py b/mentorexport/__init__.py
index 95162b5..8a2342c 100644
--- a/mentorexport/__init__.py
+++ b/mentorexport/__init__.py
@@ -1,2 +1,2 @@
"""Portable Mentor saved-schematic exports."""
-__version__ = "0.1.0"
+__version__ = "0.1.1"
diff --git a/mentorexport/cli.py b/mentorexport/cli.py
index 28f3f4f..d11079f 100644
--- a/mentorexport/cli.py
+++ b/mentorexport/cli.py
@@ -113,23 +113,45 @@ def run_batch(projects, problems, installation, output_root, scan_root, *, previ
"scan_root": str(Path(scan_root).resolve()), "output_root": str(output_root),
"created": datetime.now().astimezone().isoformat(), "installation": installation,
"owner": process_identity(os.getpid()),
- "problems": problems, "projects": []}
- write_json(batch / "环境信息.json", installation)
+ "problems": problems, "projects": [], "warnings": []}
+ def warn(message):
+ if message not in record["warnings"]:
+ record["warnings"].append(message)
+ progress("提示:" + message)
+
+ def checkpoint():
+ try:
+ write_report(batch, record)
+ except Exception as error:
+ warn("汇总报告暂未写入,继续导出:" + str(error))
+ try:
+ write_json(batch / "batch.json", record)
+ except Exception as error:
+ warn("批次记录暂未写入,继续导出:" + str(error))
+
+ def save_result(row):
+ try:
+ write_json(Path(row["folder"]) / "export.json", row["result"])
+ except Exception as error:
+ warn(row["project"]["name"] + ":工程记录暂未写入,继续下一工程:" + str(error))
+
+ try:
+ write_json(batch / "环境信息.json", installation)
+ except Exception as error:
+ warn("环境记录暂未写入,继续导出:" + str(error))
prior = previous_results(previous or {})
for project in projects:
record["projects"].append({"project": project, "folder": str(batch / project_folder_name(project, scan_root)), "status": "pending"})
- write_json(batch / "batch.json", record)
- write_report(batch, record)
- cleanup_uncertain = False
+ checkpoint()
for index, row in enumerate(record["projects"], 1):
if stop_event.is_set():
row["status"] = "cancelled"
row["result"] = {"status": "cancelled", "reason": "用户停止,尚未执行", "items": []}
- write_json(Path(row["folder"]) / "export.json", row["result"])
+ save_result(row)
continue
project = row["project"]
row["status"] = "running"
- write_json(batch / "batch.json", record)
+ checkpoint()
progress(f"\n[{index}/{len(projects)}] {project['name']}")
try:
result = exporter(project, installation, Path(row["folder"]), shared,
@@ -138,36 +160,36 @@ def run_batch(projects, problems, installation, output_root, scan_root, *, previ
row["result"] = result
row["status"] = result["status"]
if result.get("cleanup_uncertain"):
- cleanup_uncertain = True
- stop_event.set()
+ warn(project["name"] + ":进程收尾有提示,保留临时副本并继续下一工程")
except KeyboardInterrupt:
stop_event.set()
row["status"] = "cancelled"
row["result"] = load_json(Path(row["folder"]) / "export.json", {"items": []})
row["result"].update(status="cancelled", reason="用户停止")
except Exception as exc:
- row["status"] = "failed"
+ row["status"] = "skipped"
row["result"] = load_json(Path(row["folder"]) / "export.json", {"items": []})
- row["result"].update(status="failed", reason=str(exc))
+ if any(item.get("outputs") for item in row["result"].get("items", [])):
+ row["status"] = "exported"
+ row["result"].update(status=row["status"], reason=str(exc))
folder = Path(row["folder"]) / "90_运行日志"
- folder.mkdir(parents=True, exist_ok=True)
- (folder / "exception.txt").write_text(traceback.format_exc(), encoding="utf-8")
+ try:
+ folder.mkdir(parents=True, exist_ok=True)
+ (folder / "exception.txt").write_text(traceback.format_exc(), encoding="utf-8")
+ except OSError as log_error:
+ warn(project["name"] + ":异常日志暂未写入:" + str(log_error))
+ warn(project["name"] + ":" + str(exc) + ";已跳过并继续")
if getattr(exc, "cleanup_uncertain", False):
- cleanup_uncertain = True
- stop_event.set()
row["result"]["cleanup_uncertain"] = True
- Path(row["folder"]).mkdir(parents=True, exist_ok=True)
- write_json(Path(row["folder"]) / "export.json", row["result"])
- write_json(batch / "batch.json", record)
- write_report(batch, record)
+ save_result(row)
+ checkpoint()
progress("结果:" + LABELS.get(row["status"], row["status"]))
cancelled = stop_event.is_set() or any(p["status"] == "cancelled" for p in record["projects"])
- record["state"] = "attention_required" if cleanup_uncertain else ("cancelled" if cancelled else "complete")
+ record["state"] = "cancelled" if cancelled else "complete"
record["finished"] = datetime.now().astimezone().isoformat()
- code = 1 if cleanup_uncertain else (130 if cancelled else (1 if problems or not projects or any(p["status"] != "success" for p in record["projects"]) else 0))
+ code = 130 if cancelled else 0
record["exit_code"] = code
- write_json(batch / "batch.json", record)
- write_report(batch, record)
+ checkpoint()
return batch, code
@@ -233,15 +255,18 @@ def main(argv=None):
settings = next((v for p in _settings_paths() if (v := load_json(p)) is not None), {})
installation = _choose_installation(args, settings)
diagnostic_root = Path(os.environ.get("LOCALAPPDATA", str(Path.home()))) / "MentorExport/diagnostics" / uuid.uuid4().hex
- installation["preflight"] = preflight_installation(installation, diagnostic_root / "mentor-help")
+ try:
+ installation["preflight"] = preflight_installation(installation, diagnostic_root / "mentor-help")
+ except Exception as error:
+ installation["preflight"] = {"status": "failed", "reason": str(error)}
if installation["preflight"]["status"] != "success":
- raise ValueError(installation["preflight"]["reason"] + "\n" + str(diagnostic_root))
+ print("提示:" + installation["preflight"]["reason"] + ";继续尝试各导出工具。\n" + str(diagnostic_root))
if args.check:
import json
print(json.dumps({"version": __version__, "python": sys.executable, "runtime_ok": True,
"installation": installation}, ensure_ascii=False, indent=2) if args.json else
f"运行环境正常。Mentor:{installation['version']} {installation['root']}")
- return 0
+ return 0 if installation["preflight"]["status"] == "success" else 2
print(f"\nMentorExport {__version__} · 原理图详细导出")
print(f"Mentor:{installation['version']} {installation['root']}")
print("读取已保存的原理图。请先保存目标工程;工具仅在副本上运行。")
@@ -307,11 +332,11 @@ def main(argv=None):
previous=previous, stop_event=stop, timeout=args.timeout)
finally:
signal.signal(signal.SIGINT, old_handler)
- record = load_json(batch / "batch.json")
+ record = load_json(batch / "batch.json", {"projects": []})
counts = {}
for row in record["projects"]:
counts[row["status"]] = counts.get(row["status"], 0) + 1
- print("\n本批结束:" + " ".join(f"{LABELS.get(k, k)} {v}" for k, v in counts.items()))
+ print("\n本批已结束(单项问题不影响后续工程):" + " ".join(f"{LABELS.get(k, k)} {v}" for k, v in counts.items()))
print("汇总报告:" + str(batch / "导出汇总.html"))
print("下次重试:导出.cmd --retry \"" + str(batch) + "\"")
if not args.yes:
diff --git a/mentorexport/exports.py b/mentorexport/exports.py
index d44d14d..2ac97ee 100644
--- a/mentorexport/exports.py
+++ b/mentorexport/exports.py
@@ -38,16 +38,30 @@ _UNCERTAIN_DESKTOPS = []
_LIBRARY_CACHE = {}
+def _checkpoint(path, record):
+ try:
+ write_json(path, record)
+ except Exception as error:
+ message = str(path) + ": " + str(error)
+ if message not in record.setdefault("warnings", []):
+ record["warnings"].append(message)
+
+
@contextmanager
-def _workspace(result):
+def _workspace(result, receipt=None):
path = Path(tempfile.mkdtemp(prefix="mexp-"))
try:
yield path
finally:
- if result.get("cleanup_uncertain"):
+ if result.get("cleanup_uncertain") or result.get("workspace_preserved"):
result.setdefault("workspace_preserved", str(path))
else:
- shutil.rmtree(path)
+ try:
+ shutil.rmtree(path)
+ except OSError as error:
+ result.update(workspace_preserved=str(path), workspace_cleanup_error=str(error))
+ if receipt is not None:
+ _checkpoint(receipt, result)
def _digest(value):
@@ -111,7 +125,7 @@ def _run(command, cwd, environment, log_dir, *, stop_event, timeout):
result["cleanup_uncertain"] = True
# Retain owned handles for further cleanup instead of abandoning live resources.
_UNCERTAIN_DESKTOPS.append(desktop)
- write_json(log_dir / "run.json", result)
+ _checkpoint(log_dir / "run.json", result)
return result
@@ -286,7 +300,7 @@ def _status(items):
return "cancelled"
if states and all(s == "success" for s in states):
return "success"
- return "partial" if "success" in states else "failed"
+ return "exported" if any(i.get("outputs") for i in items) else "skipped"
def export_project(project, installation, project_dir, shared_dir, *, previous=None, stop_event=None, timeout=45, progress=print):
@@ -299,26 +313,26 @@ def export_project(project, installation, project_dir, shared_dir, *, previous=N
"CMS requests read mode but may report ReadOnly=False; only isolated copies are opened.",
"Cell coordinate units and rotation remain native integers; multi-slot/swappable mappings unverified."]}
state = project_dir / "export.json"
- write_json(state, result)
- if _UNCERTAIN_DESKTOPS:
- result.update(status="failed", cleanup_uncertain=True,
- reason="A previous owned process has unconfirmed cleanup; restart only after resolving its recorded Job/processes")
- write_json(state, result)
- return result
- with _workspace(result) as temporary:
+ _checkpoint(state, result)
+ with _workspace(result, state) as temporary:
temp = _short(temporary)
captured = temp / "saved"
captured.mkdir()
try:
result["source_hashes"] = _capture(project, captured)
- result["library_source_hashes"] = _hashes(_library_sources(project))
+ try:
+ result["library_source_hashes"] = _hashes(_library_sources(project))
+ except Exception as error:
+ result["library_source_hashes"] = {}
+ result["library_source_error"] = str(error)
+ result["coverage_limits"].append("Library fingerprint unavailable: " + str(error))
fingerprint = _digest({"source": result["source_hashes"], "snapshot": project["snapshot"],
"root_block": project["root_block"], "configuration": project.get("configuration"),
"library": result["library_source_hashes"]})
result["source_fingerprint"] = fingerprint
except Exception as error:
- result.update(status="failed", reason=str(error), source_unchanged=False)
- write_json(state, result)
+ result.update(status="skipped", reason=str(error), source_unchanged=False)
+ _checkpoint(state, result)
return result
environment = _environment(installation)
old_items = {i["key"]: i for i in (previous or {}).get("items", [])}
@@ -336,7 +350,7 @@ def export_project(project, installation, project_dir, shared_dir, *, previous=N
discovery.update(status="failed", reason=str(error))
if discovery["status"] != "success":
result["coverage_limits"].append("Other snapshot names were not obtained: " + discovery.get("reason", ""))
- write_json(state, result)
+ _checkpoint(state, result)
for key, tool, folder in ITEMS:
output = None
item = {"key": key, "status": "failed", "reason": "", "outputs": [], "provenance": {}}
@@ -347,9 +361,6 @@ def export_project(project, installation, project_dir, shared_dir, *, previous=N
item["provenance"] = {"tool": identity, "snapshot": project["snapshot"], "root_block": project["root_block"],
"installation": installation["root"], "version": installation.get("version"),
"input_fingerprint": fingerprint, "reused": False}
- if result.get("cleanup_uncertain"):
- item.update(status="cancelled", reason="Not launched: previous owned process cleanup is uncertain")
- continue
if stop_event is not None and stop_event.is_set():
item.update(status="cancelled", reason="Cancelled before launch")
continue
@@ -376,7 +387,7 @@ def export_project(project, installation, project_dir, shared_dir, *, previous=N
item["provenance"]["log_dir"] = str(log_dir)
if run.get("cleanup_uncertain"):
result.update(cleanup_uncertain=True, workspace_preserved=str(temp))
- item["reason"] = "Owned process cleanup is uncertain; workspace preserved and later tools stopped"
+ item["reason"] = "Owned process cleanup is uncertain; workspace preserved; remaining exports continue"
elif run.get("cancelled"):
item.update(status="cancelled", reason="Cancelled while tool was running")
elif run.get("timed_out"):
@@ -384,7 +395,8 @@ def export_project(project, installation, project_dir, shared_dir, *, previous=N
elif run.get("error") or run.get("exit_code") != 0 or run.get("cleanup", {}).get("errors"):
item["reason"] = run.get("error") or "Tool exited unsuccessfully or process cleanup failed"
else:
- files = _validate(key, output)
+ _validate(key, output)
+ files = sorted(p for p in output.rglob("*") if p.is_file() and p.stat().st_size)
destination = project_dir / folder
published = []
for file in files:
@@ -393,26 +405,46 @@ def export_project(project, installation, project_dir, shared_dir, *, previous=N
shutil.copyfile(file, target)
published.append(target)
item.update(status="success", outputs=[str(p) for p in published])
+ item["validation"] = {"status": "passed"}
item["provenance"]["output_files"] = [_file_info(p) for p in published]
except Exception as error:
item.update(status="failed", reason=str(error))
finally:
if item["status"] in ("failed", "cancelled") and output is not None:
+ saved = []
+ publication_errors = []
try:
- evidence = project_dir / "90_运行日志" / key / "failed-output"
- saved = []
+ destination = project_dir / folder
for source in output.rglob("*"):
if source.is_file():
- target = evidence / source.relative_to(output)
- target.parent.mkdir(parents=True, exist_ok=True)
- shutil.copyfile(source, target)
- saved.append(_file_info(target))
- if saved:
- item["provenance"]["failed_output_files"] = saved
+ try:
+ target = destination / source.relative_to(output)
+ target.parent.mkdir(parents=True, exist_ok=True)
+ shutil.copyfile(source, target)
+ if target.stat().st_size:
+ saved.append(_file_info(target))
+ except OSError as error:
+ publication_errors.append(str(error))
+ result.setdefault("workspace_preserved", str(temp))
+ try:
+ if source.is_file() and source.stat().st_size:
+ saved.append(_file_info(source))
+ except OSError as metadata_error:
+ saved.append({"path": str(source), "size": None, "sha256": None,
+ "metadata_error": str(metadata_error)})
except OSError as error:
- item["provenance"]["failure_evidence_error"] = str(error)
+ publication_errors.append(str(error))
+ if saved:
+ item["outputs"] = [file["path"] for file in saved]
+ item["provenance"]["output_files"] = saved
+ if publication_errors:
+ item["provenance"]["publication_errors"] = publication_errors
+ if item["status"] == "failed" and item.get("outputs"):
+ item["status"] = "exported"
+ if item["status"] == "exported":
+ item["validation"] = {"status": "warning", "reason": item["reason"]}
result["status"] = "running"
- write_json(state, result)
+ _checkpoint(state, result)
try:
after = _hashes(_inputs(project))
result["source_hashes_after"] = after
@@ -425,9 +457,10 @@ def export_project(project, installation, project_dir, shared_dir, *, previous=N
if not result["source_unchanged"]:
for item in result["items"]:
if item["status"] == "success":
- item.update(status="failed", reason="Source changed during export; save and run a full new attempt")
- result["status"] = "failed" if result.get("cleanup_uncertain") else _status(result["items"])
- write_json(state, result)
+ item.update(status="exported", reason="Source changed during export; captured output retained; re-export to verify current source",
+ validation={"status": "warning", "reason": "Source changed during export"})
+ result["status"] = _status(result["items"])
+ _checkpoint(state, result)
return result
@@ -464,8 +497,6 @@ def list_snapshots(project, installation, work_dir):
executable = installation.get("tools", {}).get("constraints_xml")
if not executable:
return []
- if _UNCERTAIN_DESKTOPS:
- raise RuntimeError("A prior owned process has unconfirmed cleanup; snapshot discovery stopped")
workspace_state = {}
with _workspace(workspace_state) as temporary:
work = _short(temporary)
@@ -491,11 +522,15 @@ def _export_library(item, project, installation, result, destination, shared_dir
item.update(status="unavailable", reason="Central library missing or contains no local PDB/CEL partitions")
return
references = {"parts": set(), "cell": set()}
- flat = next((i for i in result["items"] if i["key"] == "ascii_flat" and i["status"] == "success"), None)
+ flat = next((i for i in result["items"] if i["key"] == "ascii_flat" and i["status"] in ("success", "exported") and i.get("outputs")), None)
if not flat:
item.update(status="unavailable", reason="Effective ASCII properties required to identify actually used parts/cells")
return
- for line in read_text(flat["outputs"][0]).splitlines():
+ report_path = next((Path(path) for path in flat["outputs"] if Path(path).name == "connections.txt"), None)
+ if report_path is None:
+ item.update(status="unavailable", reason="ASCII properties report was not generated")
+ return
+ for line in read_text(report_path).splitlines():
match = re.match(r"\s*Prop\s+(Part Number|Cell Name)\s+(.+?)\s*$", line)
if match:
references["parts" if match[1] == "Part Number" else "cell"].add(match[2])
@@ -562,17 +597,21 @@ def _export_library(item, project, installation, result, destination, shared_dir
log = destination.parent / "90_运行日志" / "library" / f"{index:03d}"
command = [str(HELPERS / "native_read.exe"), mode, str(dll_dir), str(copied)]
run = _run(command, work, environment, log, stop_event=stop_event, timeout=timeout)
+ if run.get("cleanup_uncertain"):
+ result.update(cleanup_uncertain=True, workspace_preserved=str(temp))
run["partition"] = relative
run["log_dir"] = str(log)
run["stdout_retained"] = True
- write_json(log / "run.json", run)
+ _checkpoint(log / "run.json", run)
data["runs"].append(run)
persist()
if run.get("cleanup_uncertain"):
result.update(cleanup_uncertain=True, workspace_preserved=str(temp))
- item.update(status="failed", reason="Library reader cleanup uncertain; workspace preserved and batch must stop")
+ item.update(status="failed", reason="Library reader cleanup uncertain; workspace preserved; remaining exports continue")
item["provenance"]["uncertain_run"] = run
- return
+ data["errors"].append({"partition": relative, "reason": item["reason"]})
+ persist()
+ continue
if run.get("cancelled"):
item.update(status="cancelled", reason="Library reading cancelled")
return
@@ -601,7 +640,7 @@ def _export_library(item, project, installation, result, destination, shared_dir
persist()
(log / "stdout.txt").unlink()
run["stdout_retained"] = False
- write_json(log / "run.json", run)
+ _checkpoint(log / "run.json", run)
partitions[relative]["run"] = deepcopy(run)
persist()
except (OSError, ValueError) as error:
@@ -629,7 +668,9 @@ def _export_library(item, project, installation, result, destination, shared_dir
if data["errors"] or any(missing.values()) or any(ambiguous.values()):
item.update(status="failed", reason="Partial library coverage: missing/ambiguous names or failed partitions; see index")
else:
- item.update(status="success", reason="Used part/cell records read from fingerprinted shared library")
+ item.update(status="success" if flat["status"] == "success" else "exported",
+ reason="Used part/cell records read from fingerprinted shared library" +
+ ("; references came from ASCII export with warnings" if flat["status"] != "success" else ""))
def _validate_native(native, mode):
diff --git a/mentorexport/report.py b/mentorexport/report.py
index 7d55e80..7fc7448 100644
--- a/mentorexport/report.py
+++ b/mentorexport/report.py
@@ -5,8 +5,8 @@ from pathlib import Path
import os
from urllib.parse import quote
-LABELS = {"success": "成功", "partial": "部分成功", "failed": "失败",
- "unavailable": "不可用", "cancelled": "已取消", "running": "执行中", "pending": "待执行"}
+LABELS = {"success": "已导出", "exported": "已导出(有提示)", "partial": "已导出(有提示)", "failed": "未导出",
+ "skipped": "已跳过(无导出文件)", "unavailable": "已跳过", "cancelled": "已取消", "running": "执行中", "pending": "待执行"}
STYLE = """body{font:15px/1.65 'Segoe UI','Microsoft YaHei',sans-serif;background:#f4f6f9;color:#243246;margin:32px auto;max-width:1150px;padding:0 24px}
table{border-collapse:collapse;width:100%;background:white;margin:16px 0}th,td{padding:10px 14px;border:1px solid #dde3ec;text-align:left;vertical-align:top}th{background:#eaf0f8}
a{color:#1756a9;overflow-wrap:anywhere}.success{color:#137146}.failed{color:#b42318}.partial,.unavailable{color:#925600}code{background:#e9edf4;padding:2px 5px}small{color:#5c6a7d}.card{background:white;border:1px solid #dde3ec;border-radius:10px;padding:18px;margin:16px 0}"""
@@ -34,7 +34,6 @@ def write_report(batch, record):
for row in record.get("projects", []):
project = row["project"]
folder = Path(row["folder"])
- folder.mkdir(parents=True, exist_ok=True)
result = row.get("result", {})
items = []
for item in result.get("items", []):
@@ -53,20 +52,30 @@ def write_report(batch, record):
f'来源:{escape(str(project["path"]))}
'
f'根块:{escape(str(project.get("root_block", "")))} 快照:{escape(str(project.get("snapshot", "")))}
'
f'数据库快照名称(仅记录):{escape(snapshot_names)}
'
+ + (f'暂存文件位置:{link(result["workspace_preserved"], folder)}
' if result.get("workspace_preserved") else '') +
f'{escape(str(result.get("reason", "")))}'
'
各工具和模式的输出分别保留;同名字段可能具有不同来源。导出成功不等于工程电气正确性校验通过。
' '| 导出项 | 来源 | 状态 | 说明 | 产物 |
|---|
默认读取已保存的原理图;不同工具的字段和覆盖范围分别记录。点击工程名查看逐项结果。
' '| 工程 | 结果 | 说明 | 源文件 |
|---|