MCPcopy Create free account
hub / github.com/Tron521/codex-console-temp / SelfCheckRun

Class SelfCheckRun

src/database/models.py:215–258  ·  view source on GitHub ↗

系统自检运行记录

Source from the content-addressed store, hash-verified

213
214
215class SelfCheckRun(Base):
216 """系统自检运行记录"""
217 __tablename__ = "selfcheck_runs"
218
219 id = Column(Integer, primary_key=True, autoincrement=True)
220 run_uuid = Column(String(64), unique=True, nullable=False, index=True)
221 mode = Column(String(20), nullable=False, default="quick") # quick / full
222 source = Column(String(40), nullable=False, default="manual") # manual / scheduler / api
223 status = Column(String(20), nullable=False, default="pending") # pending / running / completed / failed / cancelled
224 score = Column(Integer, default=0)
225 total_checks = Column(Integer, default=0)
226 passed_checks = Column(Integer, default=0)
227 warning_checks = Column(Integer, default=0)
228 failed_checks = Column(Integer, default=0)
229 duration_ms = Column(Integer, default=0)
230 summary = Column(String(500))
231 error_message = Column(Text)
232 result_data = Column(JSONEncodedDict) # 结构化明细(检查项/修复项/统计)
233 created_at = Column(DateTime, default=utcnow_naive, index=True)
234 started_at = Column(DateTime)
235 finished_at = Column(DateTime)
236 updated_at = Column(DateTime, default=utcnow_naive, onupdate=utcnow_naive)
237
238 def to_dict(self) -> Dict[str, Any]:
239 return {
240 "id": self.id,
241 "run_uuid": self.run_uuid,
242 "mode": self.mode,
243 "source": self.source,
244 "status": self.status,
245 "score": int(self.score or 0),
246 "total_checks": int(self.total_checks or 0),
247 "passed_checks": int(self.passed_checks or 0),
248 "warning_checks": int(self.warning_checks or 0),
249 "failed_checks": int(self.failed_checks or 0),
250 "duration_ms": int(self.duration_ms or 0),
251 "summary": self.summary,
252 "error_message": self.error_message,
253 "result_data": self.result_data or {},
254 "created_at": self.created_at.isoformat() if self.created_at else None,
255 "started_at": self.started_at.isoformat() if self.started_at else None,
256 "finished_at": self.finished_at.isoformat() if self.finished_at else None,
257 "updated_at": self.updated_at.isoformat() if self.updated_at else None,
258 }
259
260
261class Setting(Base):

Callers 1

create_selfcheck_runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected