WGCNA 模块-性状热图改用 BH 校正 p 值,并支持 job 置顶与优先级排序
This commit is contained in:
+23
-2
@@ -8970,9 +8970,28 @@ async def list_existing_jobs():
|
||||
except OSError as exc:
|
||||
skipped.append({"job_id": job_dir.name, "reason": str(exc)})
|
||||
continue
|
||||
job_entries.append((job_dir, stat_result.st_mtime))
|
||||
pinned = False
|
||||
priority = 0
|
||||
priority_file = job_dir / ".plantai_job_priority.json"
|
||||
if priority_file.is_file():
|
||||
try:
|
||||
priority_data = json.loads(priority_file.read_text(encoding="utf-8"))
|
||||
pinned = priority_data.get("pinned") is True
|
||||
priority = int(priority_data.get("priority", 0))
|
||||
except (OSError, ValueError, TypeError, json.JSONDecodeError) as exc:
|
||||
skipped.append({
|
||||
"job_id": job_dir.name,
|
||||
"reason": f"invalid_job_priority_metadata: {exc}",
|
||||
})
|
||||
job_entries.append((job_dir, stat_result.st_mtime, pinned, priority))
|
||||
|
||||
for job_dir, st_mtime in sorted(job_entries, key=lambda item: item[1], reverse=True):
|
||||
# Pinned jobs come first, then explicit priority, while mtime remains
|
||||
# the stable default ordering for jobs without metadata.
|
||||
for job_dir, st_mtime, pinned, priority in sorted(
|
||||
job_entries,
|
||||
key=lambda item: (item[2], item[3], item[1]),
|
||||
reverse=True,
|
||||
):
|
||||
if job_dir.is_dir() and job_dir.name.startswith("job_"):
|
||||
# 检查目录内容
|
||||
final_dir = job_dir / "final"
|
||||
@@ -8990,6 +9009,8 @@ async def list_existing_jobs():
|
||||
jobs.append({
|
||||
"job_id": job_dir.name,
|
||||
"created_at": mtime.strftime("%Y-%m-%d %H:%M:%S"),
|
||||
"pinned": pinned,
|
||||
"priority": priority,
|
||||
"completed_stages": completed_stages,
|
||||
"has_input": (INPUT_ROOT / job_dir.name).exists(),
|
||||
"workspace_dir": str(job_dir)
|
||||
|
||||
Reference in New Issue
Block a user