1+ import shortuuid
12from fastapi import FastAPI , UploadFile , File , Form
23from fastapi .middleware .cors import CORSMiddleware
3- import shortuuid
44
5- from backend .file_utils .files import reset_dirs
6- from backend .utils .docker_runner import run_pipeline
7- from backend .utils .data_uploader import handle_upload
8- from backend .utils .methods_handler import Methods
9- from backend .utils .results_sender import send_folder_by_email
105from backend .config .paths import (
11- RESULTS_DIR ,
126 DATASET_FILE ,
137 METHODS_TS_FILE ,
14- get_thread_filepath ,
15- get_tmp_thread_files
168)
9+ from backend .utils .data_uploader import handle_upload
10+ from backend .utils .methods_handler import Methods
11+ from backend .utils .task import process_and_cleanup_task
1712
1813dataset_methods = Methods (data_filepath = DATASET_FILE , output_filepath = METHODS_TS_FILE )
1914
@@ -38,22 +33,13 @@ async def handle_submit(
3833
3934 handle_upload (task_uid , file , methods , dataset_methods )
4035
41- run_pipeline (task_uid )
42-
43- send_folder_by_email (
44- email ,
45- get_thread_filepath (task_uid , RESULTS_DIR ),
46- experiment ,
47- file .filename ,
48- )
49-
50- tmp_thread_dirs = get_tmp_thread_files (task_uid )
51- reset_dirs (tmp_thread_dirs )
36+ process_and_cleanup_task .delay (task_uid , email , experiment , file .filename )
5237
5338 return {
39+ "task_uid" : task_uid ,
5440 "experiment" : experiment ,
5541 "filename" : file .filename ,
5642 "email" : email ,
5743 "methods" : methods ,
58- "message" : "Data successfully uploaded" ,
44+ "message" : "Data uploaded, processing started " ,
5945 }
0 commit comments