-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the run_tests.py terminated with exception when timeout occurs. #3488
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Wang, Yang <yang4.wang@intel.com>
demos/tests/run_tests.py
Outdated
@@ -333,7 +333,10 @@ def option_to_args(key, value): | |||
execution_time = timeit.default_timer() - start_time | |||
demo.parse_output(output, test_case, device) | |||
except (subprocess.CalledProcessError, subprocess.TimeoutExpired) as e: | |||
output = e.output | |||
if type(e) == subprocess.TimeoutExpired: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's handled by elif isinstance(e, subprocess.TimeoutExpired):
below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. The exception found serval days ago can't be reproduced now. So Close this PR now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Failure appeared again as below caused by the timeout. I'm not sure if reopen this PR again? @Wovchena
Can't reproduced now. |
@@ -338,8 +338,7 @@ def option_to_args(key, value): | |||
exit_msg = f'Exit code: {e.returncode}\n' | |||
elif isinstance(e, subprocess.TimeoutExpired): | |||
exit_msg = f'Command timed out after {e.timeout} seconds\n' | |||
output += exit_msg | |||
print(output) | |||
print('{}\n{}'.format(output, exit_msg)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
output
var is used to save log file below: write_log(output, args.log_file)
. So you need this output += exit_msg
.
If I understand correctly, TimeoutExpired.output
is of bytes type for you. Maybe you can cast it to str before that +=
Please, add a comment to code with link to a bug https://bugs.python.org/issue43431 to explain why we have such cast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly,
TimeoutExpired.output
is of bytes type for you. Maybe you can cast it to str before that+=
Yes, you are right. output
var is bytes type under that host env when timeout happened. While don't know why the output
is Str type on my host when timeout happened.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check the bug. It appears on python3.8+ may be you have python3.7 or 3.6 on your host
Fix the run_tests.py terminated with exception when timeout occurs.
Signed-off-by: Wang, Yang yang4.wang@intel.com