修改适配Linux
This commit is contained in:
@@ -316,7 +316,7 @@ def _background_export(inference_id: int) -> None:
|
|||||||
status = "FAIL" if "error" in r else "OK"
|
status = "FAIL" if "error" in r else "OK"
|
||||||
logger.info(f"[Pool] {status} {r.get('name', '?')}: {r.get('error', r.get('output', ''))[:100]}")
|
logger.info(f"[Pool] {status} {r.get('name', '?')}: {r.get('error', r.get('output', ''))[:100]}")
|
||||||
if inference_id and file_store and "error" not in r:
|
if inference_id and file_store and "error" not in r:
|
||||||
_write_single_path(inference_id, r.get("output", ""), file_store, db_lock)
|
_write_single_path(inference_id, r["output"], file_store, db_lock)
|
||||||
|
|
||||||
results, summary = qgis_pool.submit_job(config, container_models, _on_progress)
|
results, summary = qgis_pool.submit_job(config, container_models, _on_progress)
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ class QgisPool:
|
|||||||
for line in worker.proc.stderr:
|
for line in worker.proc.stderr:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
if line:
|
if line:
|
||||||
logger.debug(f"[Worker-{worker.worker_id}] stderr: {line}")
|
logger.info(f"[Worker-{worker.worker_id}] {line}")
|
||||||
except Exception:
|
except Exception:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|||||||
@@ -188,4 +188,11 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
try:
|
||||||
|
main()
|
||||||
|
except Exception as e:
|
||||||
|
# 捕获 main() 未处理的异常,确保输出到 stderr
|
||||||
|
import traceback
|
||||||
|
print(f"[worker] 未捕获异常: {e}", file=sys.stderr)
|
||||||
|
traceback.print_exc(file=sys.stderr)
|
||||||
|
sys.exit(1)
|
||||||
|
|||||||
Reference in New Issue
Block a user