Explorar o código

Fix bugs about progress

Bob Huang %!s(int64=3) %!d(string=hai) anos
pai
achega
7fc5b226af

+ 1 - 1
backend_refactor/db/task.py

@@ -13,7 +13,7 @@ class Task(db.Model):
     create_time = db.Column(db.BigInteger)
     status = db.Column(db.Enum('QUEUEING', 'RUNNING', 'FINISHED', 'ERROR'))
     progress = db.Column(db.Integer)
-    result = db.Column(db.String(8192))
+    result = db.Column(db.String(81920))
 
     def __init__(self, uuid, type, create_time=time.time() * 1000, status='QUEUEING', progress=0, result='{}'):
         self.uuid = uuid

+ 1 - 0
backend_refactor/route/analyze.py

@@ -39,6 +39,7 @@ def callback_generator(task_uuid):
                 logging.debug("calling to " + status)
         except Exception as e:
             logging.debug("nmsl", exc_info=e)
+            raise e
 
     return callback
 

+ 1 - 1
backend_refactor/service/video_analyzer.py

@@ -68,7 +68,7 @@ def run_openpose_for_npy_and_video(video_uuid, callback: Callable):
                 out.write(canvas)
 
             c += 1
-            callback("RUNNING", progress=int(100*c/(total_frames/sampling_fps)))
+            callback("RUNNING", progress=min(99,int(100*c/(total_frames/sampling_fps))))
         else:
             break
 

+ 2 - 1
frontend_refactor/src/containers/TaskList.js

@@ -43,10 +43,11 @@ class TaskList extends React.Component {
                             let data = ""
                             let advice = ""
                             let raw = ""
-                            let progress = 0
+                            let progress = details.status === "FINISHED" ? 100 : 0
 
                             try {
                                 progress = details.progress
+
                             } catch (e) {
 
                             }