feat(ai-studio): resume hosted image jobs

This commit is contained in:
chengma
2026-07-11 14:29:58 +08:00
parent cddadf6364
commit dcaf68fd07
9 changed files with 240 additions and 7 deletions
+10 -3
View File
@@ -738,9 +738,16 @@ def update_job_status(
return get_job(job_id, conn=database)
def list_resumable_jobs(path=None, conn=None, project_id=None):
clauses = ["status IN (?, ?)", "task_id IS NOT NULL"]
params = ["submitted", "running"]
def list_resumable_jobs(path=None, conn=None, project_id=None, include_failed_downloads=False):
if include_failed_downloads:
clauses = [
"task_id IS NOT NULL",
"(status IN (?, ?) OR (status = ? AND output_asset_id IS NULL))",
]
params = ["submitted", "running", "failed"]
else:
clauses = ["status IN (?, ?)", "task_id IS NOT NULL"]
params = ["submitted", "running"]
if project_id is not None:
clauses.append("project_id = ?")
params.append(int(project_id))