Skip to content
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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yangwang201911
Copy link

Fix the run_tests.py terminated with exception when timeout occurs.
Signed-off-by: Wang, Yang yang4.wang@intel.com

Signed-off-by: Wang, Yang <yang4.wang@intel.com>
@yangwang201911 yangwang201911 marked this pull request as draft June 28, 2022 16:44
@yangwang201911 yangwang201911 marked this pull request as ready for review June 28, 2022 16:44
@@ -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:
Copy link
Collaborator

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

Copy link
Author

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.

Copy link
Author

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
image

@yangwang201911
Copy link
Author

Can't reproduced now.

Signed-off-by: Wang, Yang <yang4.wang@intel.com>
Signed-off-by: Wang, Yang <yang4.wang@intel.com>
@@ -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))
Copy link
Collaborator

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.

Copy link
Author

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.

Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants