Spaces:
Runtime error
Runtime error
Update gen_client.py
Browse filesupdate get_ranking_location
- gen_client.py +8 -2
gen_client.py
CHANGED
@@ -632,7 +632,8 @@ class HumanGenService:
|
|
632 |
if user_id is None or user_id == '':
|
633 |
user_id = 'test_version_phone'
|
634 |
process_status = ''
|
635 |
-
|
|
|
636 |
if len(self.all_requests) > 0:
|
637 |
for i in range(min(num_instance_dashone, len(self.all_requests))):
|
638 |
req = self.all_requests[i]
|
@@ -646,7 +647,8 @@ class HumanGenService:
|
|
646 |
for uid in self.all_user_requests:
|
647 |
if req in self.all_user_requests[uid]:
|
648 |
uuid = uid
|
649 |
-
break
|
|
|
650 |
data = '{"header":{"request_id":"","service_id":"","task_id":""},"payload":{"input": {"ref_image_path": "", "ref_video_path": "", "ref_video_name": "", "input_prompt": "", "prompt_template": "", "scale_depth": 0.7, "scale_pose": 0.5},"parameters":{}}}'
|
651 |
data = json.loads(data) # string to dict
|
652 |
data['header']['service_id'] = DASHONE_SERVICE_ID
|
@@ -659,16 +661,20 @@ class HumanGenService:
|
|
659 |
ret_status, ret_json = query_video_generation(request_id=req, data=data)
|
660 |
# print(f'ret_json = {ret_json}')
|
661 |
if ret_status == "SUCCESS" or ret_status == "FAILED":
|
|
|
662 |
if req in self.all_requests:
|
663 |
self.all_requests.remove(req) # delete request_id
|
664 |
if req in self.all_requests_time:
|
665 |
del self.all_requests_time[req]
|
666 |
else:
|
|
|
667 |
break
|
668 |
else:
|
|
|
669 |
break
|
670 |
else:
|
671 |
print(f'size of all_requests is empty.')
|
|
|
672 |
|
673 |
if user_id not in self.all_user_requests:
|
674 |
return f'You have not request a video generation task.', ''
|
|
|
632 |
if user_id is None or user_id == '':
|
633 |
user_id = 'test_version_phone'
|
634 |
process_status = ''
|
635 |
+
|
636 |
+
print(f'[get_ranking_location] ------ clean timeout and process over request start ------ ')
|
637 |
if len(self.all_requests) > 0:
|
638 |
for i in range(min(num_instance_dashone, len(self.all_requests))):
|
639 |
req = self.all_requests[i]
|
|
|
647 |
for uid in self.all_user_requests:
|
648 |
if req in self.all_user_requests[uid]:
|
649 |
uuid = uid
|
650 |
+
break
|
651 |
+
print(f'[get_ranking_location] find timeout request: {req}, uuid: {uuid}')
|
652 |
data = '{"header":{"request_id":"","service_id":"","task_id":""},"payload":{"input": {"ref_image_path": "", "ref_video_path": "", "ref_video_name": "", "input_prompt": "", "prompt_template": "", "scale_depth": 0.7, "scale_pose": 0.5},"parameters":{}}}'
|
653 |
data = json.loads(data) # string to dict
|
654 |
data['header']['service_id'] = DASHONE_SERVICE_ID
|
|
|
661 |
ret_status, ret_json = query_video_generation(request_id=req, data=data)
|
662 |
# print(f'ret_json = {ret_json}')
|
663 |
if ret_status == "SUCCESS" or ret_status == "FAILED":
|
664 |
+
print(f'[get_ranking_location] query timeout request process over: {req}, uuid: {uuid}')
|
665 |
if req in self.all_requests:
|
666 |
self.all_requests.remove(req) # delete request_id
|
667 |
if req in self.all_requests_time:
|
668 |
del self.all_requests_time[req]
|
669 |
else:
|
670 |
+
print(f'[get_ranking_location] query timeout request process running: {req}, uuid: {uuid}')
|
671 |
break
|
672 |
else:
|
673 |
+
print(f'[get_ranking_location] no timeout request.')
|
674 |
break
|
675 |
else:
|
676 |
print(f'size of all_requests is empty.')
|
677 |
+
print(f'[get_ranking_location] ------ clean timeout and process over request end ------ ')
|
678 |
|
679 |
if user_id not in self.all_user_requests:
|
680 |
return f'You have not request a video generation task.', ''
|