Commit 9bb7c1ad authored by ibuler's avatar ibuler

[Update] 更改命令执行超时提示

parent d5cb0a2e
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
import uuid import uuid
import json import json
from celery.exceptions import SoftTimeLimitExceeded
from django.utils import timezone from django.utils import timezone
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext from django.utils.translation import ugettext
...@@ -64,6 +65,9 @@ class CommandExecution(models.Model): ...@@ -64,6 +65,9 @@ class CommandExecution(models.Model):
try: try:
result = runner.execute(self.command, 'all') result = runner.execute(self.command, 'all')
self.result = result.results_command self.result = result.results_command
except SoftTimeLimitExceeded as e:
print("Run timeout than 60s")
self.result = {"error": str(e)}
except Exception as e: except Exception as e:
print("Error occur: {}".format(e)) print("Error occur: {}".format(e))
self.result = {"error": str(e)} self.result = {"error": str(e)}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment