feat: set progressTasks in Callback correctly

This commit is contained in:
Matthias
2024-11-17 11:32:02 +01:00
parent de9294d1f4
commit ca42f86900

View File

@@ -29,14 +29,15 @@ def __run_download(job_id: str, config_loc: Config):
exchange = get_exchange(config_loc) exchange = get_exchange(config_loc)
def ft_callback(task) -> None: def ft_callback(task) -> None:
print(task) ApiBG.jobs[job_id]["progress_tasks"][str(task.id)] = {
"progress": task.completed,
"total": task.total,
"description": task.description,
}
pt = get_progress_tracker(ft_callback=ft_callback) pt = get_progress_tracker(ft_callback=ft_callback)
download_data(config_loc, exchange, progress_tracker=pt) download_data(config_loc, exchange, progress_tracker=pt)
# ApiBG.jobs[job_id]["result"] = {
# }
ApiBG.jobs[job_id]["status"] = "success" ApiBG.jobs[job_id]["status"] = "success"
except (OperationalException, Exception) as e: except (OperationalException, Exception) as e:
logger.exception(e) logger.exception(e)
@@ -66,6 +67,7 @@ def pairlists_evaluate(
"category": "download_data", "category": "download_data",
"status": "pending", "status": "pending",
"progress": None, "progress": None,
"progress_tasks": {},
"is_running": False, "is_running": False,
"result": {}, "result": {},
"error": None, "error": None,