[Update] Volc status exception handle (#1780)

* update

* update
This commit is contained in:
Linchen Xiao 2024-12-26 15:43:24 +08:00 committed by GitHub
parent c48bbde26f
commit 56eaac6d8f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -227,20 +227,20 @@ class VOLCRunner(BaseRunner):
task_status = os.popen(ask_cmd).read() task_status = os.popen(ask_cmd).read()
pattern = r'(?<=\[{"Status":").*(?="}\])' pattern = r'(?<=\[{"Status":").*(?="}\])'
match = re.search(pattern, task_status) match = re.search(pattern, task_status)
if match:
task_status = match.group()
else:
task_status = 'Exception'
if self.debug: if self.debug:
print(task_status) print(task_status)
logs = os.popen(log_cmd).read() logs = os.popen(log_cmd).read()
with open(log_path, 'w', encoding='utf-8') as f: with open(log_path, 'w', encoding='utf-8') as f:
f.write(logs) f.write(logs)
if match:
task_status = match.group()
if task_status in [ if task_status in [
'Success', 'Failed', 'Cancelled', 'Exception', 'Success', 'Failed', 'Cancelled', 'Exception',
'Killing', 'SuccessHolding', 'FailedHolding' 'Killing', 'SuccessHolding', 'FailedHolding',
'Killed'
]: ]:
break break
# If pattern not found or command failed, sleep and retry
time.sleep(poll_interval) time.sleep(poll_interval)
else: else:
task_status = 'Exception' task_status = 'Exception'