备份现场结果补录、图片修复与跳过文章功能

This commit is contained in:
Longtail committed 2026-10-31 17:08:49 +08:00
1 parent 1e6504b4a2
commit d157c179c8
20 files changed
+597 -47

No files matched your search

+18
View File
@@ -184,6 +184,24 @@ class Store:
self._check_owner(data['owner'])
return {'job': self._job(db, self.run['active']) if self.run['active'] else None, 'run': self.run}
def skip(self, data):
"""Explicitly discard an unsubmitted task and continue the existing queue."""
with self.lock, self.db() as db:
self._check_owner(data['owner'])
if data.get('epoch') != self.run['epoch']:
raise ValueError('流程状态已改变,请重新确认后跳过')
if self.run['active'] != data.get('id'):
raise ValueError('不是当前任务,不能跳过')
job = self._job(db, data['id'])
if job['state'] not in {'preparing', 'importing', 'formatting', 'awaiting_user_review', 'needs_attention'} or job.get('submitted_at'):
raise ValueError('文章已提交或结果待核对,不能直接跳过,请先人工核对')
job.update(state='skipped', error='', skipped_at=time.time())
self.run.update(active=None, running=True, epoch=self.run['epoch'] + 1,
reason='已跳过当前文章,等待准备下一篇')
self._save(db, job)
self._persist(db)
return {'ok': True, 'fid': job['fid'], 'run': dict(self.run)}
def switch_begin(self, data):
with self.lock, self.db() as db:
self._check_owner(data['owner'])